Skip to content

Commit

Permalink
fix!: bump the blockly peer dependency in dev-tools and remove versio…
Browse files Browse the repository at this point in the history
…n probing (#1191)

* fix: use globalThis instead of Blockly...globalThis

* chore: update eslint config

* fix: idGenerator stub

* fix: bump peer dependency on Blockly
  • Loading branch information
BeksOmega authored Jul 18, 2022
1 parent e881956 commit af7b82e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
2 changes: 1 addition & 1 deletion plugins/dev-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"blockly": "^8.0.0"
},
"peerDependencies": {
"blockly": ">=7 <9"
"blockly": ">=8 <9"
},
"publishConfig": {
"access": "public",
Expand Down
21 changes: 2 additions & 19 deletions plugins/dev-tools/src/block_test_helpers.mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,25 +211,8 @@ export const runSerializationTestSuite = (testCases) => {
});
suite('xml round-trip', function() {
setup(function() {
// The genUid is undergoing change as part of the 2021Q3
// goog.module migration:
//
// - It is being moved from Blockly.utils to
// Blockly.utils.idGenerator (which itself is being renamed
// from IdGenerator).
// - For compatibility with changes to the module system (from
// goog.provide to goog.module and in future to ES modules),
// .genUid is now a wrapper around .TEST_ONLY.genUid, which
// can be safely stubbed by sinon or other similar
// frameworks in a way that will continue to work.
if (Blockly.utils.idGenerator &&
Blockly.utils.idGenerator.TEST_ONLY) {
sinon.stub(Blockly.utils.idGenerator.TEST_ONLY, 'genUid')
.returns('1');
} else {
// Fall back to stubbing original version on Blockly.utils.
sinon.stub(Blockly.utils, 'genUid').returns('1');
}
sinon.stub(Blockly.utils.idGenerator.TEST_ONLY, 'genUid')
.returns('1');
});

teardown(function() {
Expand Down
8 changes: 1 addition & 7 deletions plugins/dev-tools/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ if (typeof window !== 'undefined') {

// Export Blockly into the global namespace to make it easier to debug from the
// console.
if (Blockly.utils.global) {
if (Blockly.utils.global.globalThis) {
Blockly.utils.global.globalThis.Blockly = Blockly;
} else {
Blockly.utils.global.Blockly = Blockly;
}
}
globalThis.Blockly = Blockly;

export {
addCodeEditor,
Expand Down
2 changes: 1 addition & 1 deletion plugins/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
es2020: true,
node: true,
},

Expand Down

0 comments on commit af7b82e

Please sign in to comment.