WIP: attempt at pnpm migration (working dev package build)

This commit is contained in:
Pierre Jacquier
2025-02-26 09:58:53 -05:00
parent 1f217ef50b
commit 929473a0ad
17 changed files with 11574 additions and 127 deletions

View File

@ -7,11 +7,11 @@ if [[ ! -f "test-results/.last-run.json" ]]; then
# if no last run artifact, than run plawright normally
echo "run playwright normally"
if [[ "$3" == *ubuntu* ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --shard=$1/$2 || true
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm test:playwright:electron:ubuntu -- --shard=$1/$2 || true
elif [[ "$3" == *windows* ]]; then
yarn test:playwright:electron:windows -- --shard=$1/$2 || true
pnpm test:playwright:electron:windows -- --shard=$1/$2 || true
elif [[ "$3" == *macos* ]]; then
yarn test:playwright:electron:macos -- --shard=$1/$2 || true
pnpm test:playwright:electron:macos -- --shard=$1/$2 || true
else
echo "Do not run playwright. Unable to detect os runtime."
exit 1
@ -31,11 +31,11 @@ while [[ $retry -le $max_retrys ]]; do
echo "retried=true" >>$GITHUB_OUTPUT
echo "run playwright with last failed tests and retry $retry"
if [[ "$3" == *ubuntu* ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --last-failed || true
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm test:playwright:electron:ubuntu -- --last-failed || true
elif [[ "$3" == *windows* ]]; then
yarn test:playwright:electron:windows -- --last-failed || true
pnpm test:playwright:electron:windows -- --last-failed || true
elif [[ "$3" == *macos* ]]; then
yarn test:playwright:electron:macos -- --last-failed || true
pnpm test:playwright:electron:macos -- --last-failed || true
else
echo "Do not run playwright. Unable to detect os runtime."
exit 1

View File

@ -26,7 +26,7 @@ jobs:
with:
tool: wasm-pack
- name: build wasm
run: yarn build:wasm
run: pnpm build:wasm
# Upload the WASM bundle as an artifact

View File

@ -31,7 +31,7 @@ jobs:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: pnpm install
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
@ -46,20 +46,20 @@ jobs:
tool: wasm-pack
- name: Run build:wasm
run: "yarn build:wasm"
run: "pnpm build:wasm"
- name: Set nightly version, product name, release notes, and icons
if: ${{ env.IS_NIGHTLY == 'true' }}
run: |
export VERSION=${GITHUB_REF_NAME#nightly-v}
yarn files:set-version
yarn files:flip-to-nightly
pnpm files:set-version
pnpm files:flip-to-nightly
- name: Set release version
if: ${{ env.IS_RELEASE == 'true' }}
run: |
export VERSION=${GITHUB_REF_NAME#v}
yarn files:set-version
pnpm files:set-version
- uses: actions/upload-artifact@v4
with:
@ -128,15 +128,15 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn' # Set this to npm, yarn or pnpm.
cache: 'yarn' # Set this to npm, pnpm or pnpm.
- name: yarn install
- name: pnpm install
# Windows is picky sometimes and fails on fetch. Step takes about ~30s
uses: nick-fields/retry@v3.0.1
with:
timeout_minutes: 2
max_attempts: 3
command: yarn install
command: pnpm install
- name: Prepare certificate and variables (Windows only)
if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }}
@ -168,7 +168,7 @@ jobs:
if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }}
# electron-builder doesn't have a concept of release vs debug,
# this is just not doing any codesign or release yml generation, and points to dev infra
run: yarn tronb:package:dev
run: pnpm tronb:package:dev
- name: Build the app (release)
if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }}
@ -187,7 +187,7 @@ jobs:
with:
timeout_minutes: 10
max_attempts: 3
command: yarn tronb:package:prod
command: pnpm tronb:package:prod
- name: List artifacts in out/
run: ls -R out
@ -248,7 +248,7 @@ jobs:
with:
timeout_minutes: 10
max_attempts: 3
command: yarn tronb:package:prod
command: pnpm tronb:package:prod
- uses: actions/upload-artifact@v4
if: ${{ env.IS_RELEASE == 'true' }}
@ -388,7 +388,7 @@ jobs:
export TAG="nightly-${VERSION}"
export PREVIOUS_TAG=$(git describe --tags --match="nightly-v[0-9]*" --abbrev=0)
export NOTES=$(./scripts/get-nightly-changelog.sh)
yarn files:set-notes
pnpm files:set-notes
- name: Authenticate to Google Cloud
if: ${{ env.IS_NIGHTLY == 'true' }}
@ -413,4 +413,4 @@ jobs:
- name: Invalidate bucket cache on latest*.yml and last_download.json files
if: ${{ env.IS_NIGHTLY == 'true' }}
run: yarn files:invalidate-bucket:nightly
run: pnpm files:invalidate-bucket:nightly

View File

@ -21,12 +21,12 @@ jobs:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: pnpm install
working-directory: packages/codemirror-lang-kcl
- run: yarn tsc
- run: pnpm tsc
working-directory: packages/codemirror-lang-kcl
- name: run unit tests
run: yarn test
run: pnpm test
working-directory: packages/codemirror-lang-kcl

View File

@ -70,7 +70,7 @@ jobs:
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers
shell: bash
run: yarn playwright install --with-deps
run: pnpm playwright install --with-deps
- name: Download Wasm Cache
id: download-wasm
if: needs.check-rust-changes.outputs.rust-changed == 'false'
@ -128,21 +128,21 @@ jobs:
- name: Build Wasm (because rust diff)
if: needs.check-rust-changes.outputs.rust-changed == 'true'
shell: bash
run: yarn build:wasm
run: pnpm build:wasm
- name: OR Build Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure'
shell: bash
run: yarn build:wasm
run: pnpm build:wasm
- name: build web
shell: bash
run: yarn tronb:vite:dev
run: pnpm tronb:vite:dev
- name: Run ubuntu/chrome snapshots
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
shell: bash
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
run: |
PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=1/1
PLATFORM=web pnpm playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=1/1
env:
CI: true
NODE_ENV: development

View File

@ -22,9 +22,9 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: yarn generate:machine-api
- run: yarn fmt
- run: pnpm install
- run: pnpm generate:machine-api
- run: pnpm fmt
- name: check for changes
id: git-check
run: |

View File

@ -105,7 +105,7 @@ jobs:
- name: Override release notes
env:
NOTES: ${{ github.event.release.body }}
run: yarn files:set-notes
run: pnpm files:set-notes
- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v2.1.8'
@ -126,7 +126,7 @@ jobs:
destination: 'dl.kittycad.io/releases/modeling-app'
- name: Invalidate bucket cache on latest*.yml and last_download.json files
run: yarn files:invalidate-bucket
run: pnpm files:invalidate-bucket
- name: Upload release files to Github
if: ${{ github.event_name == 'release' }}

View File

@ -24,8 +24,8 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: yarn fmt-check
- run: pnpm install
- run: pnpm fmt-check
yarn-build-wasm:
runs-on: ubuntu-22.04
@ -36,11 +36,11 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: pnpm install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm
- run: pnpm build:wasm
yarn-tsc:
runs-on: ubuntu-22.04
@ -51,7 +51,7 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: pnpm install
- uses: Swatinem/rust-cache@v2
with:
workspaces: './src/wasm-lib'
@ -59,8 +59,8 @@ jobs:
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm
- run: yarn tsc
- run: pnpm build:wasm
- run: pnpm tsc
yarn-lint:
runs-on: ubuntu-22.04
@ -71,8 +71,8 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: yarn lint
- run: pnpm install
- run: pnpm lint
python-codespell:
runs-on: ubuntu-22.04
@ -97,22 +97,22 @@ jobs:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: pnpm install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm
- run: pnpm build:wasm
- run: yarn simpleserver:bg
- run: pnpm simpleserver:bg
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
- name: Install Chromium Browser
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn playwright install chromium --with-deps
run: pnpm playwright install chromium --with-deps
- name: run unit tests for kcl samples
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn test:unit:kcl-samples
run: pnpm test:unit:kcl-samples
env:
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
@ -126,22 +126,22 @@ jobs:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: pnpm install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm
- run: pnpm build:wasm
- run: yarn simpleserver:bg
- run: pnpm simpleserver:bg
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
- name: Install Chromium Browser
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn playwright install chromium --with-deps
run: pnpm playwright install chromium --with-deps
- name: run unit tests
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
run: yarn test:unit
run: pnpm test:unit
env:
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}

View File

@ -27,7 +27,7 @@ jobs:
with:
node-version-file: '.nvmrc'
- run: yarn install
- run: pnpm install
- name: Push tag
run: |

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
yarn fmt-check
pnpm fmt-check

View File

@ -5,21 +5,21 @@ TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
dev: node_modules public/wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
yarn start
pnpm start
# I'm sorry this is so specific to my setup you may as well ignore this.
# This is so you don't have to deal with electron windows popping up constantly.
# It should work for you other Linux users.
lee-electron-test:
Xephyr -br -ac -noreset -screen 1200x500 :2 &
DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn tron:test -g "when using the file tree"
DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm tron:test -g "when using the file tree"
killall Xephyr
$(XSTATE_TYPEGENS): $(TS_SRC)
yarn xstate typegen 'src/**/*.ts?(x)'
pnpm xstate typegen 'src/**/*.ts?(x)'
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES)
yarn build:wasm
pnpm build:wasm
node_modules: package.json yarn.lock
yarn install
pnpm install

View File

@ -60,37 +60,37 @@ fnm use
Install the NPM dependencies with:
```
yarn install
pnpm install
```
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
```
# macOS/Linux
yarn install:rust
yarn install:wasm-pack:sh
pnpm install:rust
pnpm install:wasm-pack:sh
# Windows
yarn install:rust:windows
yarn install:wasm-pack:cargo
pnpm install:rust:windows
pnpm install:wasm-pack:cargo
```
Then to build the WASM layer, run:
```
# macOS/Linux
yarn build:wasm
pnpm build:wasm
# Windows
yarn build:wasm:windows
pnpm build:wasm:windows
```
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `yarn install:tools:windows`.
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `pnpm install:tools:windows`.
```
# macOS/Linux
yarn fetch:wasm
pnpm fetch:wasm
# Windows
yarn fetch:wasm:windows
pnpm fetch:wasm:windows
```
That will build the WASM binary and put in the `public` dir (though gitignored).
@ -98,7 +98,7 @@ That will build the WASM binary and put in the `public` dir (though gitignored).
Finally, to run the web app only, run:
```
yarn start
pnpm start
```
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.
@ -118,17 +118,17 @@ Third-Party Cookies".
## Desktop
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then
To spin up the desktop app, `pnpm install` and `pnpm build:wasm` need to have been done before hand then
```
yarn tron:start
pnpm tron:start
```
This will start the application and hot-reload on changes.
Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows).
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables)
To package the app for your platform with electron-builder, run `pnpm tronb:package:dev` (or `pnpm tronb:package:prod` to point to the .env.production variables)
## Checking out commits / Bisecting
@ -136,9 +136,9 @@ Which commands from setup are one off vs need to be run every time?
The following will need to be run when checking out a new commit and guarantees the build is not stale:
```bash
yarn install
yarn build:wasm
yarn start # or yarn build:local && yarn serve for slower but more production-like build
pnpm install
pnpm build:wasm
pnpm start # or pnpm build:local && pnpm serve for slower but more production-like build
```
## Before submitting a PR
@ -148,10 +148,10 @@ Before you submit a contribution PR to this repo, please ensure that:
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
- You have separated out refactoring commits from feature commits as much as possible
- You have run all of the following commands locally:
- `yarn fmt`
- `yarn tsc`
- `yarn test`
- Here they are all together: `yarn fmt && yarn tsc && yarn test`
- `pnpm fmt`
- `pnpm tsc`
- `pnpm test`
- Here they are all together: `pnpm fmt && pnpm tsc && pnpm test`
## Release a new version
@ -260,7 +260,7 @@ docker run --network host --rm --init -it playwright/chrome:playwright-x.xx.x
and in another terminal, run:
```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm playwright test --project="Google Chrome" <test suite>
```
@ -275,7 +275,7 @@ docker run --network host --rm --init -it playwright/chrome:playwright-1.46.0
and in another terminal, run:
```bash
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ pnpm playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
```
run a specific test change the test from `test('...` to `test.only('...`
@ -287,13 +287,13 @@ run a specific test change the test from `test('...` to `test.only('...`
run headed
```
yarn playwright test --headed
pnpm playwright test --headed
```
run with step through debugger
```
PWDEBUG=1 yarn playwright test
PWDEBUG=1 pnpm playwright test
```
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
@ -304,7 +304,7 @@ Or comment out browsers in `playwright.config.ts`.
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `yarn playwright codegen -b wk --load-storage ./store localhost:3000`
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `pnpm playwright codegen -b wk --load-storage ./store localhost:3000`
<details>
<summary>
@ -348,20 +348,20 @@ If you already haven't, run the following:
```
yarn
yarn build:wasm
yarn start
pnpm build:wasm
pnpm start
```
and finally:
```
yarn test:unit
pnpm test:unit
```
For individual testing:
```
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
pnpm test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
```
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default.
@ -432,17 +432,17 @@ Part of the CI CD pipeline performs static analysis on the code. Use the followi
The following set of commands should get us closer to one and done commands to instantly retest issues.
```
yarn test-setup
pnpm test-setup
```
> Gotcha, are packages up to date and is the wasm built?
```
yarn tsc
yarn fmt-check
yarn lint
yarn test:unit:local
pnpm tsc
pnpm fmt-check
pnpm lint
pnpm test:unit:local
```
> Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests.
@ -454,10 +454,10 @@ yarn test:unit:local
These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping.
```
yarn test:playwright:electron:local
yarn test:playwright:electron:windows:local
yarn test:playwright:electron:macos:local
yarn test:playwright:electron:ubuntu:local
pnpm test:playwright:electron:local
pnpm test:playwright:electron:windows:local
pnpm test:playwright:electron:macos:local
pnpm test:playwright:electron:ubuntu:local
```
> Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally.

View File

@ -19,6 +19,7 @@
"@codemirror/search": "^6.5.6",
"@codemirror/state": "^6.4.1",
"@codemirror/theme-one-dark": "^6.1.2",
"@codemirror/view": "^6.36.3",
"@csstools/postcss-oklab-function": "^4.0.7",
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"@fortawesome/free-brands-svg-icons": "^6.5.2",
@ -27,44 +28,66 @@
"@headlessui/react": "^1.7.19",
"@headlessui/tailwindcss": "^0.2.0",
"@kittycad/lib": "2.0.17",
"@lezer/common": "^1.2.3",
"@lezer/highlight": "^1.2.1",
"@lezer/lr": "^1.4.1",
"@marijn/find-cluster-break": "^1.0.2",
"@react-hook/resize-observer": "^2.0.1",
"@remix-run/router": "^1.22.0",
"@replit/codemirror-interact": "^6.3.1",
"@tanstack/react-virtual": "^3.13.2",
"@tanstack/virtual-core": "^3.13.2",
"@ts-stack/markdown": "^1.5.0",
"@tweenjs/tween.js": "^23.1.1",
"@xstate/inspect": "^0.8.0",
"@xstate/react": "^4.1.1",
"bonjour-service": "^1.2.1",
"chokidar": "^4.0.1",
"client-only": "^0.0.1",
"codemirror": "^6.0.1",
"cookie": "^1.0.2",
"crelt": "^1.0.6",
"decamelize": "^6.0.0",
"diff": "^7.0.0",
"electron-updater": "^6.6.0",
"fuse.js": "^7.0.0",
"goober": "^2.1.16",
"html2canvas-pro": "^1.5.8",
"isomorphic-fetch": "^3.0.0",
"json-rpc-2.0": "^1.6.0",
"jszip": "^3.10.1",
"minimist": "^1.2.8",
"object-assign": "^4.1.1",
"openid-client": "^5.6.5",
"prop-types": "^15.8.1",
"re-resizable": "^6.9.11",
"react": "^18.3.1",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1",
"react-hotkeys-hook": "^4.6.1",
"react-is": "^19.0.0",
"react-json-view": "^1.21.3",
"react-modal": "^3.16.3",
"react-modal-promise": "^1.0.2",
"react-router": "^6.28.0",
"react-router-dom": "^6.28.0",
"scheduler": "^0.25.0",
"set-cookie-parser": "^2.7.1",
"sketch-helpers": "^0.0.4",
"style-mod": "^4.1.2",
"three": "^0.172.0",
"turbo-stream": "^3.1.0",
"ua-parser-js": "^1.0.37",
"use-isomorphic-layout-effect": "^1.2.0",
"use-sync-external-store": "^1.4.0",
"uuid": "^11.0.2",
"vscode-jsonrpc": "^8.2.1",
"vscode-languageserver-protocol": "^3.17.5",
"vscode-languageserver-types": "^3.17.5",
"vscode-uri": "^3.0.8",
"w3c-keyname": "^2.2.8",
"web-vitals": "^3.5.2",
"whatwg-fetch": "^3.6.20",
"xstate": "^5.19.2",
"yargs": "^17.7.2"
},
@ -77,25 +100,25 @@
"start": "vite --port=3000 --host=0.0.0.0",
"start:prod": "vite preview --port=3000",
"serve": "vite serve --port=3000",
"build": "yarn install:rust && . $HOME/.cargo/env && yarn install:wasm-pack:sh && yarn build:wasm && vite build",
"build": "pnpm install:rust && . $HOME/.cargo/env && pnpm install:wasm-pack:sh && pnpm build:wasm && vite build",
"build:local": "vite build",
"build:both": "vite build",
"build:both:local": "yarn build:wasm && vite build",
"pretest": "yarn remove-importmeta",
"build:both:local": "pnpm build:wasm && vite build",
"pretest": "pnpm remove-importmeta",
"test:rust": "(cd src/wasm-lib && cargo test --workspace && cargo clippy --workspace --all-targets)",
"simpleserver": "yarn pretest && http-server ./public --cors -p 3000",
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
"simpleserver:bg": "yarn pretest && http-server ./public --cors -p 3000 &",
"simpleserver": "pnpm pretest && http-server ./public --cors -p 3000",
"simpleserver:ci": "pnpm pretest && http-server ./public --cors -p 3000 &",
"simpleserver:bg": "pnpm pretest && http-server ./public --cors -p 3000 &",
"simpleserver:stop": "kill-port 3000",
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages",
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages",
"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/next/manifest.json",
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm:nocopy": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings",
"build:wasm": "yarn build:wasm:nocopy && cp src/wasm-lib/pkg/wasm_lib_bg.wasm public && yarn fmt",
"build:wasm:windows": "yarn install:wasm-pack:cargo && yarn build:wasm:nocopy && ./scripts/copy-wasm.ps1 && yarn fmt",
"build:wasm-dev": "pnpm wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && pnpm isomorphic-copy-wasm && pnpm fmt",
"build:wasm:nocopy": "pnpm wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings",
"build:wasm": "pnpm build:wasm:nocopy && cp src/wasm-lib/pkg/wasm_lib_bg.wasm public && pnpm fmt",
"build:wasm:windows": "pnpm install:wasm-pack:cargo && pnpm build:wasm:nocopy && ./scripts/copy-wasm.ps1 && pnpm fmt",
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\" || echo \"sed for both mac and linux\"",
"wasm-prep": "rimraf src/wasm-lib/pkg && mkdirp src/wasm-lib/pkg && rimraf src/wasm-lib/kcl/bindings",
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src",
@ -106,17 +129,17 @@
"files:flip-to-nightly:windows": "./scripts/flip-files-to-nightly.ps1",
"files:invalidate-bucket": "./scripts/invalidate-files-bucket.sh",
"files:invalidate-bucket:nightly": "./scripts/invalidate-files-bucket.sh --nightly",
"postinstall": "yarn fetch:samples && yarn xstate:typegen && ./node_modules/.bin/electron-rebuild",
"xstate:typegen": "yarn xstate typegen \"src/**/*.ts?(x)\"",
"postinstall": "pnpm fetch:samples && pnpm xstate:typegen && ./node_modules/.bin/electron-rebuild",
"xstate:typegen": "pnpm xstate typegen \"src/**/*.ts?(x)\"",
"make:dev": "make dev",
"generate:machine-api": "npx openapi-typescript ./openapi/machine-api.json -o src/lib/machine-api.d.ts",
"tron:start": "electron-forge start",
"chrome:test": "PLATFORM=web NODE_ENV=development yarn playwright test --config=playwright.config.ts --project='Google Chrome' --grep-invert='@snapshot'",
"chrome:test": "PLATFORM=web NODE_ENV=development pnpm playwright test --config=playwright.config.ts --project='Google Chrome' --grep-invert='@snapshot'",
"tronb:vite:dev": "vite build -c vite.main.config.ts -m development && vite build -c vite.preload.config.ts -m development && vite build -c vite.renderer.config.ts -m development",
"tronb:vite:prod": "vite build -c vite.main.config.ts && vite build -c vite.preload.config.ts && vite build -c vite.renderer.config.ts",
"tronb:package:dev": "yarn tronb:vite:dev && electron-builder --config electron-builder.yml",
"tronb:package:prod": "yarn tronb:vite:prod && electron-builder --config electron-builder.yml --publish always",
"test-setup": "yarn install && yarn build:wasm",
"tronb:package:dev": "pnpm tronb:vite:dev && electron-builder --config electron-builder.yml",
"tronb:package:prod": "pnpm tronb:vite:prod && electron-builder --config electron-builder.yml --publish always",
"test-setup": "pnpm install && pnpm build:wasm",
"test": "vitest --mode development",
"test:unit": "vitest run --mode development --exclude **/kclSamples.test.ts",
"test:unit:kcl-samples": "vitest run --mode development ./src/lang/kclSamples.test.ts",
@ -124,13 +147,13 @@
"test:playwright:electron:windows": "playwright test --config=playwright.electron.config.ts --grep-invert=\"@skipWin|@snapshot\" --quiet",
"test:playwright:electron:macos": "playwright test --config=playwright.electron.config.ts --grep-invert='@skipMacos|@snapshot' --quiet",
"test:playwright:electron:ubuntu": "playwright test --config=playwright.electron.config.ts --grep-invert='@skipLinux|@snapshot' --quiet",
"test:playwright:electron:local": "yarn tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@snapshot'",
"test:playwright:electron:windows:local": "yarn tronb:vite:dev && set NODE_ENV='development' && playwright test --config=playwright.electron.config.ts --grep-invert=\"@skipWin|@snapshot\"",
"test:playwright:electron:macos:local": "yarn tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipMacos|@snapshot'",
"test:playwright:electron:ubuntu:local": "yarn tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipLinux|@snapshot'",
"test:playwright:electron:ubuntu:engine:local": "yarn tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipLinux|@snapshot|@skipLocalEngine'",
"test:unit:local": "yarn simpleserver:bg && yarn test:unit; kill-port 3000",
"test:unit:kcl-samples:local": "yarn simpleserver:bg && yarn test:unit:kcl-samples; kill-port 3000"
"test:playwright:electron:local": "pnpm tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@snapshot'",
"test:playwright:electron:windows:local": "pnpm tronb:vite:dev && set NODE_ENV='development' && playwright test --config=playwright.electron.config.ts --grep-invert=\"@skipWin|@snapshot\"",
"test:playwright:electron:macos:local": "pnpm tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipMacos|@snapshot'",
"test:playwright:electron:ubuntu:local": "pnpm tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipLinux|@snapshot'",
"test:playwright:electron:ubuntu:engine:local": "pnpm tronb:vite:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipLinux|@snapshot|@skipLocalEngine'",
"test:unit:local": "pnpm simpleserver:bg && pnpm test:unit; kill-port 3000",
"test:unit:kcl-samples:local": "pnpm simpleserver:bg && pnpm test:unit:kcl-samples; kill-port 3000"
},
"prettier": {
"trailingComma": "es5",
@ -151,13 +174,14 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.25.4",
"@electron-forge/cli": "^7.6.1",
"@electron-forge/plugin-fuses": "^7.6.1",
"@electron-forge/plugin-vite": "^7.6.1",
"@electron-forge/shared-types": "^7.7.0",
"@electron/fuses": "^1.8.0",
"@electron/notarize": "^2.5.0",
"@electron/rebuild": "^3.7.1",
"@iarna/toml": "^2.2.5",
"@lezer/generator": "^1.7.2",
"@nabla/vite-plugin-eslint": "^2.0.5",
@ -165,7 +189,6 @@
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^15.0.2",
"@types/diff": "^6.0.0",
"@types/electron": "^1.6.10",
"@types/isomorphic-fetch": "^0.0.39",
"@types/minimist": "^1.2.5",
"@types/mocha": "^10.0.10",
@ -184,9 +207,10 @@
"@vitest/web-worker": "^1.5.0",
"@xstate/cli": "^0.5.17",
"autoprefixer": "^10.4.19",
"dotenv": "^16.4.7",
"electron": "^34.1.1",
"electron-builder": "^26.0.6",
"eslint": "^8.0.1",
"eslint": "^9.21.0",
"eslint-plugin-css-modules": "^2.12.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jest": "^28.10.0",
@ -218,5 +242,5 @@
"ws": "^8.17.0",
"yarn": "^1.22.22"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"packageManager": "pnpm@10.5.1+sha512.c424c076bd25c1a5b188c37bb1ca56cc1e136fbf530d98bcb3289982a08fd25527b8c9c4ec113be5e3393c39af04521dd647bcf1d0801eaf8ac6a7b14da313af"
}

View File

@ -93,7 +93,7 @@ export default defineConfig({
/* Run your local dev server before starting the tests */
webServer: {
command: 'yarn start',
command: 'pnpm start',
// url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI,
},

11423
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

0
scripts/get-latest-wasm-bundle.sh Normal file → Executable file
View File

View File

@ -438,7 +438,7 @@ const getProjectPathAtStartup = async (
// If we are in development mode, we don't want to load a project at
// startup.
// Since the args passed are always '.'
// aka Forge for yarn tron:start live dev or playwright tests, but not dev packaged apps
// aka Forge for pnpm tron:start live dev or playwright tests, but not dev packaged apps
if (MAIN_WINDOW_VITE_DEV_SERVER_URL || IS_PLAYWRIGHT) {
return null
}