-
Notifications
You must be signed in to change notification settings - Fork 11
/
release_npm.sh
executable file
·38 lines (33 loc) · 1.12 KB
/
release_npm.sh
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
35
36
37
38
#!/bin/bash
# This script is used for manually releasing new versions of
# https://www.npmjs.com/package/osm2streets-js and
# https://www.npmjs.com/package/osm2streets-js-node. It's necessary until
# wasm-pack can generate one package that works both in web browsers and Node:
# https://github.com/rustwasm/wasm-pack/issues/313
#
# Note it's unnecessary for osm2lanes-js (until someone needs to use it in Node). For that, just:
# 1) cd osm2lanes-js
# 2) Bump the version in Cargo.toml
# 3) rm -rf pkg; wasm-pack build --release --target web
# 4) Check things, then cd pkg; npm publish
set -e
read -p "Did you bump the version number in osm2streets-js/Cargo.toml (y/n)? " answer
case ${answer:0:1} in
y|Y )
echo Building
;;
* )
exit
;;
esac
# Build the version for web browsers
cd osm2streets-js
rm -rf pkg
wasm-pack build --release --target web
mv pkg web_pkg
# Build the version for NodeJS.
wasm-pack build --release --target nodejs
# Manually change the package name
sed -ie "s/osm2streets-js/osm2streets-js-node/" pkg/package.json
mv pkg nodejs_pkg
echo "Manually check each package, then run npm publish"