diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f8c4f856b..da7f706cd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,7 +97,7 @@ The following will need to be run when checking out a new commit and guarantees ```bash npm install npm run build:wasm -npm start # or npm run build:local && npm run serve for slower but more production-like build +npm start ``` ## Before submitting a PR diff --git a/Makefile b/Makefile index be67ba24e..108bd1c5b 100644 --- a/Makefile +++ b/Makefile @@ -49,14 +49,9 @@ REACT_SOURCES := $(wildcard src/*.tsx) $(wildcard src/**/*.tsx) TYPESCRIPT_SOURCES := tsconfig.* $(wildcard src/*.ts) $(wildcard src/**/*.ts) VITE_SOURCES := $(wildcard vite.*) $(wildcard vite/**/*.tsx) + .PHONY: build -build: build-web build-desktop - -.PHONY: build-web -build-web: install public/kcl_wasm_lib_bg.wasm build/index.html - -.PHONY: build-desktop -build-desktop: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js +build: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES) $(RUST_SOURCES) ifdef WINDOWS @@ -65,9 +60,6 @@ else npm run build:wasm:dev endif -build/index.html: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES) - npm run build:local - .vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES) npm run tronb:vite:dev @@ -95,11 +87,11 @@ TARGET ?= desktop run: run-$(TARGET) .PHONY: run-web -run-web: install build-web ## Start the web app +run-web: install build ## Start the web app npm run start .PHONY: run-desktop -run-desktop: install build-desktop ## Start the desktop app +run-desktop: install build ## Start the desktop app npm run tron:start ############################################################################### @@ -121,7 +113,7 @@ test-unit: install ## Run the unit tests test-e2e: test-e2e-$(TARGET) .PHONY: test-e2e-web -test-e2e-web: install build-web ## Run the web e2e tests +test-e2e-web: install build ## Run the web e2e tests @ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 ) ifdef E2E_GREP npm run chrome:test -- --headed --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES) @@ -130,7 +122,7 @@ else endif .PHONY: test-e2e-desktop -test-e2e-desktop: install build-desktop ## Run the desktop e2e tests +test-e2e-desktop: install build ## Run the desktop e2e tests ifdef E2E_GREP npm run test:playwright:electron -- --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES) else diff --git a/package.json b/package.json index 73a2810f3..238fe18c2 100644 --- a/package.json +++ b/package.json @@ -88,9 +88,11 @@ "start:prod": "vite preview --port=3000", "serve": "vite serve --port=3000", "build": "npm run install:rust && . $HOME/.cargo/env && npm run install:wasm-pack:sh && npm run build:wasm && vite build", - "build:local": "vite build", - "build:both": "vite build", - "build:both:local": "npm run build:wasm && vite build", + "build:wasm": "./scripts/build-wasm.sh", + "build:wasm:windows": "powershell -ExecutionPolicy Bypass -File ./scripts/build-wasm.ps1", + "build:wasm-dev": "npm run build:wasm:dev", + "build:wasm:dev": "./scripts/build-wasm-dev.sh", + "build:wasm:dev:windows": "powershell -ExecutionPolicy Bypass -File ./scripts/build-wasm-dev.ps1", "pretest": "npm run remove-importmeta", "test:rust": "(cd rust && just test && just lint)", "simpleserver": "npm run pretest && http-server ./public --cors -p 3000", @@ -106,11 +108,6 @@ "fetch:wasm": "./scripts/get-latest-wasm-bundle.sh", "fetch:wasm:windows": "powershell -ExecutionPolicy Bypass -File ./scripts/get-latest-wasm-bundle.ps1", "fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples", - "build:wasm": "./scripts/build-wasm.sh", - "build:wasm:windows": "powershell -ExecutionPolicy Bypass -File ./scripts/build-wasm.ps1", - "build:wasm-dev": "npm run build:wasm:dev", - "build:wasm:dev": "./scripts/build-wasm-dev.sh", - "build:wasm:dev:windows": "powershell -ExecutionPolicy Bypass -File ./scripts/build-wasm-dev.ps1", "remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"", "lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src", "lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",