Skip to content

Commit

Permalink
Add CJS build
Browse files Browse the repository at this point in the history
  • Loading branch information
mrix committed Sep 25, 2024
1 parent 1dbcb64 commit 70d56a1
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/core/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
lib/
es6/

.eslintrc.js
package.json
1 change: 1 addition & 0 deletions packages/core/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/
/lib/
/es6/
11 changes: 8 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
"version": "0.2.0",
"license": "MIT",
"files": [
"lib/*"
"lib/*",
"es6/*"
],
"main": "lib/index.js",
"module": "es6/index.js",
"types": "lib/index.d.ts",
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"scripts": {
"clean": "rimraf lib/",
"clean": "rimraf lib/ es6/",
"watch": "tsc --project ./tsconfig.json --watch --pretty",
"build": "tsc --project ./tsconfig.json --noEmitOnError --pretty",
"build": "run-s --silent build:es6 build:cjs",
"build:es6": "tsc --project ./tsconfig.json --noEmitOnError --pretty",
"build:cjs": "tsc --project ./tsconfig.cjs.json --noEmitOnError --pretty",
"check": "tsc --project ./tsconfig.json --noEmit --pretty",
"test": "cross-env TZ=UTC TS_NODE_TRANSPILE_ONLY=true TS_NODE_FILES=true jest --runInBand --colors",
"lint": "eslint src/"
Expand All @@ -27,6 +31,7 @@
},
"devDependencies": {
"@types/shallow-clone": "^3.0.0",
"npm-run-all": "^4.1.5",
"typescript": "^5.1.6"
}
}
7 changes: 7 additions & 0 deletions packages/core/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "lib"
}
}
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"sourceMap": true,
"inlineSources": true,
"declaration": true,
"outDir": "./lib"
"outDir": "./es6"
},
"include": [
"src/**/*.ts"
Expand Down
1 change: 1 addition & 0 deletions packages/react/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
lib/
es6/

.eslintrc.js
package.json
1 change: 1 addition & 0 deletions packages/react/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/
/lib/
/es6/
11 changes: 8 additions & 3 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
"version": "0.2.0",
"license": "MIT",
"files": [
"lib/*"
"lib/*",
"es6/*"
],
"main": "lib/index.js",
"module": "es6/index.js",
"types": "lib/index.d.ts",
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"scripts": {
"clean": "rimraf lib/",
"clean": "rimraf lib/ es6/",
"watch": "tsc --project ./tsconfig.json --watch --pretty",
"build": "tsc --project ./tsconfig.json --noEmitOnError --pretty",
"build": "run-s --silent build:es6 build:cjs",
"build:es6": "tsc --project ./tsconfig.json --noEmitOnError --pretty",
"build:cjs": "tsc --project ./tsconfig.cjs.json --noEmitOnError --pretty",
"check": "tsc --project ./tsconfig.json --noEmit --pretty",
"lint": "eslint src/"
},
Expand All @@ -24,6 +28,7 @@
},
"devDependencies": {
"@types/react": "^18.2.33",
"npm-run-all": "^4.1.5",
"typescript": "^5.1.6"
}
}
7 changes: 7 additions & 0 deletions packages/react/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "lib"
}
}
2 changes: 1 addition & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"sourceMap": true,
"inlineSources": true,
"declaration": true,
"outDir": "./lib"
"outDir": "./es6"
},
"include": [
"src/**/*.ts"
Expand Down

0 comments on commit 70d56a1

Please sign in to comment.