Skip to content

Commit

Permalink
🔧 Build for both CommonJS and ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMiras committed Dec 3, 2024
1 parent dfd24d8 commit 54f0640
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
"name": "edilkamin",
"version": "1.3.2",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"scripts": {
"cli": "ts-node src/cli.ts",
"cli:debug": "node --inspect --require ts-node/register/transpile-only src/cli.ts",
"test": "mocha --require ts-node/register src/*.test.ts",
"test:debug": "mocha --require ts-node/register/transpile-only --inspect src/*.test.ts",
"lint": "prettier --check src docs .github *.md",
"format": "prettier --write src docs .github *.md",
"build": "tsc"
"lint": "prettier --check src docs .github *.md *.json",
"format": "prettier --write src docs .github *.md *.json",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build": "npm run build:cjs && npm run build:esm"
},
"repository": {
"type": "git",
Expand All @@ -24,7 +27,7 @@
},
"homepage": "https://github.com/AndreMiras/edilkamin.js#readme",
"bin": {
"edilkamin": "dist/cli.js"
"edilkamin": "dist/cjs/cli.js"
},
"dependencies": {
"aws-amplify": "^6.10.0",
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist/esm",
"module": "es6"
}
}
7 changes: 7 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist/esm",
"module": "es6"
}
}
15 changes: 8 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"declaration": true,
"outDir": "./dist",
"target": "es6",
"target": "es6",
"moduleResolution": "node",
"outDir": "dist",
"rootDir": "src",
"strict": true,
"declaration": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true
},
"include": [
"src/**/*.ts"
]
"include": ["src/**/*.ts"]
}

0 comments on commit 54f0640

Please sign in to comment.