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

Make build script windows friendly #427

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"scripts": {
"build": "tsc",
"postbuild": "rm -rf build/public && cp -r src/public/ build/public/",
"postbuild": "shx rm -rf build/public && shx cp -r src/public/ build/public/",
"test": "react-scripts test"
},
"jest": {
Expand Down
5 changes: 4 additions & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"homepage": "https://davidsouther.github.io/nand2tetris",
"scripts": {
"prebuild": "mkdir -p out/views/hdl ; cd .. ; npm run build -w extension/views/hdl",
"prebuild": "shx mkdir -p out/views/hdl && cd .. && npm run build -w extension/views/hdl",
"build": "npx esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node --sourcemap",
"watch": "npm run build -- --watch",
"vscode:prepublish": "npm run build",
Expand Down Expand Up @@ -255,5 +255,8 @@
"dependencies": {
"gh-pages": "6.1.1",
"react-scripts": "5.0.1"
},
"optionalDependencies": {
"esbuild-windows-64": "^0.15.18"
}
}
2 changes: 1 addition & 1 deletion extension/views/hdl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"scripts": {
"start": "react-scripts start",
"build": "node ./scripts/build-react-no-split.js",
"postbuild": "cp ./build/styles.css ./build/static/js/main.js ./build/static/js/main.js.map ./build/static/js/main.js.LICENSE.txt ../../out/views/hdl",
"postbuild": "shx cp ./build/styles.css ./build/static/js/main.js ./build/static/js/main.js.map ./build/static/js/main.js.LICENSE.txt ../../out/views/hdl",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
111 changes: 111 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
"scripts": {
"precli": "npm run build -w cli",
"cli": "node cli",
"ci": "CI=true npm run check && CI=true npm run test",
"ci": "cross-env CI=true npm run check && cross-env CI=true npm run test",
"precheck": "npm -w web run extract && npm -w web run lingui",
"check": "npm run check:format && npm run check:types && npm run check:lint",
"clean": "rm -rf **/node_modules **/tsconfig.tsbuildinfo **/build",
"clean": "shx rm -rf **/node_modules **/tsconfig.tsbuildinfo **/build",
"format": "prettier --write cli/src components/src extension/src projects/src runner/src simulator/src web/src web/public",
"fix": "eslint --fix cli/src components/src extension/src projects/src runner/src simulator/src web/src web/public",
"check:format": "prettier --ignore-unknown --check cli/src components/src extension/src projects/src runner/src simulator/src web/src web/public",
"check:lint": "eslint --no-error-on-unmatched-pattern cli/src components/src extension/src projects/src runner/src simulator/src web/src web/public",
"precheck:types": "npm run build -w projects && npm run build -w runner && npm run build -w simulator && npm run build -w components",
"check:types": "tsc --build tsconfig.json",
"prebuild": "npm run check",
"build": "CI=true npm run build -w projects && CI=true npm run build -w runner && CI=true npm run build -w simulator && CI=true npm run build -w cli && CI=true npm run build -w components && CI=true npm run build -w web && CI=true npm run build -w extension",
"build:extension": "CI=true npm run build -w extension",
"build": "cross-env CI=true npm run build -w projects && cross-env CI=true npm run build -w runner && cross-env CI=true npm run build -w simulator && cross-env CI=true npm run build -w cli && cross-env CI=true npm run build -w components && cross-env CI=true npm run build -w web && cross-env CI=true npm run build -w extension",
"build:extension": "cross-env CI=true npm run build -w extension",
"pretest": "npm run build",
"test": "CI=true npm test -w simulator && CI=true npm test -w components && CI=true npm test -w web",
"test": "cross-env CI=true npm test -w simulator && cross-env CI=true npm test -w components && cross-env CI=true npm test -w web",
"web": "npm run start -w web",
"start": "npm run web",
"preinstall-cli": "npm run build -w projects && npm run build -w runner && npm run build -w simulator && npm run build -w cli",
Expand All @@ -48,5 +48,9 @@
"engines": {
"node": ">=16",
"npm": ">=7"
},
"devDependencies": {
"cross-env": "^7.0.3",
"shx": "^0.3.4"
}
}
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"analyze": "source-map-explorer 'build/static/js/*.js'",
"preanalyze": "npm run map-build",
"start": "react-scripts start",
"build": "GENERATE_SOURCEMAP=false react-scripts build",
"build": "cross-env GENERATE_SOURCEMAP=false react-scripts build",
"map-build": "react-scripts build",
"postbuild": "./scripts/predeploy.sh",
"postbuild": "node ./scripts/predeploy.js",
"preserve-pwa": "npm run build ; ln -s build web-ide",
"serve-pwa": "python3 -m http.server",
"test": "react-scripts test",
Expand Down
27 changes: 27 additions & 0 deletions web/scripts/predeploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const fs = require("fs-extra");
const path = require("path");

const scriptDir = path.dirname(__filename);
const buildDir = path.resolve(scriptDir, "..", "build");

fs.ensureDirSync(buildDir);
process.chdir(buildDir);

const folders = [
"chip",
"cpu",
"asm",
"vm",
"compiler",
"bitmap",
"guide",
"util",
"about",
];

for (const folder of folders) {
fs.ensureDirSync(folder);
fs.copyFileSync("index.html", path.join(folder, "index.html"));
}

console.log("Predeploy tasks completed.");
9 changes: 0 additions & 9 deletions web/scripts/predeploy.sh

This file was deleted.

Loading