From d5f71b0184cc97abfcb5b78a9416843e9b859f13 Mon Sep 17 00:00:00 2001 From: happytomatoe <2893931+happytomatoe@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:25:43 +0200 Subject: [PATCH 1/4] Add watch script --- build-watch.js | 29 +++++++++++++++++++++++++++++ package.json | 3 +++ 2 files changed, 32 insertions(+) create mode 100644 build-watch.js diff --git a/build-watch.js b/build-watch.js new file mode 100644 index 000000000..85ba26a44 --- /dev/null +++ b/build-watch.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const concurrently = require('concurrently'); + +const info = fs.readFileSync('package.json', 'utf8') +const workspaces = JSON.parse(info)['workspaces']; +var index = workspaces.indexOf("web"); +if (index == -1) { + throw new Error("Couldn't find web subproject in package.json"); +} +workspaces.splice(index, 1); +const commands = workspaces.map(workspace => `npm run build -w ${workspace} -- -w`); +const { result } = concurrently( + commands, + { + prefix: 'name', + killOthers: ['failure', 'success'], + restartTries: 3, + }, +); + +function success(results) { + console.log('All subprojects built successfully'); +} + +function failure(error) { + console.error('Error building subprojects:', error); +} +result.then(success, failure); + diff --git a/package.json b/package.json index f263685b6..193c19f42 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "prebuild": "npm run check", "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", + "watch": "node build-watch.js", + "test:ci": "cross-env CI=true npm test -w simulator && cross-env CI=true npm test -w components && cross-env CI=true npm test -w web", "pretest": "npm run build", "test": "npm run test:ci", @@ -51,6 +53,7 @@ "npm": ">=7" }, "devDependencies": { + "concurrently": "^9.0.1", "cross-env": "^7.0.3", "shx": "^0.3.4" } From af29b5e806b0fbe928d6ca040b8263b1067875cf Mon Sep 17 00:00:00 2001 From: happytomatoe <2893931+happytomatoe@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:18:36 +0200 Subject: [PATCH 2/4] WIP --- build-watch.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build-watch.js b/build-watch.js index 85ba26a44..3d14cb990 100644 --- a/build-watch.js +++ b/build-watch.js @@ -3,11 +3,15 @@ const concurrently = require('concurrently'); const info = fs.readFileSync('package.json', 'utf8') const workspaces = JSON.parse(info)['workspaces']; -var index = workspaces.indexOf("web"); -if (index == -1) { - throw new Error("Couldn't find web subproject in package.json"); +// building extensions fails with watch flag +const workspacesToRemove = ["web", "extension"]; +for (const workspace of workspacesToRemove) { + var index = workspaces.indexOf(workspace); + if (index == -1) { + throw new Error(`Couldn't find ${workspace} subproject in package.json`); + } + workspaces.splice(index, 1); } -workspaces.splice(index, 1); const commands = workspaces.map(workspace => `npm run build -w ${workspace} -- -w`); const { result } = concurrently( commands, From 8929c20da7b3db805159dd2e0ed2e7aff232d3f0 Mon Sep 17 00:00:00 2001 From: happytomatoe <2893931+happytomatoe@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:22:25 +0200 Subject: [PATCH 3/4] WIP --- build-watch.js | 29 ----------------------------- package.json | 5 ++--- 2 files changed, 2 insertions(+), 32 deletions(-) delete mode 100644 build-watch.js diff --git a/build-watch.js b/build-watch.js deleted file mode 100644 index 85ba26a44..000000000 --- a/build-watch.js +++ /dev/null @@ -1,29 +0,0 @@ -const fs = require('fs'); -const concurrently = require('concurrently'); - -const info = fs.readFileSync('package.json', 'utf8') -const workspaces = JSON.parse(info)['workspaces']; -var index = workspaces.indexOf("web"); -if (index == -1) { - throw new Error("Couldn't find web subproject in package.json"); -} -workspaces.splice(index, 1); -const commands = workspaces.map(workspace => `npm run build -w ${workspace} -- -w`); -const { result } = concurrently( - commands, - { - prefix: 'name', - killOthers: ['failure', 'success'], - restartTries: 3, - }, -); - -function success(results) { - console.log('All subprojects built successfully'); -} - -function failure(error) { - console.error('Error building subprojects:', error); -} -result.then(success, failure); - diff --git a/package.json b/package.json index 193c19f42..17ab13637 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,7 @@ "prebuild": "npm run check", "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", - "watch": "node build-watch.js", - + "watch": "concurrently -k --restart-tries 3 \"npm run build -w components -- -w \" \"npm run build -w projects -- -w\" \"npm run build -w runner -- -w\" \"npm run build -w simulator -- -w\" ", "test:ci": "cross-env CI=true npm test -w simulator && cross-env CI=true npm test -w components && cross-env CI=true npm test -w web", "pretest": "npm run build", "test": "npm run test:ci", @@ -57,4 +56,4 @@ "cross-env": "^7.0.3", "shx": "^0.3.4" } -} +} \ No newline at end of file From 6a5d792d5e2b1dfb4e57818f6242fe24da7a1b8e Mon Sep 17 00:00:00 2001 From: happytomatoe <2893931+happytomatoe@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:08:14 +0200 Subject: [PATCH 4/4] WIP --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 17ab13637..ec15db6e1 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "prebuild": "npm run check", "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", - "watch": "concurrently -k --restart-tries 3 \"npm run build -w components -- -w \" \"npm run build -w projects -- -w\" \"npm run build -w runner -- -w\" \"npm run build -w simulator -- -w\" ", + "watch": "concurrently -k --restart-tries 3 \"npm run build -w components -- -w\" \"npm run build -w projects -- -w\" \"npm run build -w runner -- -w\" \"npm run build -w simulator -- -w\"", "test:ci": "cross-env CI=true npm test -w simulator && cross-env CI=true npm test -w components && cross-env CI=true npm test -w web", "pretest": "npm run build", "test": "npm run test:ci", @@ -56,4 +56,4 @@ "cross-env": "^7.0.3", "shx": "^0.3.4" } -} \ No newline at end of file +}