Skip to content

Commit e2ed712

Browse files
authored
Branch2 (#4)
* npm ignore * change build process
1 parent 065d1aa commit e2ed712

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

package.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,20 @@
66
"repository": {
77
"url": "git+https://github.com/guyeise5/encrypted-cookie-session.git"
88
},
9-
"main": "build/index.js",
9+
"main": "build/cjs/index.js",
1010
"scripts": {
11-
"build": "tsc",
12-
"prepack": "npmignore --auto"
11+
"prepack": "npmignore --auto",
12+
"build": "npm run build:cjs && npm run build:esm && npm run build:dec",
13+
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > ./build/cjs/package.json",
14+
"build:esm": "tsc -p tsconfig.esm.json",
15+
"build:dec": "tsc -p tsconfig.dec.json",
16+
"clean": "rm -rf ./build"
17+
},
18+
"exports": {
19+
"types": "./build/types/index.d.ts",
20+
"import": "./build/esm/index.js",
21+
"require": "./build/cjs/index.js",
22+
"default": "./build/cjs/index.js"
1323
},
1424
"publishConfig": {
1525
"ignore": [
@@ -18,7 +28,7 @@
1828
"test/",
1929
".github/",
2030
".gitignore",
21-
"tsconfig.json"
31+
"tsconfig*.json"
2232
]
2333
},
2434
"keywords": [],

tsconfig.cjs.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"target": "ES5",
5+
"module": "CommonJS",
6+
"outDir": "build/cjs"
7+
}
8+
}

tsconfig.dec.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": true,
6+
"outDir": "build/types"
7+
}
8+
}

tsconfig.esm.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "build/esm",
5+
}
6+
}

0 commit comments

Comments
 (0)