Skip to content

Commit

Permalink
build!: provide separate CJS and ESM builds
Browse files Browse the repository at this point in the history
  • Loading branch information
shivjm committed Apr 23, 2024
1 parent 2942736 commit a63e422
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
9 changes: 6 additions & 3 deletions packages/micromark-extension-kbd-nested/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
"url": "https://github.com/shivjm/remark-extensions.git"
},
"scripts": {
"build": "rimraf lib && tsc -p tsconfig.build.json",
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.build.cjs.json",
"build:clean": "rimraf lib && npm run build",
"lint": "eslint src/**/*.ts",
"test": "mocha tests/**/*.ts"
"test": "mocha tests/**/*.ts",
"prepublish": "npm run build"
},
"dependencies": {
"micromark-util-character": "^1.1.0",
Expand Down Expand Up @@ -53,7 +55,8 @@
},
"type": "module",
"publishConfig": {
"main": "lib/index.js",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"typings": "index.d.ts"
},
"files": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "lib/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/micromark-extension-kbd-nested/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"include": ["src"],
"exclude": ["node_modules", "tests"],
"compilerOptions": {
"outDir": "lib",
"outDir": "lib/esm",
"declaration": true,
"declarationDir": "lib"
"declarationDir": "lib/esm"
}
}
9 changes: 6 additions & 3 deletions packages/remark-kbd-nested/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"description": "remark plugin to add support for `kbd` element syntax with configurable delimiters, escaping, and arbitrary nesting",
"main": "src/index.ts",
"scripts": {
"build": "rimraf lib && tsc -p tsconfig.build.json",
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.build.cjs.json",
"build:clean": "rimraf lib && npm run build",
"lint": "eslint src/**/*.ts",
"test": "mocha tests/**/*.ts"
"test": "mocha tests/**/*.ts",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand All @@ -31,7 +33,8 @@
},
"type": "module",
"publishConfig": {
"main": "lib/index.js",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"typings": "index.d.ts"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions packages/remark-kbd-nested/tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "lib/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/remark-kbd-nested/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"include": ["src"],
"exclude": ["node_modules", "tests"],
"compilerOptions": {
"outDir": "lib",
"outDir": "lib/esm",
"declaration": true,
"declarationDir": "lib"
"declarationDir": "lib/esm"
}
}

0 comments on commit a63e422

Please sign in to comment.