Skip to content

Commit ccc7d5f

Browse files
chore(scripts): skip esm build depending on conditions
1 parent 2b3a3cc commit ccc7d5f

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
npm test
2-
npm run test:esm
32
npx lint-staged

scripts/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ if [[ $1 == '--cjs' ]]; then
55
find lib -type f \( -name '*.mjs*' -or -name '*.mts*' \) -delete
66

77
elif [[ $1 == '--esm' ]]; then
8+
if [[ ! -z $(git status --porcelain src) ]]; then
9+
echo '*** Working changes detected in "src", skipping ESM build! ***'
10+
exit 0
11+
fi
12+
813
find src -type f -name '*.ts' -exec bash -c 'mv "$1" "${1%.ts}.mts"' _ {} \;
914
jscodeshift -t scripts/add-mjs-extension.ts src --extensions=mts
1015
rollup --config --failAfterWarnings --environment ESM:true

0 commit comments

Comments
 (0)