refactor: Update uncompiled-mode dependency loading for playground, tests (#5715)

* chore: rename module Blockly.blocks.Lists to ....lists

All the other Blockly.blocks modules have lower-case names.  This
one being named with an upper-case initial appears to have been a
typo on my part.

This module name is not mentioned anywhere else in the source code
(though it will be soon!) so no other files need to be edited.
Further, it does not appear anywhere in the last release (which
before PR #5696) so it is not necessary to add an entry in
renamings.js for this change.

* chore(build): Rationalise deps.js, deps.mocha.js

* Include blocks/*.js (Blockly.blocks.*) in tests/deps.js, since
  these modules are used in the playground.  (They are goog.provide
  modules loaded via <script> tags, so their absence from deps.js
  does not cause errors - but it will when they are migrated to
  goog.module and must be loaded via goog.require.)

* Filter the entries in deps.mocha.js so that it includes only the
  additional mocha test modules (i.e. those not mentioned in deps.js
  already).

* refactor: Load blocks and generators using goog.require
This commit is contained in:
Christopher Allen
2021-11-17 00:04:45 +00:00
committed by GitHub
parent 075385c87c
commit 335ff199d7
7 changed files with 207 additions and 467 deletions

View File

@@ -332,6 +332,8 @@ const buildGenerators = gulp.parallel(
/**
* This task updates tests/deps.js, used by blockly_uncompressed.js
* when loading Blockly in uncompiled mode.
*
* Also updates tests/deps.mocha.js, used by the mocha test suite.
*/
function buildDeps(done) {
const closurePath = argv.closureLibrary ?
@@ -342,20 +344,21 @@ function buildDeps(done) {
closurePath,
'core',
'blocks',
'generators',
];
const testRoots = [
...roots,
'generators',
'tests/mocha'
];
const args = roots.map(root => `--root '${root}' `).join('');
execSync(`closure-make-deps ${args} > tests/deps.js`, {stdio: 'inherit'});
// Use grep to filter out the entries that are already in deps.js.
const testArgs = testRoots.map(root => `--root '${root}' `).join('');
execSync(`closure-make-deps ${testArgs} > tests/deps.mocha.js`,
{stdio: 'inherit'});
execSync(`closure-make-deps ${testArgs} | grep 'tests/mocha'` +
' > tests/deps.mocha.js', {stdio: 'inherit'});
done();
};