File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed
builds/prepare_builds/templates Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,12 @@ cargo clean
66RUSTFLAGS=' {{ additional_rust_flags }}' {% else -%}
77{%- endif -%} npx wasm-pack build
88
9- sed -i ' s#dimforge_rapier#@dimforge/rapier#g' pkg/package.json
10- sed -i ' s/"rapier_wasm{{ dimension }}d_bg.wasm"/"*"/g' pkg/package.json
9+ sed -i.bak ' s#dimforge_rapier#@dimforge/rapier#g' pkg/package.json
10+ sed -i.bak ' s/"rapier_wasm{{ dimension }}d_bg.wasm"/"*"/g' pkg/package.json
1111(
1212 cd pkg
1313 npm pkg delete sideEffects
1414 npm pkg set ' sideEffects[0]' =" ./*.js"
1515)
16+ rm pkg/* .bak
1617rm pkg/.gitignore
Original file line number Diff line number Diff line change @@ -6,9 +6,10 @@ rm -f ./pkg/raw.ts
66echo ' export * from "./rapier_wasm{{ dimension }}d"' > pkg/src/raw.ts
77# See https://serverfault.com/a/137848
88{% for condition_to_remove in conditions_to_remove %}
9- find pkg/ -type f -print0 | LC_ALL=C xargs -0 sed -i ' \:#if {{condition_to_remove}}:,\:#endif:d'
9+ find pkg/ -type f -print0 | LC_ALL=C xargs -0 sed -i.bak ' \:#if {{condition_to_remove}}:,\:#endif:d'
1010{% endfor %}
1111npx tsc
1212# NOTE: we keep the typescripts files into the NPM package for source mapping: see #3
13- sed -i ' s/"module": "rapier_wasm{{ dimension }}d.js"/"module": "rapier.js"/g' pkg/package.json
14- sed -i ' s/"types": "rapier_wasm{{ dimension }}d.d.ts"/"types": "rapier.d.ts"/g' pkg/package.json
13+ sed -i.bak ' s/"module": "rapier_wasm{{ dimension }}d.js"/"module": "rapier.js"/g' pkg/package.json
14+ sed -i.bak ' s/"types": "rapier_wasm{{ dimension }}d.d.ts"/"types": "rapier.d.ts"/g' pkg/package.json
15+ find pkg/ -type f -name ' *.bak' | xargs rm
Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ cp -r ./src${DIM}/* $GENOUT
3636
3737for condition_to_remove in " ${conditions_to_remove} " ; do
3838 # See https://serverfault.com/a/137848
39- echo " find ${GENOUT} -type f -print0 | LC_ALL=C xargs -0 sed -i \"\\ :#if ${condition_to_remove} :,\\ :#endif:d\" "
40- find ${GENOUT} -type f -print0 | LC_ALL=C xargs -0 sed -i " \\ :#if ${condition_to_remove} :,\\ :#endif:d"
39+ echo " find ${GENOUT} -type f -print0 | LC_ALL=C xargs -0 sed -i.bak \"\\ :#if ${condition_to_remove} :,\\ :#endif:d\" "
40+ find ${GENOUT} -type f -print0 | LC_ALL=C xargs -0 sed -i.bak " \\ :#if ${condition_to_remove} :,\\ :#endif:d"
4141done
4242
4343rm -rf ./builds/${js_package_name} /pkg/
@@ -53,4 +53,7 @@ cp ./tsconfig.common.json ./tsconfig.json ./builds/${js_package_name}/
5353cp ./tsconfig.pkg${dimension} d.json ./builds/${js_package_name} /tsconfig.pkg.json
5454
5555# "import.meta" causes Babel to choke, but the code path is never taken so just remove it.
56- sed -i ' s/import.meta.url/"<deleted>"/g' ./builds/${js_package_name} /pkg/rapier_wasm${dimension} d.js
56+ sed -i.bak ' s/import.meta.url/"<deleted>"/g' ./builds/${js_package_name} /pkg/rapier_wasm${dimension} d.js
57+
58+ # Clean up backup files.
59+ find ./builds/${js_package_name} / -type f -name ' *.bak' | xargs rm
You can’t perform that action at this time.
0 commit comments