Skip to content

Commit

Permalink
Test building wasm npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Jul 30, 2023
1 parent 9c5b2f6 commit 7c0bab5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 14 deletions.
52 changes: 39 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ jobs:
name: prebuilds
path: prebuilds

build-wasm:
runs-on: ubuntu-latest
container:
image: emscripten/emsdk
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
- run: yarn --frozen-lockfile
- run: make wasm
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wasm
path: build/Release/watcher.wasm

release:
runs-on: ubuntu-latest
needs:
Expand All @@ -111,17 +130,24 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Build npm packages
run: node scripts/build-npm.js
- name: Publish to npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc
for pkg in npm/*; do
echo "Publishing $pkg..."
cd $pkg;
npm publish;
cd ../..;
done
echo "Publishing @parcel/watcher..."
npm publish
node scripts/build-npm.js
node scripts/build-wasm.js
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: npm
path: npm
# - name: Publish to npm
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: |
# echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc
# for pkg in npm/*; do
# echo "Publishing $pkg..."
# cd $pkg;
# npm publish;
# cd ../..;
# done
# echo "Publishing @parcel/watcher..."
# npm publish
2 changes: 1 addition & 1 deletion scripts/build-wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ js = js.replace('../wrapper.js', './wrapper.js');
fs.writeFileSync(`${dir}/npm/wasm/index.mjs`, js);

fs.copyFileSync(`${dir}/wrapper.js`, `${dir}/npm/wasm/wrapper.js`);
fs.copyFileSync(`${dir}/build/Release/watcher.wasm`, `${dir}/npm/wasm/watcher.wasm`);
fs.copyFileSync(`${dir}/wasm/watcher.wasm`, `${dir}/npm/wasm/watcher.wasm`);

let wasmPkg = { ...pkg };
wasmPkg.name = '@parcel/watcher-wasm';
Expand Down

0 comments on commit 7c0bab5

Please sign in to comment.