add build-wasm pnpm command

This commit is contained in:
Moritz Hölting 2024-06-24 12:06:42 +02:00
parent 9d65a97617
commit abd5218668
4 changed files with 25 additions and 13 deletions

View File

@ -26,14 +26,8 @@ jobs:
targets: wasm32-unknown-unknown
- name: Install wasm-bindgen-cli
uses: jetli/wasm-bindgen-action@v0.2.0
- name: Build wasm
run: |
cd src/wasm/webcompiler &&
cargo build --release &&
wasm-bindgen --target web --out-dir ./pkg/ --out-name webcompiler ./target/wasm32-unknown-unknown/release/webcompiler.wasm &&
cd ../../..
- name: Install, build, and upload your site output
uses: withastro/action@v1
uses: withastro/action@v2
with:
# path: . # The root location of your Astro project inside the repository. (optional)
# node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)

4
.gitignore vendored
View File

@ -16,6 +16,10 @@ pnpm-debug.log*
# environment variables
.env
.env.production
*.env
# macOS-specific files
.DS_Store
# wasm build files
/target_rust

View File

@ -1,18 +1,31 @@
# Documentation for ShulkerScript
This is the documentation for ShulkerScript. It is a work in progress and will be updated as the language evolves.
## Getting Started
This documentation is created using Astro and Starlight. To get started, you need to install the dependencies and start the development server.
## Requirements
Required tools:
- [Node.js](https://nodejs.org)
- [pnpm](https://pnpm.io)
- [Cargo](https://rustup.rs)
- with `wasm32-unknown-unknown` target installed
- [`wasm-bindgen-cli`](https://crates.io/crates/wasm-bindgen-cli)
## 🧞 Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| Command | Action |
| :------------------------- | :----------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run build-wasm` | Build your wasm modules |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm run astro -- --help` | Get help using the Astro CLI |
| `pnpm run astro -- --help` | Get help using the Astro CLI |

View File

@ -3,9 +3,10 @@
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"dev": "pnpm build-wasm && astro dev",
"start": "pnpm build-wasm && astro dev",
"build-wasm": "cargo build --manifest-path ./src/wasm/webcompiler/Cargo.toml --release --target wasm32-unknown-unknown --target-dir ./target_rust && wasm-bindgen --target web --out-dir ./src/wasm/webcompiler/pkg/ --out-name webcompiler ./target_rust/wasm32-unknown-unknown/release/webcompiler.wasm",
"build": "pnpm build-wasm && astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},