Skip to content

Commit

Permalink
polish esm/cjs dist with sourcemap
Browse files Browse the repository at this point in the history
  • Loading branch information
bguerout committed Jan 5, 2025
1 parent 51f3828 commit f0572d9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node_modules/
.nyc_output/
.DS_Store
.coverage/
.idea/
.nyc_output/
build/
dist/
.DS_Store
node_modules/
15 changes: 12 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
.nyc_output/
.DS_Store
.coverage/
.tools/
.idea/
.eslintrc.json
.git/
.github/
.gitignore
.idea/
.mocharc.json
.nyc_output/
.prettierignore
.prettierrc
.tools/
build/
test/
5 changes: 0 additions & 5 deletions .tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ mkdir -p "${DIST_DIR}" "${BUILD_DIR}"

cd "${PROJECT_DIR}"

npm run lint

echo "Compiling oleoduc (esm version)..."
npm run tsc -- -p tsconfig.json
cat >"${DIST_DIR}/esm/package.json" <<!EOF
Expand All @@ -28,9 +26,6 @@ cat >"${DIST_DIR}/cjs/package.json" <<!EOF
}
!EOF

echo "Compiling oleoduc (types)..."
npm run tsc -- -p tsconfig.types.json

echo "Building oleoduc for test..."
npm run tsc -- -p tsconfig.test.json
echo "Patching package.json to be able to run tests against previous versions of nodejs..."
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@
"module": "dist/mjs/index.js",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"default": "./dist/esm/index.js"
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"default": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
}
}
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"moduleResolution": "node",
"outDir": "./dist/cjs",
"target": "es2015",
"outDir": "./dist/cjs",
"esModuleInterop": true,
}
}
8 changes: 5 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"compilerOptions": {
"module": "ESNext",
"target": "esnext",
"types": ["node", "mocha"],
"outDir": "./dist/esm",
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"allowSyntheticDefaultImports": true,
"outDir": "./dist/esm",
"declaration": true,
"declarationMap": true,
"rewriteRelativeImportExtensions": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"types": ["node", "mocha"],
},
}

0 comments on commit f0572d9

Please sign in to comment.