Commit Graph

191 Commits

Author SHA1 Message Date
Maribeth Bottorff
fa58cbaaf7 chore: update app engine version names (#7231) 2023-06-30 14:12:48 -07:00
Rachel Fenichel
e2cd1bad24 chore: remove js-green-licenses (#7201) 2023-06-27 13:36:06 -07:00
Christopher Allen
7771a6dbff fix(build): Correct typos in PR #7169 (#7197)
Three separate mistakes left only the Python and PHP chunks with
the correct code for the legacy script exports.
2023-06-22 20:35:19 +00:00
Christopher Allen
b6e084257e refactor(blocks): Migrate blocks/blocks.js to TypeScript (#7193)
* refactor(blocks): Auto-migration of blocks/blocks.js to ts

* fix(blocks): Manually migrate & fix types in blocks.ts

* fix(build): Update location of blocks/blocks.ts exports object

* fix(blocks): Remove lint

* chore(blocks): Format
2023-06-21 22:07:20 +01:00
Christopher Allen
130989763c refactor(generators): Restructure generator modules to contain side effects (#7173)
* refactor(generators): Move lang.js -> lang/lang_gernator.js

  Move the LangGenerator definitions into their respective
  subdirectories and add a _generator suffix to their filenames,
  i.e. generators/javascript.js  becomes
  generators/javascript/javascript_generator.js.

  This is to keep related code together and allow the `lang/all.js`
  entrypoints to be moved to the top level generators/ directory.

  No goog module IDs were changed, so playground and test code
  that accesses this modules by filename does not need to be modified.

* refactor(generators) Move lang/all.js -> lang.js

  - Move the entrypoints in generators/*/all.js to correspondingly-named
    files in generators/ instead—i.e., generators/javascript/all.js
    becomes generators/javascript.js.

  - Update build_tasks.js accordingly.

* fix(generators): Add missing exports for LuaGenerator, PhpGenerator

  These were inadvertently omitted from #7161 and #7162, respectively.

* refactor(generators): Make block generator modules side-effect free

  - Move declaration of <lang>Generator instance from
    generators/<lang>/<lang>_generator.js to generators/<lang>.js.
  - Move .addReservedWords() calls from generators/<lang>/*.js to
    generators/<lang>.js
  - Modify generators/<lang>/*.js to export block generator functions
    individually, rather than installing on <lang>Generator instance.
  - Modify generators/<lang>.js to import and install block generator
    functions on <lang>Generator instance.

* fix(tests): Fix tests broken by restructuring of generators

  Where these tests needed block generator functions preinstalled
  they should have been importing the Blockly.<Lang>.all module.

  Where they do not need the provided block generator functions
  they can now create their own empty <Lang>Generator instances.

* chore: Update renamings file

  - Fix a malformation in previous entries that was not detected by
    the renaming file validator test.
  - Add entries describing the work done in this and related recent
    PRs.

* fix: Correct minor errors in PR #7173

  - Fix a search-and-replace error in renamings.json5
  - Fix an incorrect-but-usable import in generator_test.js
2023-06-20 23:22:44 +01:00
Christopher Allen
4adc932ed5 fix(build): Fix GitHub pages & deployment task (#7186)
* fix(build): Include node_modules/@blockly/ in gh-pages branch

  - Add node_modules/@blockly to the list of files added to the gh-pages
    branch.
  - Add a _config.yml file telling Jekyll (which is needed to produce
    the homepage served at https://google.github.io/blockly/, and hence
    can't be disabled with a .nojekyll file instead) not to exclude
    node_modules (which it does by default).

* refactor(build): Modernise git_tasks.js

  - Various style updates:
    - Use CONSTANT_CASE.
    - Use /** JSDoc comments */
    - Use `template ${literals}`.
  - Use git switch instead of git checkout.
  - Try to avoid use of remote names; use URLs where possible.

* refactor(build): Look up upstream git remote

  Since git reset can't take a URL but needs an actual remote name,
  use git branch -v to look up the remote for
  github.com/google/blockly and then use that remote name.

* chores(build): format
2023-06-20 21:50:44 +01:00
Christopher Allen
ace9c4a188 fix(tests): Fix compressed mode loading (#7178)
Due to errors in PRs #7171 and 7173 (and the author's failure to do
enough local testing before submitting those PRs), compressed mode
loading was broken in the playgrounds.  Fix this by:

- Fix a typo in bootstrap.js ("Blocky" -> "Blockly").
- Updating the chunks definitions build_tasks.js to use the new
  variables we expect to contain generator exports objects.
2023-06-20 21:49:26 +01:00
Beka Westberg
d7ccf8a5ee fix: input exports (#7165)
* fix: input exports

* chore: fix build

* chore: attempt to fix build

* chore: attempt to fix build

* chore: create new align enum to replace old one

* chore: format

* fix: Tweak renamings entries

It appears that the goal is to map:

Blockly.Input.Align -> Blockly.inputs.Align
Blockly.Align -> Blockly.inputs.Align
Blockly.ALIGN_* -> Blockly.inputs.Align.*

I believe this commit achieves that in a more minimal (and correct)
way—but if I have misunderstood the intention then this will not
be a useful correction.

---------

Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2023-06-16 11:27:46 -07:00
Christopher Allen
817ffab754 refactor(tests): Update bootstrap.js to better support generator chunks (#7171)
Refactor bootstrap.js and bootstrap_helper.js to be able to deal
with generator chunks.  In particular for each chunk, specify:

- The goog.module ID to goog.require() in uncompressed mode.
- The script filename to load in compressed mode.
- Where the chunk's UMD wrapper will save the export object when
  loaded as a script.
- What global variable the chunk's export object should be saved in
  (if desired).
- Any individual named exports to destructure to global variables.

This allows the bootstrap scripts to be slightly simpler while
also being more flexible.
2023-06-15 21:03:04 +01:00
Christopher Allen
2d97e5aaf1 refactor(build)!: Provide all generator exports when loaded as script (#7169)
Previously, when loading a generator chunk (e.g.,
javascript_compressed.js) as a script (e.g., in a browser using
a <SCRIPT> tag), only a single named export from that chunk would
be made available (e.g, javascriptGenerator would be made availabe
as Blockly.JavaScript).

Until recently, that was fine because each generator chunk had only
a single named export, but now each one additionally has a
<Lang>Generator class and Order enum export.

To allow these new exports to be accessed by script users, the
chunk wrappers are modified to provide the whole export object
at a correspondingly-named global variable—e.g., when loaded as
a script javascript_compressed.js creates a global variable named
javascript, so the named exports can be accessed as
javascript.javascriptGenerator, javascript.JavascriptGenerator
and javascript.Order, as if the user had imported them via

    import * as javascript from 'blockly/javascript';

This PR includes a breaking change and a deprecation, both of
which are only applicable when loading generators as scripts
(e.g. via a <SCRIPT> tag):

BREAKING CHANGE: The generator chunks will, when loaded as scripts
(e.g. via a <SCRIPT> tag, now clobber any existing global variable
of the corresponding name:

- dart_compresed.js will set dart
- javascript_compresed.js will set javascript
- lua_compresed.js will set lua
- php_compresed.js will set php
- python_compresed.js will set python

DEPRECATION: Accessing the generator instances at their previous
locations (Blockly.Dart, Blockly.JavaScript, Blockly.Lua,
Blockly.PHP, and Blockly.Python) is deprecated and may cease
to work in a future version of Blockly.
2023-06-15 16:52:51 +01:00
Christopher Allen
3ae4a61842 fix(build): Fix path issue on Windows (#7127)
Fixes #6864.
2023-06-01 13:27:38 +01:00
Christopher Allen
4d2201a427 chore(generators): Migrate generators to ES Modules (#7103)
* feat(j2ts): Add support for migrating renaming imports

  Convert
      const {foo: bar} = require(/*...*/);
  into
      import {foo as bar} from /*...*/;
              ^^^^^^^^^^

  Also fix a bug that caused relative paths to ESM in the same
  directory to be missing a leading "./".

* fix(build): Fix trivial error exports for generators

  The UMD wrapper was inadvertently exporting the contents of (e.g.)
  the Blockly.JavaScript closure module rather than the intended
  export of Blockly.JavaScript.all module - which went unnoticed
  because the latter just reexported the former - but we are
  about to convert the former to ESM.

* chore(generators): Migrate language generators to ESM

  Migrate the main language generators in generators/*.js to ESM.

  This was done by running js2ts on the files, renaming them back
  to .js, and commenting out "import type" statements, which are
  legal TS but not needed in JS (at least if you are not actually
  letting Closure Compiler do type checking, which we are not.)

* chore(generators): Migrate block generators to ESM

  Migrate generators/*/*.js (except all.js) to ESM.

  This was done by running js2ts on the files, renaming them back
  to .js, and removing now-spurious @suppress {extraRequire}
  directives.

* chores(generators): Migrate generator chunk entrypoints to ESM

  This was done by running js2ts on the files, renaming them back
  to .js, and manually fixing the export statements.

  An additional change to the chunk exports configuration in
  build_tasks.js was necessary in order for the UMD wrapper to
  find the new module object, which is given a different name
  than the old exports object.
2023-05-19 23:09:37 +01:00
dependabot[bot]
0afcabe959 chore(deps): Bump @hyperjump/json-schema from 0.23.3 to 1.5.0 (#7079)
* chore(deps): Bump @hyperjump/json-schema from 0.23.3 to 1.5.0

Bumps [@hyperjump/json-schema](https://github.com/hyperjump-io/json-schema) from 0.23.3 to 1.5.0.
- [Commits](https://github.com/hyperjump-io/json-schema/compare/v0.23.3...v1.5.0)

---
updated-dependencies:
- dependency-name: "@hyperjump/json-schema"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(tests): Compatibility updates to validate-renamings.js

A minimal set of updates to validate-renamings.js to make it
compatible with @hyperjump/json-schema v1.5.  The main difference
is that that package now ships ESM rather than CJS modules,
forcing the script to use import rather than require, with
various knock-on effects (no __dirname variable, must be named
*.mjs, etc.)

* chore(tests) Remove unneeded IIFE

* chore(tests): Additional tidy-up of ESM version

Now that validate-renamings is an ES module, we can do some other
cleanup to it.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2023-05-18 18:47:04 +01:00
Rachel Fenichel
8b635ab43a chore: remove sortrequires task (#7074) 2023-05-11 11:35:45 -07:00
Maribeth Bottorff
88ff901a72 chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
2023-05-10 16:01:39 -07:00
Christopher Allen
60a2358cd7 chore(build): Delete chunks cache file chunks.json (#7011)
This file should have been deleted in PR #6222 but was somehow
overlooked.
2023-04-24 21:27:22 +01:00
dependabot[bot]
7feefa44d0 chore(deps): bump rimraf from 4.1.2 to 5.0.0 (#6986)
* chore(deps): bump rimraf from 4.1.2 to 5.0.0

Bumps [rimraf](https://github.com/isaacs/rimraf) from 4.1.2 to 5.0.0.
- [Release notes](https://github.com/isaacs/rimraf/releases)
- [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/rimraf/compare/v4.1.2...v5.0.0)

---
updated-dependencies:
- dependency-name: rimraf
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): Update imports of rimraf for compatibility with v5.0.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2023-04-21 16:02:07 +01:00
Christopher Allen
42e838621d chore(build): Temporarily exclude blocks and generators .d.ts files (#6930)
Temporarily exclude the generated .d.ts files for blocks/* and
generators/* from the package.

This will in due course replace the (very simplistic) hand-written
versions in typings/, but for now they are not referenced
anywhere a developer's tooling should be looking, and contain
in some cases actually incorrect typings (e.g., in unmigrated
blocks files, the blocks export is typed as ObjectConstructor,
which is wrong), so do not include them in the package least they
cause problems for the unwary.
2023-03-28 22:30:08 +01:00
Maribeth Bottorff
a7c342ec29 chore: force add the build files when updating gh-pages (#6904) 2023-03-17 12:36:48 -07:00
Neil Fraser
42fde0f81b chore: Reduce delta on ports to blockly-samples (#6886)
* Reduce usage of obsolete .keyCode property.
* Rename private properties/methods which violate eslint rules.
* Use arrays of bound events rather than individual properties.
* Improve typing info.
* Also fix O(n^2) recursive performance issue in theme's getComponentStyle function.
* And replace String(...) with '${...}' (smaller, faster).
* .toString() is considered harmful.
2023-03-15 13:28:57 -07:00
Tim Gates
0a1096262f docs: Fix a few typos (#6878)
There are small typos in:
- closure/goog/base.js
- demos/minimap/minimap.js
- gulpfile.js
- scripts/gulpfiles/build_tasks.js
- scripts/gulpfiles/cleanup_tasks.js
- scripts/gulpfiles/license_tasks.js

Fixes:
- Should read `prerequisites` rather than `prequisites`.
- Should read `satisfies` rather than `satisifies`.
- Should read `regenerates` rather than `regenrates`.
- Should read `minimap` rather than `mimimap`.
- Should read `diagnostic` rather than `disagnostic`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
2023-03-14 05:15:37 -07:00
Christopher Allen
f90a2531a7 feat(build): Run tsc on blocks/ and generators/ (#6836) 2023-02-15 13:10:27 -08:00
Blake Thomas Williams
13fe6eeccf feat: added tests/typescript to test supported TS examples (#6775)
* feat: added `tests/typescript` to test supported TS examples

* fix: update the test name, description, and output

* chore: remove unused imports in `test_tasks.js`

* fix: wrap README line at 80 characters

* fix: implemented `different_user_input.ts` feedback

* fix: correct mistaken comments

* chore: rename `./eslintrc.json` to `./eslintrc.js`

* feat: added linting for tests/typescript

* chore: cleanup eslintrc lines over 80 characters

* fix: updated `.eslintrc.js` to provide an override for linting itself

* fix: updated tests to build to the `build` directory

* feat: updated `gulp format` to handle formatting `.eslintrc.js`

* fix: updated `.eslintrc.js` to align with both formatter and linter

* fix: updated config comment wording

* fix: removed quotes for valid identifiers

* Revert "fix: removed quotes for valid identifiers"

  This reverts commit 03eff91aea1468e503bc79a90fb139914d3f39d2.
2023-02-10 17:12:18 +00:00
Neil Fraser
90217360c7 fix: Fire deletion events when clearing variables. (#6827)
https://groups.google.com/g/blockly/c/l_vUnrGSJ0M
2023-02-07 21:20:01 +01:00
Christopher Allen
a7f498a6a0 fix(build): Fix event tests, improve buildDeps (#6773)
* fix(tests): Fix errors in event tests
  - Fix actual syntax errors in imports in event_marker_move_test.js
    and event_selected.test.js, which were preventing those tests from
    being run.
  - Remove suite.only directives in those tests that would prevent
    all the other tests from running.

* refactor(build): Improve buildDeps

  - Run closure-make-deps only once, instead of separately for core/
    and tests/.

  - Specify a larger exec maxBuffer size, to ensure output and
    diagnostics are not truncated.

  - Change stderr filtering in buildDeps to filter out bounded
    generics messages and blank lines.

  - Attempt to suppress warnings in stderr output when
    closure-make-deps returns a non-zero exit code.

    Unfortunately, there seems to be a race condition which usually
    the stderr argument to the exec callback not to contain the
    complete output, so in that case print a helpful message.

  - Have buildDeps just return a Promise instead of using a callback.

* fix(docs): Typo fix in JSDoc for log helper
2023-01-26 20:09:19 +00:00
Maribeth Bottorff
86f3fde69c chore: add a pretty summary to CI (#6780) 2023-01-18 10:31:56 -08:00
dependabot[bot]
ee51c0f41c chore(deps): bump rimraf from 3.0.2 to 4.0.7 (#6778)
* chore(deps): bump rimraf from 3.0.2 to 4.0.7

Bumps [rimraf](https://github.com/isaacs/rimraf) from 3.0.2 to 4.0.7.
- [Release notes](https://github.com/isaacs/rimraf/releases)
- [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/rimraf/compare/v3.0.2...v4.0.7)

---
updated-dependencies:
- dependency-name: rimraf
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: fix use of rimraf

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Beka Westberg <bwestberg@google.com>
2023-01-18 13:16:40 +00:00
Aaron Dodson
e89fcea02c fix: Make metadata tests more resilient. (#6771)
* fix: Make metadata tests more resilient.

* fix: improve control flow and clarify xargs purpose.
2023-01-17 08:32:05 -08:00
Maribeth Bottorff
59c7cb941b fix: Increase generator test timeout (#6776) 2023-01-17 16:17:46 +00:00
Maribeth Bottorff
d1d60c4629 fix: CI exits properly after failure (#6763)
* fix: CI exits properly after failure

* fix: remove useless async
2023-01-12 12:52:14 -08:00
Christopher Allen
3be3d4a6ff chore: miscellaneous fixes to docs, style, and tests (#6705)
* docs(icon): Better description for Icon.prototype.setVisible

  Also tweak description of getBlock.

* docs(blocks): Fix typo in description of BlockDefinition

* chore(tests): Factor out common goog:chromeOptions

* chore(build): Minor style fixes
2022-12-14 23:48:12 +00:00
Christopher Allen
e3c04978f3 chore(build): Remove prepare script; run deps script from start script (#6653)
To make `npm install` and `npm ci` faster, and to avoid redundant
work when doing either of these followed by `npm run build` (or
any other script which does a build), delete the `prepare`
script and instead add an invocation of `npm run deps` to the
beginning of the `start` script.
2022-12-08 16:32:25 +00:00
Christopher Allen
983a8be441 fix(appengine): Restore build products to previous location (#6687)
Modify the prepareDemos script to copy the messages and compressed
files to their previous locations in the deploy directory, to
fix 404 errors on devsite that we can't immediately fix by pushing
devsite.
2022-12-07 19:43:50 +00:00
Christopher Allen
cac6cf77e9 chore: Merge master back into develop following v9.1.1 release
Merge pull request #6658 from google/master
2022-11-25 19:50:32 +00:00
Neil Fraser
5a64a9a7f7 fix: Fix the compiler test, and check if it worked. (#6638)
* Add tsick.js to rewrite enums.

tsc generates JavaScript which is incompatible with the Closure Compiler's advanced optimizations.

* Remove unused 'outputCode' variable.

* Rename 'run_X_in_browser.js' to 'webdriver.js'

The Mocha and generator tests can both be run either manually or via our webdriver.  In all cases they run in a browser.  These two 'run_X_in_browser.js' files only apply to webdriver, thus they are confusingly named.

Also delete completely unused (and broken) `run_all_tests.sh`

* Linting improvements to mocha/webdriver.js

Still not at 100%.  Complains about require/module/process/__dirname not being defined in multiple places.

* runTestBlock -> runTestFunction

'Block' means something very different in Blockly.

* Removal of `var` from scripts.

* Add webdriver test to verify compile test worked.

* Resolve conficts with 'develop'.

* Address PR comments.
2022-11-25 11:45:00 -08:00
Christopher Allen
54670d534e feat(test): Miscellaneous improvements to test_tasks.js (#6615)
* feat(tests): Make runTestBlock able to run any gulp task

  Modify runTestBlock so that it can run any async task, not just
  ones that return a Promise, by using the async-done package
  (part of Gulp, and already an indirect dependency) to detect
  task completion.

  Celebrate by renaming it to runTestTask.

* refactor(tests): Create Tester class to encapsulate test infrastructure

  - Create Tester class to encapsulate the runTestTask,
    and reportTestResult and runAll functions.

  - Remove the unnecessary id parameter from runTestTask (code was
    already using the .name of the task function object).

  - Remove --silent flag from npm scripts so as not to suppress
    syntax error in gulpfiles.

* refactor(tests): Invoke buildAdvancedCompilationTest task directly

  Have the test task invoke the buildAdvancedCompilationTest
  (via onlyBuildAdvancedCompilationTest, to skip already-run
  prerequisites) directly, rather than by running npm.
2022-11-16 18:17:54 +00:00
Christopher Allen
21077ee7b0 fix(build): Put build products in correct location for AppEngine 2022-11-11 17:42:33 +00:00
Maribeth Bottorff
010a56bfad chore: add command to generate reference docs (#6506)
* chore: add command to generate reference docs

* chore: format

* chore: add comments and fix names

* chore: format

* chore:update patch for latest api documenter version

* chore: fix package-lock
2022-11-09 10:55:49 -08:00
Christopher Allen
52a0d525d7 chore(build): Remove build products from the Blockly repository (#6475)
* feat(build): Make build tasks invoke their prerequisites

  - Divide gulp targets into three kinds: main sequence,
    manually invokable, and script-only.  The first two categories
    automatically invoke their prerequisites.
  - Give (most of) the affected gulp targets shorter and more memorable
    names that could become their npm script names in future.

* feat(build): Make package tasks invoke their prerequisites

  Have the package task invoke the cleanBuildDir (as well as
  cleanPackageDir) and build tasks.  Remove the checkBuildDir
  task as it is now redundant since a fresh build is done every
  time.

* feat(build): Make git tasks invoke their prerequisites

* feat(build): Make cleanup, license [sic] tasks invoke their prerequisites

  Turns out they don't have any, so this commit just classifies
  their gulp targets according to the established scheme.

* feat(build): Make appengine tasks invoke their prerequisites

  In this case prepareDeployDir will eventually depend on package
  but does not for now.

* feat(build): Have npm scripts run npm ci first where applicable

  Have any npm script that have external effects (e.g. publishing an
  npm package, pushing a new version to appengine, or updating GitHub
  Pages) start by running npm ci to ensure that all dependencies are
  up-to-date with respect to package-lock.json.

  (This is done by npm and not a gulp script because gulp itself
  might need updating.  So might npm, but that is less likely to
  make any difference to what gets published/pushed.)

* chore(build): have tests use package target

  Have the tests just run the package target (with debug flags)
  since that runs the the build target automatically.

* feat(tests): Write Closure Compiler output directly to dist/

  Since they are already UMD-wrapped, have Closure Compiler write
  output chunks directly to RELEASE_DIR, i.e. dist/.

* chore(tests): Use freshly-build files in compressed mode.

  Use the freshly-built build/*_compresssed.js files when bootstrapping
  in compressed mode, rather than using the checked-in files in the
  repository root.

  This helps ensure that compressed and uncompressed mode will be
  testing (as closely as possible) the same code.

  Obsoletes #6218 (though the issues discussed there have not actually
  yet been addressed in this branch).

* chore(build): Write intermediate langfiles to build/msg

  Write the results of create_messages.py to build/msg instead of
  build/msg/js.

* fix(build): Use build/msg/en.js instead of msg/messages.js in tests

  This has no direct effect but fixes a long-standing misdesign
  where we are testing against the input to, rather than the output
  of, the language file processing pipeline.

* feat(demos): Use freshly-built files

  Use the freshly-built dist/*_compresssed.js and build/msg/* files
  rather than using the checked-in files in the repository root.

  This helps ensure that these demos are using the most recent
  version of Blockly (even in the develop branch).

* fix(build): Update appengine deployment to include built files

  Modify the prepareDemos task as follows:

  - Use the git index instead of HEAD, so that most local changes
    will be applied (without copying whatever .gitignored cruft
    might be in the local directory).
  - Run clean and build and then copy build/msg and
    dist/*_compressed.js* to the deploy directory.

  This fixes the problem created by the previous commit, wherein the
  demos relied on built files that were not being deployed to
  appengine.

* fix(build): Update GitHub Pages deployment to include built files

  Modify the updateGithubPages task to run clean and build and
  then git add build/msg dist/*_compressed.js*, so that they will
  be included in the deployed pages.

  This fixes the problem created by the previous^2 commit,
  wherein the demos relied on built files that were not being
  deployed to GitHub Pages.

* chore(build): Remove build products from repository

  Remove *_compressed.js* and msg/js/* from the blockly repository.
  Also remove the now-obsolete checkinBuilt gulp task.

* chore(build): Apply relevant changes to test_tasks.js

  Apply changes made to run_all_tests.sh and check_metadata.sh to
  the corresponding parts of their JS replacements in
  test_tasks.js.

* chore(build): Make updates suggested in PR #6475

  - Remove `clean:builddir` and `clean:releasedir` - `clean`
    is sufficient.
  - Remove duplicate `require` from `appengine_tasks.js`.

* feat(build): Use shorter npm script names

  Since scripts that run build tasks now automatically run their
  prerequisite tasks, the previous naming scheme of task `build`
  running all the `build:subtask`s no longe really makes very
  much sense.

  Additionally, following a chat discussion, there seems to be a
  rough consensus to use "messages" to refer to the .json input
  files, and "langfiles" to the generated .js output files.

  Consequently, simplify npm script names by renaming as follows:

  - "generate:langfiles" -> "messages"
  - "build:langfiles" -> "langfiles"
  - "build:js" -> "tsc"
  - "build:deps" -> "deps"
  - "build:compiled" -> "minify"
  - "build:compressed": delete this synonym for "build:compiled",

  ("minify" was chosen as agnostic to Closure Compiler vs. WebPack.)

* chores(build): Add deprecation notice for old scripts

  To reduce potential confusion/frustration, restore the previous
  npm scripts but have them display a deprecation notice instead
  (note that npm prints the script contents before running it, so
  echo is not needed).

* docs(build): Add comments distinguishing 'messages' from 'langfiles'
2022-11-03 13:15:10 +00:00
Rachel Fenichel
e1244e5569 fix: generator tests on linux (#6588) 2022-10-28 15:30:37 -07:00
Neil Fraser
e90aba9273 fix: Rename Generator to CodeGenerator (#6585)
Stops collisions with ES6's Generator.
The old Blockly.Generator still exists as a name, but is now deprecated.
2022-10-28 01:59:00 +02:00
YAMADA Yutaka
52879dd953 fix(build): build/test on windows (#6431)
* build: build/test on windows

* chore(deps): bump @hyperjump/json-schema from 0.18.4 to 0.18.5
* chore(deps): add gulp-gzip 1.4.2
* build: migrate test scripts to gulp task (test_tasks.js)
* build: not to use the grep command
* build: normalize path

* fix: Modified based on review suggestions.
* Add JSDoc comment
* Line length <= 80 characters.
* Formatting test output as previously.
* Always continue even if a test unit fails.
* Suppress the gulp messages.
* Fix test_tasks.js to pass eslint.

* fix: Modified based on review suggestions.
* Change generator test output directory.
* Formatting test output as previously.

* fix: Formatting test output as previously.

* fix: Modified based on review suggestions.
2022-10-27 21:02:50 +01:00
Beka Westberg
9c81e7591a fix: message types being incorrect (#6414)
* chore: regen msg dts files

* fix: package tasks not packaging msg.d.ts files

* fix: add setLocale to blockly.ts

* chore: format

* chore: move setLocale

* chore: add comment about setLocale not being useful when used with script tags

* chore: format
2022-09-26 14:02:57 -07:00
Beka Westberg
517a72a16f chore: fix release tasks checking for bad directories (#6404) 2022-09-01 14:00:59 -07:00
Christopher Allen
bcd62f170b chore(build): use inline sources in sourcemaps; don't package sources separately (#6362)
* chore(build): Add inline sources to sourcemaps

* chore(build): Don't package sources

Since the sources are now inline in the sourcemaps, they no longer
need to be package separately.
2022-08-22 19:12:55 -04:00
Christopher Allen
079699baff fix(build): Have prepare task signal async completion (#6356)
PR #6244 made a change to have the npm run prepare script
(automatically invoked by npm install after package installation)
not bother running the buildJavaScriptAndDeps gulp task when run
from a GitHub action (since our build action will do npm test
straight afterwards, which runs this task already).

Unfortunately, due my misunderstanding of how gulp tasks work
the revised version generated a "Did you forget to signal async
completion?" error from gulp.

Fix this by adding a done parameter and passing the provided
callback to buildJavaScriptAndDeps.  This also allows a
simplification of the the don't-run case by simply calling
done and then returning.
2022-08-22 17:27:26 -04:00
Christopher Allen
883d78d5a0 chore(build): Only suppress expected warnings from closure-make-deps (#6350) 2022-08-18 15:27:09 +01:00
Christopher Allen
e10bf99936 fix(build): Fix sourcemaps (#6352)
Get sourcemaps working again.

- The change in tsconfig.json is sufficient to get functional,
  per-.ts-file sourcemaps in build/src/** that work in
  uncompiled mode (i.e. in the playground / tests).
- No further changes are required for these to be ingested by
  gulp + Closure Compiler; the resulting files -
  build/*_compressed.js.map - now point at files in
  core/, blocks/, etc.  This works correctly when packaged and
  also when doing local testing in compiled mode of the checked-in
  build products (i.e., after they are copied to the repository
  root.)
- In order to get sourcemaps to work for local testing in
  compiled mode of the build products directly from build/,
  buildCompile now creates symlinks from build/ to core/,
  blocks/ and generators/.
2022-08-17 17:05:38 +01:00
Christopher Allen
e145102b84 chore(tests): Drop build/test support for node.js v12 (#6222)
* chore(tests): Stop testing on node.js v12
* chore(build): Remove obsolete workaround for closure-calculate-chunks
2022-08-11 18:01:45 +01:00
Rachel Fenichel
f032151cd9 chore(build)!: compile to ES2015 instead of ES5 (#6335) 2022-08-10 16:56:43 -04:00