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 targets: wasm32-unknown-unknown
- name: Install wasm-bindgen-cli - name: Install wasm-bindgen-cli
uses: jetli/wasm-bindgen-action@v0.2.0 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 - name: Install, build, and upload your site output
uses: withastro/action@v1 uses: withastro/action@v2
with: with:
# path: . # The root location of your Astro project inside the repository. (optional) # 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) # 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 # environment variables
.env .env
.env.production .env.production
*.env
# macOS-specific files # macOS-specific files
.DS_Store .DS_Store
# wasm build files
/target_rust

View File

@ -1,18 +1,31 @@
# Documentation for ShulkerScript # Documentation for ShulkerScript
This is the documentation for ShulkerScript. It is a work in progress and will be updated as the language evolves. This is the documentation for ShulkerScript. It is a work in progress and will be updated as the language evolves.
## Getting Started ## Getting Started
This documentation is created using Astro and Starlight. To get started, you need to install the dependencies and start the development server. 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 ## 🧞 Commands
All commands are run from the root of the project, from a terminal: All commands are run from the root of the project, from a terminal:
| Command | Action | | Command | Action |
| :------------------------ | :----------------------------------------------- | | :------------------------- | :----------------------------------------------- |
| `pnpm install` | Installs dependencies | | `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:4321` | | `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` | | `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 preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` | | `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", "type": "module",
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"dev": "astro dev", "dev": "pnpm build-wasm && astro dev",
"start": "astro dev", "start": "pnpm build-wasm && astro dev",
"build": "astro check && astro build", "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", "preview": "astro preview",
"astro": "astro" "astro": "astro"
}, },