blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

chore!: Update plugins and examples to `blockly` version `9.0.0-beta.1`

Open cpcallen opened this issue 3 years ago • 3 comments

This branch is intended to collect all the changes to the blockly-samples repository needed to update samples to Blockly v9.

The first four commits:

  1. Use clang-format to fix (whitespace) formatting of package.json and package-lock.json files so they are consistent.
  2. Bump blockly peerDependencies for plugins/*/ from <9 to <10.
  3. Bump blockly devDependencies for pluins/*/ to 9.0.0-beta.1.
  4. Run npm install blockly@beta in each package in examples/* to make sure package-lock.json is consistent with package.json.

(Notably this does not yet include updating packages in examples/* to the Blockly v9 beta.)

cpcallen avatar Sep 21 '22 15:09 cpcallen

Current breakages:

  • field-date (fixed by #1295)
  • field-bitmap (probably fixed by https://github.com/google/blockly/pull/6453 but needs confirmation)
  • blocks-plus-minus (fixed by #1305)
  • generator imports in dev tools (fixed by #1305)
  • keyboard-navigation

rachel-fenichel avatar Sep 27 '22 21:09 rachel-fenichel

Remaining issues:

  • Keyboard nav tests inject a workspaceSvg, but it's actually using jsdom. The tests fail on these lines in core/renderers/marker_svg.ts:
    // Ensures the marker will be visible immediately after the move.
    const animate = this.currentMarkerSvg!.childNodes[0];
    if (animate !== undefined) {
      animate instanceof SVGAnimationElement && animate.beginElement();
    }

My proposed solution is to swap it back from an instanceof check to a cast or AnyDuringMigration, at least for release. That requires a change in core, a beta, and installing the beta over here.

I don't have a workaround yet.

rachel-fenichel avatar Sep 28 '22 22:09 rachel-fenichel

The next issue is also related to running rendered workspaces in jsdom for testing. Canvas doesn't exist, and Blockly uses it for text width computation.

Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)

The old workaround was to monkeypatch Blockly.dom.utils.getFastTextWidthWithSizeString, but that's no longer accessible for monkeypatching.

Based on the error message, the new workaround is to install a package to add this.

rachel-fenichel avatar Sep 30 '22 16:09 rachel-fenichel

@maribethb fyi I just updated this to a full PR instead of a draft, and I think it's ready to go:

  • Every commit has been reviewed individually
  • Initial changes are primarily whitespace
  • We've tested the results of these changes on my gh-pages.

rachel-fenichel avatar Oct 04 '22 23:10 rachel-fenichel

Normally after the release, we'd update the branch to the full non-beta 9.0.0 release before merging the branch. That should be done first as we don't want the main version of plugins to have a dependency on a beta version.

maribethb avatar Oct 05 '22 16:10 maribethb