Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dev experience on windows #5335

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@
"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": "./get-latest-wasm-bundle.sh",
"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/manifest.json",
"install:tools:windows": "winget install Schniz.fnm jq yq",
pierremtb marked this conversation as resolved.
Show resolved Hide resolved
"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-appearance/manifest.json",
"isomorphic-copy-wasm": "(copy src/wasm-lib/pkg/wasm_lib_bg.wasm public || cp src/wasm-lib/pkg/wasm_lib_bg.wasm public)",
"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": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt",
Expand All @@ -96,6 +98,7 @@
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
"files:set-notes": "./scripts/set-files-notes.sh",
"files:flip-to-nightly": "./scripts/flip-files-to-nightly.sh",
"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",
Expand Down
20 changes: 20 additions & 0 deletions scripts/flip-files-to-nightly.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$env:VERSION=(Get-Date -Format "yy.M.d")
$env:COMMIT=$(git rev-parse --short HEAD)
$env:PRODUCT_NAME="Zoo Modeling App (Nightly)"

# package.json
yq -i '.version = env(VERSION)' -p=json -o=json package.json
yq -i '.productName = env(PRODUCT_NAME)' -p=json -o=json package.json
yq -i '.name = ""zoo-modeling-app-nightly""' -p=json -o=json package.json

# electron-builder.yml
yq -i '.publish[0].url = ""https://dl.zoo.dev/releases/modeling-app/nightly""' electron-builder.yml
yq -i '.appId = ""dev.zoo.modeling-app-nightly""' electron-builder.yml
yq -i '.nsis.include = ""./scripts/installer-nightly.nsh""' electron-builder.yml

# Release notes
echo "Nightly build $VERSION (commit $COMMIT)" > release-notes.md

# icons
cp assets/icon-nightly.png assets/icon.png
cp assets/icon-nightly.ico assets/icon.ico
13 changes: 13 additions & 0 deletions scripts/get-latest-wasm-bundle.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$REPO_OWNER = "KittyCAD"
$REPO_NAME = "modeling-app"
$WORKFLOW_NAME = "build-and-store-wasm.yml"
$ARTIFACT_NAME = "wasm-bundle"

# Fetch the latest completed workflow run ID for the specified workflow
$RUN_ID = (gh run list -w $WORKFLOW_NAME --repo $REPO_OWNER/$REPO_NAME --limit 1 --json databaseId -s completed --jq 'first | .databaseId') -join [Environment]::NewLine

$PKG_PATH="./src/wasm-lib/pkg/"
rm -r $PKG_PATH/*
gh run download $RUN_ID --repo $REPO_OWNER/$REPO_NAME --name $ARTIFACT_NAME --dir $PKG_PATH
cp $PKG_PATH/wasm_lib_bg.wasm public
echo "latest wasm copied to public folder"
File renamed without changes.
Loading