Skip to content

Commit

Permalink
fix(*): correct packages type for commonjs build
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-cristino committed Aug 30, 2023
1 parent 4fb37b1 commit eafb786
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@
!/pkg/*/pnpm-lock.yaml
!/pkg/*/tsconfig.json
!/pkg/*/.npmignore

# build script
!/fixup.sh
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
!/build/cjs/src/**/*.js
!/build/cjs/src/**/*.js.map
!/build/cjs/src/**/*.d.ts
!/build/cjs/package.json
9 changes: 9 additions & 0 deletions fixup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/env bash

for f in pkg/*; do
cat <<EOF > ${f}/build/cjs/package.json
{
"type": "commonjs"
}
EOF
done
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"clean": "rm -rf .coverage && pnpm -F @slangroom/* exec -- rm -rf build",
"build": "pnpm build:esm",
"build:dual": "pnpm build:esm && pnpm build:cjs",
"build:cjs": "pnpm -F @slangroom/* exec tsc --outDir build/cjs --module commonjs",
"build:cjs": "pnpm -F @slangroom/* exec tsc --outDir build/cjs --module commonjs && ./fixup.sh",
"build:esm": "pnpm -F @slangroom/* exec tsc --outdir build/esm --module node16",
"build-all": "pnpm build"
},
Expand Down

0 comments on commit eafb786

Please sign in to comment.