Skip to content

Commit 7b1401a

Browse files
authored
feat(htmlparser2-adapter): Add CJS build (#496)
1 parent f854f04 commit 7b1401a

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
"typescript": "^4.6.3"
2626
},
2727
"scripts": {
28-
"build": "npm run build:esm && npm run build:cjs",
28+
"build": "npm run build:esm && npm run build:cjs --workspaces --if-present",
2929
"build:esm": "tsc --build packages/* test",
30-
"build:cjs": "tsc -p packages/parse5/tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > packages/parse5/dist/cjs/package.json",
3130
"build:docs": "node --max-old-space-size=8192 node_modules/.bin/typedoc .",
3231
"prettier": "prettier '**/*.{js,ts,md,json,yml}' --loglevel warn",
3332
"format": "npm run format:es && npm run format:prettier",

packages/parse5-htmlparser2-tree-adapter/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,20 @@
1414
"htmlparser2"
1515
],
1616
"license": "MIT",
17-
"main": "dist/index.js",
17+
"main": "dist/cjs/index.js",
1818
"module": "dist/index.js",
1919
"types": "dist/index.d.ts",
20-
"exports": "./dist/index.js",
20+
"exports": {
21+
"import": "./dist/index.js",
22+
"require": "./dist/cjs/index.js"
23+
},
2124
"dependencies": {
2225
"domhandler": "^4.3.1",
2326
"parse5": "^6.0.1"
2427
},
28+
"scripts": {
29+
"build:cjs": "tsc --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json"
30+
},
2531
"repository": {
2632
"type": "git",
2733
"url": "git://github.com/inikulin/parse5.git"

packages/parse5/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@
3232
"module": "dist/index.js",
3333
"types": "dist/index.d.ts",
3434
"exports": {
35-
".": {
36-
"import": "./dist/index.js",
37-
"require": "./dist/cjs/index.js"
38-
}
35+
"import": "./dist/index.js",
36+
"require": "./dist/cjs/index.js"
37+
},
38+
"scripts": {
39+
"build:cjs": "tsc --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json"
3940
},
4041
"repository": {
4142
"type": "git",

packages/parse5/tsconfig.cjs.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)