Skip to content

Commit dd78fa6

Browse files
committed
chore(esm): build both esm + cjs
1 parent 07d71a9 commit dd78fa6

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

barrels.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2-
"directory": "./dist/types/",
2+
"directory": "./dist/",
3+
"name": "index.dto.d",
34
"noHeader": true
45
}

package.json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
"name": "node-csfd-api",
33
"version": "2.14.0",
44
"description": "ČSFD API in JavaScript. Amazing NPM library for scrapping csfd.cz :)",
5-
"main": "index.js",
65
"author": "BART! <bart@bartweb.cz>",
76
"scripts": {
87
"start": "tsc -w",
98
"prebuild": "rimraf dist",
10-
"build": "tsc && tsc -p tsconfig-cjs.json && yarn barrels",
9+
"build": "tsc && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && yarn barrels",
1110
"barrels": "barrelsby --delete -c barrels.json",
1211
"postbuild": "npm-prepare-dist -s postinstall -s prepare && yarn fix-paths",
1312
"tsc": "tsc",
1413
"demo": "tsx demo",
1514
"lint": "eslint ./src/**/**/* --fix",
1615
"test": "vitest",
1716
"test:coverage": "yarn test run --coverage",
18-
"fix-paths": "yarn json -I -f ./dist/package.json -e \"this.module='./esm/index.js';this.main='./cjs/index.js';this.types='./types/index.d.ts'\"",
17+
"fix-paths": "yarn json -I -f ./dist/package.json -e \"this.module='./esm/index.js';this.main='./cjs/index.js';this.types='./index.dto.d.ts'\"",
1918
"publish:next": "yarn && yarn build && yarn test:coverage && cd dist && npm publish --tag next",
2019
"postversion": "git push && git push --follow-tags",
2120
"release:beta": "npm version preminor --preid=beta -m \"chore(update): prelease %s β\"",
@@ -88,5 +87,20 @@
8887
"license": "MIT",
8988
"lint-staged": {
9089
"*.ts": "eslint --cache --fix"
90+
},
91+
"main": "./cjs/index.js",
92+
"module": "./esm/index.js",
93+
"types": "./index.dto.d.ts",
94+
"exports": {
95+
".": {
96+
"import": {
97+
"types": "./index.dto.d.ts",
98+
"default": "./esm/index.js"
99+
},
100+
"require": {
101+
"types": "./index.dto.d.ts",
102+
"default": "./cjs/index.js"
103+
}
104+
}
91105
}
92-
}
106+
}
File renamed without changes.

tsconfig.esm.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"compilerOptions": {
44
"module": "ESNext",
55
"moduleResolution": "node",
6-
"outDir": "./dist/esm",
7-
"declaration": false
8-
// "declarationDir": "./dist/esm/types"
6+
"outDir": "./dist/esm"
97
}
108
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"esModuleInterop": true,
88
"module": "esnext",
99
"moduleResolution": "Node",
10-
"strictNullChecks": false,
10+
"strictNullChecks": false, // will be more strict in future releases
1111
"allowSyntheticDefaultImports": true,
1212
"forceConsistentCasingInFileNames": true,
1313
"sourceMap": false,

0 commit comments

Comments
 (0)