Skip to content

Commit 74bb935

Browse files
committed
Make rebuilds of core less churny
1 parent eefdfd3 commit 74bb935

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

packages/core/build.sh

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,42 @@ ensure_bash_4
77
shopt -s globstar
88

99
## Delete the dist folder
10-
rm -rf dist
10+
# rm -rf dist
1111

1212
echo -e "\033[0;36m🏗️ Building Glide Data Grid 🏗️\033[0m"
1313

14+
compile() {
15+
tsc -p tsconfig.$1.json --outdir ./dist/$1-tmp --declarationDir ./dist/dts-tmp
16+
linaria -r dist/$1-tmp/ -m esnext -o dist/$1-tmp/ dist/$1-tmp/**/*.js -t -i dist/$1-tmp -c ../../config/linaria.json > /dev/null
17+
remove_all_css_imports dist/$1-tmp
18+
19+
# replace dist/$1 (if it exists) with dist/$1-tmp
20+
if [ -d "dist/$1" ]; then
21+
mv dist/$1 dist/$1-remove
22+
rm -rf dist/$1-remove &
23+
fi
24+
mv dist/$1-tmp dist/$1
25+
26+
27+
28+
# if it's esm, move the dts folder
29+
if [ "$2" = true ]; then
30+
if [ -d "dist/dts" ]; then
31+
mv dist/dts dist/dts-remove
32+
rm -rf dist/dts-remove &
33+
fi
34+
mv dist/dts-tmp dist/dts
35+
fi
36+
37+
rm dist/tsconfig.$1.tsbuildinfo
38+
}
39+
1440
compile_esm() {
15-
tsc -p tsconfig.esm.json
16-
linaria -r dist/esm/ -m esnext -o dist/esm/ dist/esm/**/*.js -t -i dist/esm -c ../../config/linaria.json > /dev/null
17-
remove_all_css_imports dist/esm
41+
compile esm true
1842
}
1943

2044
compile_cjs() {
21-
tsc -p tsconfig.cjs.json
22-
linaria -r dist/cjs/ -m commonjs -o dist/cjs/ dist/cjs/**/*.js -t -i dist/cjs -c ../../config/linaria.json > /dev/null
23-
remove_all_css_imports dist/cjs
45+
compile cjs false
2446
}
2547

2648
run_in_parallel compile_esm compile_cjs

0 commit comments

Comments
 (0)