Skip to content
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 .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ can exist in more than one package.

## General principles

- **Style:** Suggest `npm run format` (from the repo root) or `npm run lint:fix` for
- **Style:** Suggest `npm run format` (from the repo root) or `npm run lint-fix` for
formatting issues; do not comment on individual style nits.
- **Patterns:** Prefer established Blockly patterns and the official docs over newly
invented conventions. This covers conventions — naming, API shape, file layout — not
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/browser_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: npm run build

- name: Run Test
run: npm run test:browser
run: npm run test-browser

env:
CI: true
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
working-directory: ./packages/blockly

- name: Run Build
run: npm run build:all
run: npm run build-all

- name: Run Test
run: npm run test
Expand Down Expand Up @@ -97,4 +97,4 @@ jobs:
run: npm install

- name: Check Format
run: npm run format:check
run: npm run format-check
2 changes: 1 addition & 1 deletion .github/workflows/update-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:

- name: Update GitHub Pages
working-directory: ./packages/blockly
run: npm run updateGithubPages:staging
run: npm run updateGithubPages-staging
10 changes: 5 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ Run these from the repo root. Root scripts fan out across workspaces via Nx.
npm ci # Install. Re-run after any pull that changes package-lock.json.

npm run build # Build every package except the docs site
npm run build:all # Build everything, including the docs site
npm run build:docs # Docs site only
npm run build-all # Build everything, including the docs site
npm run build-docs # Docs site only

npm run test # Full test suite across all packages. Slow.

npm run lint # ESLint across all workspaces
npm run lint:fix
npm run lint-fix
npm run format # Prettier write, whole repo
npm run format:check
npm run format-check

npm run clean # Reset the Nx cache and clean every package
```
Expand All @@ -77,7 +77,7 @@ npx nx run-many -t build --projects=@blockly/field-slider

Two things to watch out for:

- `format` and `format:check` exist **only** at the root. Prettier is configured once
- `format` and `format-check` exist **only** at the root. Prettier is configured once
for the whole repo, so there is no per-package equivalent.
- `build`, `test`, `clean`, `lint`, and `start` exist at both levels and mean different
things. At the root they fan out through Nx; inside a package they run that package's
Expand Down
17 changes: 10 additions & 7 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,29 @@
"lint": {
"cache": true
},
"lint:fix": {
"lint-fix": {
"cache": true
},
"test": {
"dependsOn": ["^build"],
"cache": true
},
"test:browser": {
"test-browser": {
"cache": true
},
"test:mocha:node": {
"test-mocha-node": {
"cache": true
},
"test:generators": {
"test-generators": {
"cache": true
},
"test:mocha:interactive": {
"test-mocha-interactive": {
"cache": true
},
"test:compile:advanced": {
"test-compile-advanced": {
"cache": true
},
"test-mocha-typecheck": {
"cache": true
},
"swizzle": {
Expand All @@ -102,7 +105,7 @@
"write-heading-ids": {
"cache": true
},
"audit:fix": {
"audit-fix": {
"cache": true
},
"prepack": {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
"scripts": {
"test": "npx nx run-many -t test --exclude=blockly && npx nx run blockly:test",
"lint": "npm run lint --ws --if-present",
"lint:fix": "npm run lint:fix --ws --if-present",
"lint-fix": "npm run lint-fix --ws --if-present",
"build": "npx nx run-many -t build --exclude=blockly-docs",
"build:docs": "npx nx run blockly-docs:build",
"build:all": "npx nx run-many -t build",
"build-docs": "npx nx run blockly-docs:build",
"build-all": "npx nx run-many -t build",
"format": "prettier --write .",
"format:check": "prettier --check .",
"format-check": "prettier --check .",
"clean": "npx nx reset && npm run clean --ws --if-present"
},
"dependencies": {}
Expand Down
14 changes: 7 additions & 7 deletions packages/blockly/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ npm run start # Dev server, watches for changes and serves the playgrou
# at /tests/playground.html

npm run test # The full CI suite. Slow — see below.
npm run test:mocha:node # Unit tests headless under Node + jsdom. The fast inner loop.
npm run test:mocha:interactive # Unit tests in a real browser, hot reloads on change
npm run test:browser # Webdriver tests in a real browser
npm run test:generators # Code generator golden-file tests
npm run test-mocha-node # Unit tests headless under Node + jsdom. The fast inner loop.
npm run test-mocha-interactive # Unit tests in a real browser, hot reloads on change
npm run test-browser # Webdriver tests in a real browser
npm run test-generators # Code generator golden-file tests

npm run lint # ESLint check
npm run lint:fix # ESLint auto-fix
npm run lint-fix # ESLint auto-fix
```

Prettier is configured at the repo root only — run `npm run format` from there.

`npm run test` runs the entire CI suite in series: eslint, build, renamings, mocha,
generators, type definitions, and two advanced-compilation passes. Prefer
`test:mocha:node` while iterating and save the full suite for a final check.
`test-mocha-node` while iterating and save the full suite for a final check.

### Running a single test

Expand All @@ -52,7 +52,7 @@ Mocha tests use the `tdd` UI (`suite` / `test`), not BDD.
not need converting as a drive-by.

TypeScript tests run under Node's native type stripping, with type checking as a
separate `npm run test:mocha:typecheck` pass. So
separate `npm run test-mocha-typecheck` pass. So
[`tests/mocha/tsconfig.json`](tests/mocha/tsconfig.json) sets `erasableSyntaxOnly`, and
anything requiring codegen is unavailable: no `enum`, no parameter properties, no
`namespace`. `verbatimModuleSyntax` is also on, so type-only imports must be written as
Expand Down
16 changes: 8 additions & 8 deletions packages/blockly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"deployDemos:beta": "npm ci && gulp deployDemosBeta",
"messages": "gulp messages",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint-fix": "eslint . --fix",
"langfiles": "gulp langfiles",
"minify": "gulp minify",
"package": "gulp pack",
Expand All @@ -102,14 +102,14 @@
"rebuildBlockly": "npm run build && node \"scripts/prepare_advanced_playground.mjs\"",
"tsc": "gulp tsc",
"test": "gulp test",
"test:browser": "npx mocha --config tests/browser/.mocharc.js",
"test:mocha:node": "npm run test:mocha:typecheck && npx mocha --config tests/mocha/.mocharc.node.cjs \"tests/mocha/**/*_test.{js,ts}\"",
"test:mocha:typecheck": "tsc -p tests/mocha/tsconfig.json",
"test:generators": "gulp testGenerators",
"test:mocha:interactive": "npm run build && node scripts/prepare_mocha_bundle.mjs && concurrently -n tsc,tsc:tests,esbuild,python3 \"tsc --watch --preserveWatchOutput --outDir \"build/src\" --declarationDir \"build/declarations\"\" \"npm run test:mocha:typecheck -- --watch --preserveWatchOutput\" \"esbuild build/tests/bundle-entry.js --bundle --sourcemap --alias:blockly/core=./build/src/core/blockly.js --alias:blockly/blocks=./build/src/blocks/blocks.js --alias:blockly=./build/src/core/blockly.js --outfile=build/tests/mocha-bundle.js --servedir=. --serve=127.0.0.1:8080 --watch=forever --log-level=warning\" \"python3 -m webbrowser 'http://localhost:8080/tests/mocha/index.html'\"",
"test:compile:advanced": "gulp buildAdvancedCompilationTest --debug",
"test-browser": "npx mocha --config tests/browser/.mocharc.js",
"test-mocha-node": "npm run test-mocha-typecheck && npx mocha --config tests/mocha/.mocharc.node.cjs \"tests/mocha/**/*_test.{js,ts}\"",
"test-mocha-typecheck": "tsc -p tests/mocha/tsconfig.json",
"test-generators": "gulp testGenerators",
"test-mocha-interactive": "npm run build && node scripts/prepare_mocha_bundle.mjs && concurrently -n tsc,tsc:tests,esbuild,python3 \"tsc --watch --preserveWatchOutput --outDir \"build/src\" --declarationDir \"build/declarations\"\" \"npm run test-mocha-typecheck -- --watch --preserveWatchOutput\" \"esbuild build/tests/bundle-entry.js --bundle --sourcemap --alias:blockly/core=./build/src/core/blockly.js --alias:blockly/blocks=./build/src/blocks/blocks.js --alias:blockly=./build/src/core/blockly.js --outfile=build/tests/mocha-bundle.js --servedir=. --serve=127.0.0.1:8080 --watch=forever --log-level=warning\" \"python3 -m webbrowser 'http://localhost:8080/tests/mocha/index.html'\"",
"test-compile-advanced": "gulp buildAdvancedCompilationTest --debug",
"updateGithubPages": "node scripts/update_github_pages.mjs --upstream",
"updateGithubPages:staging": "node scripts/update_github_pages.mjs --use-local"
"updateGithubPages-staging": "node scripts/update_github_pages.mjs --use-local"
},
"exports": {
".": {
Expand Down
4 changes: 2 additions & 2 deletions packages/blockly/scripts/gulpfiles/test_tasks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function renamings() {
* @return {Promise} Asynchronous result.
*/
function mocha() {
return runTestCommand('mocha', 'npm run test:mocha:node');
return runTestCommand('mocha', 'npm run test-mocha-node');
}

/**
Expand Down Expand Up @@ -261,7 +261,7 @@ export async function generators() {
* @returns {Promise} Async result.
*/
function advancedCompile() {
return runTestCommand('advanced_compile', 'npm run test:compile:advanced');
return runTestCommand('advanced_compile', 'npm run test-compile-advanced');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/blockly/tests/compile/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<body>
<h1>Blockly: Advanced Compilation Test</h1>

<p>To run this test manually, run `npm run test:compile:advanced`
<p>To run this test manually, run `npm run test-compile-advanced`
from the command line, then open this file in your web browser.</p>

<p>Measure the size of main_compressed.js (295kb as of October 2017), then reload
Expand Down
2 changes: 1 addition & 1 deletion packages/blockly/tests/mocha/node-setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* expect, installs the geometry stubs JSDom lacks, exposes sinon as a global,
* loads Blockly + the standard blocks + the JavaScript generator, and installs
* the shared DOM fixtures. The same fixtures and tests run in the browser via
* `npm run test:mocha:interactive`.
* `npm run test-mocha-interactive`.
*/

import {config as chaiConfig} from 'chai';
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Repo-wide conventions are in the [root `AGENTS.md`](../../AGENTS.md).

## Commands

Run from `packages/docs/`, or from the repo root as `npm run build:docs`.
Run from `packages/docs/`, or from the repo root as `npm run build-docs`.

```bash
npm start # build the API reference, then serve the site locally
npm run build # production build
npm run serve # serve an already-built site
npm run clear # clear the Docusaurus cache
npm run lint # ESLint over docs/**/*.mdx
npm run lint:fix
npm run lint-fix
```

## Things to know
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ The build folder is now served at http://localhost:3000/

```bash
# check formatting:
npm run format:check
npm run format-check
# fix formatting:
npm run format
# check linting:
npm run lint
# fix linting:
npm run lint:fix
npm run lint-fix
```

Prettier is used for formatting JavaScript files (the `format` script).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The associated test app is located in `packages/blockly/tests/compile/`.

If you want to run this `ADVANCED_OPTIMIZATIONS` test locally, you can use:
```
npm run test:compile:advanced
npm run test-compile-advanced
```

## Use advanced compilation
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/docs/guides/contribute/core/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ to create a PR.
1. Run `npm run format` to format the code and automatically fix some lint
problems.
1. Run `npm test` to run the automated tests. This also runs `eslint`.
1. If there are lint errors, run `npm run lint:fix` to fix the problems that
1. If there are lint errors, run `npm run lint-fix` to fix the problems that
are autofixable. Address any remaining lint warnings or errors.
1. If all tests pass, you are ready to open a PR against **main** with your
changes.
2 changes: 1 addition & 1 deletion packages/docs/docs/guides/contribute/samples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ order to create a PR.
and there are no errors or warnings in the console.
1. Run `npm run build` and ensure there are no build errors.
1. If applicable, run `npm run test` to run the automated tests.
1. Run `npm run lint:fix` to fix lint errors. Address any remaining warnings or
1. Run `npm run lint-fix` to fix lint errors. Address any remaining warnings or
errors.
1. Run `npm run format` to run the autoformatter.
1. If all tests pass, you are ready to open a PR against **main** with your
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"lint": "eslint 'docs/**/*.mdx'",
"lint:fix": "eslint 'docs/**/*.mdx' --fix"
"lint-fix": "eslint 'docs/**/*.mdx' --fix"
},
"dependencies": {
"@docusaurus/core": "3.10.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/block-dynamic-connection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "A group of blocks that add connections dynamically.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/block-plus-minus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "A group of blocks that replace the built-in mutator UI with a +/- based UI.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/block-shareable-procedures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "A plugin that adds procedure blocks which are backed by explicit data models.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/block-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "A group of Blockly test blocks.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/content-highlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "A Blockly workspace plugin that adds a highlight around the content area.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/continuous-toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "eslint .",
"prepublishOnly": "npm run clean && npm run build",
"start": "blockly-scripts start",
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"predeploy": "npm run build && blockly-scripts predeploy"
},
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/cross-tab-copy-paste/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "Allows copying blocks between multiple tabs with Blockly editors.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/dev-create/bin/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ exports.createPlugin = function (pluginName, options) {
version: `0.0.0`,
description: `A Blockly ${pluginType}.`,
scripts: {
'audit:fix': 'blockly-scripts auditFix',
'audit-fix': 'blockly-scripts auditFix',
'build': 'blockly-scripts build',
'clean': 'blockly-scripts clean',
'predeploy': 'blockly-scripts predeploy',
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/dev-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "A library of common utilities for Blockly extension development.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/disable-top-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "13.1.0",
"description": "A Blockly plugin that shows the 'disable' context menu option only on non-orphan blocks.",
"scripts": {
"audit:fix": "blockly-scripts auditFix",
"audit-fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "eslint .",
Expand Down
Loading