Remove wasm-pack and improve README instruction

This commit is contained in:
Pierre Jacquier
2025-02-13 10:08:30 -05:00
parent 4bbe973598
commit 28dd3e7e1a
3 changed files with 36 additions and 6 deletions

View File

@ -48,14 +48,38 @@ We recommend downloading the latest application binary from [our Releases page](
## Running a development build
First, [install Rust via `rustup`](https://www.rust-lang.org/tools/install). This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We always use the latest stable version of Rust, so you may need to run `rustup update stable`. Then, run:
Install a node version manager such as [fnm](https://github.com/Schniz/fnm).
```
# macOS/Linux
curl -fsSL https://fnm.vercel.app/install | bash
# Windows
winget install Schniz.fnm
```
Then in the repo
```
fnm install --corepack-enabled
```
Install the NPM dependencies with:
```
yarn install
```
followed by:
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We always use the latest stable version of Rust, so you may need to run `rustup update stable`. We have package scripts to run rustup, see `package.json` for reference:
```
# macOS/Linux
yarn install:rust
yarn install:wasm-pack
# Windows
yarn install:rust:windows
yarn install:wasm-pack:windows
```
Then to build the WASM layer, run:
```
yarn build:wasm
```
@ -74,7 +98,7 @@ Finally, to run the web app only, run:
yarn start
```
If you're not an KittyCAD employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
### Development environment variables

View File

@ -72,7 +72,7 @@
"start": "vite --port=3000 --host=0.0.0.0",
"start:prod": "vite preview --port=3000",
"serve": "vite serve --port=3000",
"build": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source \"$HOME/.cargo/env\" && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y && yarn build:wasm && vite build",
"build": "yarn build:wasm && vite build",
"build:local": "vite build",
"build:both": "vite build",
"build:both:local": "yarn build:wasm && vite build",
@ -84,7 +84,11 @@
"simpleserver:stop": "kill-port 3000",
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages",
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages",
"install:tools:windows": "winget install Schniz.fnm jqlang.jq MikeFarah.yq",
"install:rust": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source \"$HOME/.cargo/env\"",
"install:rust:windows": "winget install Microsoft.VisualStudio.2022.Community --silent --override \"--wait --quiet --add ProductLang En-us --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended\" && winget install Rustlang.Rustup",
"install:wasm-pack": "curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y",
"install:wasm-pack:windows": "cargo install wasm-pack",
"install:tools:windows": "winget install jqlang.jq MikeFarah.yq",
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/achalmers/kw-pattern-transform2/manifest.json",
@ -210,7 +214,6 @@
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.1",
"vitest-webgl-canvas-mock": "^1.1.0",
"wasm-pack": "^0.13.1",
"ws": "^8.17.0",
"yarn": "^1.22.22"
},

View File

@ -101,3 +101,6 @@ path = "tests/modify/main.rs"
#[patch.crates-io]
#kittycad-modeling-cmds = { path = "../../../modeling-api/modeling-cmds" }
#kittycad-modeling-session = { path = "../../../modeling-api/modeling-session" }
[package.metadata.wasm-pack.profile.release]
wasm-opt = false