-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfixup.sh
More file actions
34 lines (30 loc) · 654 Bytes
/
fixup.sh
File metadata and controls
34 lines (30 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# dialect-specific workarounds
# copy all -{mjs,cjs}.* files to their expected locations
types=(cjs mjs)
shopt -s nullglob
for dir in ./dist-tmp/*; do
t=$(basename -- $dir)
if [ -d "$dir" ]; then
for file in $dir/*-${t}.js; do
base="$(basename -- $file)"
stem=${base%-$t.js}
for stemfile in $dir/$stem.*; do
rm $stemfile
done
mv $dir/$stem-$t.js $dir/$stem.js
mv $dir/$stem-$t.d.ts $dir/$stem.d.ts
done
fi
done
cat >dist-tmp/cjs/package.json <<!EOF
{
"type": "commonjs"
}
!EOF
cat >dist-tmp/mjs/package.json <<!EOF
{
"type": "module"
}
!EOF
sync-content dist-tmp dist