Skip to content

Commit

Permalink
Avoid dual package hazard
Browse files Browse the repository at this point in the history
  • Loading branch information
jviide committed Jul 16, 2024
1 parent abdfc9c commit e452c08
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-buttons-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@badrap/valita": patch
---

Avoid dual package hazard
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"bun": "./src/index.ts",
"node": {
"module": "./dist/node-mjs/index.mjs",
"import": "./dist/node-mjs/index.mjs",
"import": "./dist/node-cjs/index.esm.mjs",
"require": "./dist/node-cjs/index.js"
},
"default": "./dist/mjs/index.mjs"
Expand All @@ -31,10 +31,10 @@
"typecheck": "tsc --skipLibCheck --noEmit",
"test": "vitest run",
"build": "rm -rf dist/* && npm run build:cjs && npm run build:mjs && npm run build:node-mjs && npm run build:node-cjs",
"build:cjs": "tsc -p ./tsconfig.build.json --target es2015 --module commonjs --outDir ./dist/cjs",
"build:mjs": "tsc -p ./tsconfig.build.json --target es2015 --module es2015 --outDir ./dist/mjs && mv ./dist/mjs/index.js ./dist/mjs/index.mjs && mv ./dist/mjs/index.d.ts ./dist/mjs/index.d.mts",
"build:node-mjs": "tsc -p ./tsconfig.build.json --target es2021 --module es2015 --outDir ./dist/node-mjs && mv ./dist/node-mjs/index.js ./dist/node-mjs/index.mjs && mv ./dist/node-mjs/index.d.ts ./dist/node-mjs/index.d.mts",
"build:node-cjs": "tsc -p ./tsconfig.build.json --target es2021 --module commonjs --outDir ./dist/node-cjs",
"build:cjs": "tsc -p ./tsconfig.cjs.json --outDir ./dist/cjs",
"build:node-cjs": "tsc -p ./tsconfig.cjs.json --target es2021 --outDir ./dist/node-cjs",
"build:mjs": "tsc -p ./tsconfig.esm.json --outDir ./dist/mjs && mv ./dist/mjs/index.js ./dist/mjs/index.mjs && mv ./dist/mjs/index.d.ts ./dist/mjs/index.d.mts",
"build:node-mjs": "tsc -p ./tsconfig.esm.json --target es2021 --outDir ./dist/node-mjs && mv ./dist/node-mjs/index.js ./dist/node-mjs/index.mjs && mv ./dist/node-mjs/index.d.ts ./dist/node-mjs/index.d.mts",
"changeset": "changeset",
"bump": "changeset version && sed --in-place \"s/\\\"version\\\": \\\".*\\\"/\\\"version\\\": \\\"$(sed -n 's/^\\s*\\\"version\\\": \\\"\\([^\\\"/]*\\)\\\".*/\\1/p' package.json)\\\"/\" jsr.json",
"release": "npm run build && changeset publish && jsr publish"
Expand Down
1 change: 1 addition & 0 deletions src/index.esm.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./index.js";
File renamed without changes.
12 changes: 12 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES2015",
"module": "ES2015",
"moduleResolution": "Node",
"noEmit": false,
"allowImportingTsExtensions": false
},
"include": ["src/**/*"],
"exclude": ["src/index.esm.mts"]
}
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noImplicitReturns": true,
"declaration": true,
"moduleResolution": "node",
"isolatedModules": true,
"outDir": "./dist/main",
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"allowImportingTsExtensions": true
},
"include": ["mod.ts", "src/**/*.ts", "tests/**/*.ts"]
"include": ["mod.ts", "src/**/*", "tests/**/*"]
}

0 comments on commit e452c08

Please sign in to comment.