Skip to content

Commit

Permalink
Fix for ESM support
Browse files Browse the repository at this point in the history
  • Loading branch information
alpheustangs committed Aug 13, 2024
1 parent 5a74832 commit f847d40
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 85 deletions.
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"scripts": {
"format": "biome check --write .",
"build": "npm-run-all --sequential build:id build:cli",
"build:id": "npm-run-all --parallel build:id:esm build:id:cjs build:id:types",
"build:id:esm": "cd ./packages/rowid && tsc -p tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
"build:id:cjs": "cd ./packages/rowid && tsc -p tsconfig.cjs.json && tsc-alias -p tsconfig.cjs.json",
"build:id:types": "cd ./packages/rowid && tsc -p tsconfig.types.json && tsc-alias -p tsconfig.types.json",
"build:cli": "tsup",
"build:id": "cd ./packages/rowid && tsup",
"build:cli": "cd ./packages/cli && tsup",
"test": "npm-run-all --sequential test:id test:cli",
"test:id": "cd ./tests/rowid && pnpm run test",
"test:cli": "cd ./tests/cli && pnpm run test",
Expand All @@ -18,7 +15,6 @@
"@biomejs/biome": "^1.8.3",
"@types/node": "^22.2.0",
"npm-run-all": "^4.1.5",
"tsc-alias": "^1.8.10",
"tsup": "^8.2.4",
"typescript": "^5.5.4"
}
Expand Down
4 changes: 1 addition & 3 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"rootDir": "./src",
"baseUrl": ".",
"paths": {
"#/*": ["./src/*"]
},
"outDir": "./dist"
}
},
"include": ["./src/**/*"]
}
13 changes: 13 additions & 0 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "tsup";

export default defineConfig([
{
minify: true,
platform: "node",
tsconfig: "./tsconfig.json",
entry: {
index: "./src/index.ts",
},
outDir: "./dist",
},
]);
12 changes: 6 additions & 6 deletions packages/rowid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"license": "MIT",
"author": "Alpheus Tang",
"files": ["dist"],
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts"
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"repository": {
Expand Down
3 changes: 1 addition & 2 deletions packages/rowid/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"outDir": "./dist/cjs"
"module": "CommonJS"
}
}
3 changes: 1 addition & 2 deletions packages/rowid/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES2015",
"module": "ES2015",
"outDir": "./dist/esm"
"module": "ES2015"
}
}
1 change: 0 additions & 1 deletion packages/rowid/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "./src",
"baseUrl": ".",
"paths": {
"#/*": ["./src/*"]
Expand Down
9 changes: 0 additions & 9 deletions packages/rowid/tsconfig.types.json

This file was deleted.

25 changes: 25 additions & 0 deletions packages/rowid/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defineConfig } from "tsup";

export default defineConfig([
{
minify: true,
platform: "neutral",
format: "esm",
tsconfig: "./tsconfig.esm.json",
entry: {
index: "./src/index.ts",
},
outDir: "./dist",
},
{
dts: true,
minify: true,
platform: "neutral",
format: "cjs",
tsconfig: "./tsconfig.cjs.json",
entry: {
index: "./src/index.ts",
},
outDir: "./dist",
},
]);
37 changes: 0 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"compilerOptions": {
"moduleResolution": "Node10",
"resolveJsonModule": true,
"declaration": false,
"removeComments": true,
"downlevelIteration": true,
"isolatedModules": true,
"esModuleInterop": true,
Expand Down
17 changes: 0 additions & 17 deletions tsup.config.ts

This file was deleted.

0 comments on commit f847d40

Please sign in to comment.