chore: added nx and updated scripts to use nx - #10274
Conversation
| const json = JSON.parse(JSON.stringify(getPackageJson())); | ||
| // Remove unwanted entries. | ||
| delete json['scripts']; | ||
| delete json['nx']; |
There was a problem hiding this comment.
Probably not necessary, but I figured if we're removing scripts from the /dist copy, we should remove nx, too.
| "directory": "dist" | ||
| }, | ||
| "nx": { | ||
| "implicitDependencies": ["!@blockly/block-test"], |
There was a problem hiding this comment.
This prevents the circular dependency with block-test from preventing nx from determining build order. We don't need it for build, just test.
| "package": "gulp pack", | ||
| "prepareDemos": "gulp prepareDemos", | ||
| "start": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir \"build/src\" --declarationDir \"build/declarations\"\" \"http-server ./ -s -o /tests/playground.html -c-1\"", | ||
| "start:advanced": "npm run package && npx nx run @blockly/dev-tools:build && npm run start --workspace=@blockly/dev-tools && npx nx watch --projects=@blockly/dev-tools --includeDependencies -- nx run-many -t build -p \\$NX_PROJECT_NAME --exclude=@blockly/dev-tools", |
There was a problem hiding this comment.
We'll revisit adding this back in as a link on the regular playground later.
| }, | ||
| "scripts": { | ||
| "test": "npm run test --ws --if-present", | ||
| "test": "npx nx run-many -t test --exclude=blockly && npx nx run blockly:test", |
There was a problem hiding this comment.
If we run blockly tests in paralell with other tests, they fail to find targets. I'm guessing this has to do with the gulp tasks as it's when it's running the gulp tasks prior to launching the browser that these errors happen. For now, we can run everything else in paralell and run blockly tests by themselves. In the future we can look at how to run these all in paralell.
Default for nx is to run 3 processes in paralell. We can adjust that if we want but I figure start with the default and see how CI runners handle that.
The basics
The details
Resolves
Fixes 10233
Proposed Changes
build:advancedscript to blockly that launches the advanced playground from dev-tools while watching for changes to blockly (in the future we plan to move this back into the playground as a link the way it used to be)Reason for Changes