Skip to content

Commit

Permalink
chore: updated build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
limcheekin committed Jul 16, 2024
1 parent 49371b4 commit 2aede07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/build-wasm-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,37 @@ jobs:
- name: Checkout own repo
uses: actions/checkout@v4

- name: "Checkout surrealdb.wasm repo (latest tag)"
- name: Checkout surrealdb.wasm repo (latest tag)
run: |
git clone https://github.com/surrealdb/surrealdb.wasm.git
cd surrealdb.wasm;export LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git checkout $LATEST_TAG
- name: "Install Node & NPM"
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Install pnpm
uses: pnpm/[email protected]


- name: "Install wasm-pack"
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
#- name: Install wasm-pack
# run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: "Install surrealdb.wasm NPM dependencies"
run: cd surrealdb.wasm;npm install
- name: Install surrealdb.wasm NPM dependencies
run: cd surrealdb.wasm;pnpm install

- name: "Build"
run: cd surrealdb.wasm;wasm-pack build --release --target web --out-name index --out-dir ../assets/wasm/surrealdb --no-default-features --features kv-indxdb,kv-mem
- name: Build
run: |
cd surrealdb.wasm
make build
cp ./dist/embedded/esm.bundled.js ../assets/wasm/surrealdb
cp ./dist/embedded/index_bg.wasm ../assets/wasm/surrealdb
- name: "Install NPM dependencies"
run: npm install
run: pnpm install

- name: "Minify and compress JavaScript files"
run: npm run package
run: pnpm run package

- name: "Compress wasm file"
run: npm run compress-wasm
run: pnpm run compress-wasm

- name: Git commit compressed surrealdb_wasm assets
run: |
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "0.0.0",
"description": "surrealdb_wasm javascript files minifier and gz packager.",
"scripts": {
"concat": "concat -o assets/wasm/surrealdb/surrealdb_wasm.js assets/wasm/surrealdb/index.js assets/wasm/surrealdb/surrealdb.js",
"concat": "concat -o assets/wasm/surrealdb/surrealdb_wasm.js assets/wasm/surrealdb/esm.bundled.js assets/wasm/surrealdb/surrealdb.js",
"minify": "terser assets/wasm/surrealdb/surrealdb_wasm.js -c drop_console -m -o assets/wasm/surrealdb/surrealdb_wasm.min.js",
"compress": "gzip -c assets/wasm/surrealdb/surrealdb_wasm.min.js > assets/wasm/surrealdb/surrealdb_wasm.min.js.gz",
"package": "npm run concat && npm run minify && npm run compress",
"dev": "npm run concat && flutter run",
"package": "pnpm run concat && npm run minify && npm run compress",
"dev": "pnpm run concat && flutter run",
"compress-wasm": "gzip -c -9 assets/wasm/surrealdb/index_bg.wasm > assets/wasm/surrealdb/surrealdb.wasm.gz"
},
"repository": {
Expand Down

0 comments on commit 2aede07

Please sign in to comment.