Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: upgrade all plugins to use Blockly v11 #2367

Merged
merged 38 commits into from
May 21, 2024

Conversation

maribethb
Copy link
Contributor

@maribethb maribethb commented May 20, 2024

The basics

The details

This PR merges in changes from the rc/v11.0.0 branch of samples into master. It also updates the minimum version of all plugins and most examples to use Blockly v11 as the minimum required peer dependency and dev dependency.

If you are a user of plugins, make sure you update to the latest major version of the plugins you use at the same time you update Blockly to v11. This will avoid "invalid peer dependency" problems. Any other breaking changes for a particular plugin will be noted in its CHANGELOG.md file.

To review

This PR is best reviewed commit-wise. The commits, in order:

  • (first several commits are the actual commits being merged, and have already been reviewed)
  • Merge rc/v11.0.0 into master.
    • There was one major conflict here; a new test block was added to the field-bitmap plugin in master while in the rc/v11 branch, all the field plugins were updated to remove the field block generator test helper. I converted the new test block to the new format as part of this commit in order to resolve the conflict.
  • Update all plugins to use v11 of Blockly.
    • Verified that this resulted in all 41 plugins being updated, and 82 changed files to include the plugins' package-lock and package
  • Update most examples to use v11 of Blockly.
    • The backpack-demo, react, and keyboard-navigation-codelab, and custom-tooltips-demo examples have not been updated yet.
    • These 4 examples also rely on published plugins. Since we can't use lerna to link the examples to local versions of plugins, I can't update Blockly in these examples until I can also update the plugin versions they depend on.
    • For now, they still rely on v10 (not a beta)
    • After plugins are published, these will need to be updated to depend on the newest versions of both Blockly and their plugin.
  • Updates the dependencies of the theme-hackermode plugin.
    • Since this plugin is marked private, it isn't getting bumped to the latest version of dev-tools when the latter is published.
    • This plugin will also need to be manually updated again once the latest version of dev-tools is published, if that doesn't happen automatically.
    • Also, removed some local dependencies from the package-lock.json file which shouldn't have been there.
  • Updates the package-lock.json file of dev-scripts, which incorrectly contained some local dependencies.
  • Switches custom-tooltips-demo back to v10 for reasons listed above. It was mistakenly updated to begin with, causing peerdeps errors.
  • Update plugins to typescript 5.4.5
    • Some of them were already on this version which caused inconsistent behavior when loading
    • Fixed a problem in some field validators caused by upgrading to ts 5.3.3, similar to fix: updated field_dropdown to properly infer its Field type with TS 5.3.3 blockly#7939 in core
    • I'm not sure why field-date didn't need this fix, but it doesn't appear to
    • Added typescript as an explicit devDependency to field-bitmap and scroll-options -- those plugins were converted to ts but the dependency was never added, so we were just using random versions installed by other plugins
  • fix bad Blockly.ALIGN_RIGHT value in block-plus-minus

After this change, I've verified that the string beta does not appear in the repository except where expected (some non-blockly dependencies in package-lock files). I've also verified that all 41 plugins have been updated to use v11 in their package.json and package-lock.json files.

Before merging, I'll publish this branch on my local github pages to verify everything looks good. I have already verified that the sample app and the devsite-landing-demo pages look good locally.

This PR must be merged, not squashed

BeksOmega and others added 30 commits January 25, 2024 18:36
* chore: install beta

* fix: align reference

* fix: add serialization hooks to procedure models

* fix: add deserialization code to procedure models

* fix: update to latest beta

* chore: format

* chore: lint

* chore: format
…config.js` and `'blockly'` imports (google#2229)

* chore(dev-scripts)!: Remove support acquiring Blockly through git

Completes revert of PR google#335.

BREAKING CHANGE: This PR removes the support that was added
in PR google#335 for aquiring Blockly directly from a git:// URL.

This feature was useful insofar as it enabled merging changes
into blockly-samples that depend on changes in blockly that
have not yet been published (even as a beta)—and still have
tests pass.  For this to work seamlessly, however, the code
in webpack.config.js depended on a postinstall script that
was removed in PR google#1630.

When testing such PRs going forward use npm link for local
testing and wait for changes to blockly to be published
before merging the corresponding changes to samples—or wait
for blockly to become a monorepo so both changes can be made
in the same PR!

Note that this change is breaking only to the dev-scripts plugin
itself, and will not cause other plugins that use it as a dev
dependency to experience a breaking change.

* fix(dev-scripts): Restore packageJson for setting PACKAGE_NAME

The commit which removed support for git:// URLS by completing
the revert of PR google#335 removed the initialisation of packageJson
(from the package.json of the plugin being built) which turns
out to still be needed by a DefinePlugin call added later.

* fix(dev-scripts): Don't use alias when resolving blockly

PR google#226 addedd a resolve.alias for blockly to webpack.config.js.
It is not entirely clear what the purpose of this was at the
time, but it has the effect of treating imports of submodules
(e.g. 'blockly/core') as if they were direct imports (e.g. of
'./node_modules/blockly/core.js'), causing webpack to ignore
the blockly package's package.json file.

This causes plugins to fail to build due to the introduction
of an exports stanza in that file (and other related changes)
in google/blockly#7822.

* fix(dev-scripts): Exclude blockly from plugin bundles

Fix bloat caused by some plugins depending on all of blockly
(instead of just blockly/core), resulting in webpack including
a copy of blockly in the bundled plugin becuase only the
subpackage entrypoints were listed inthe externals stanza of
webpack.config.js.

This will also avoid certain problems that might occur due to
apps using such bundled inadvertently containing two or more
different copies of Blockly.

Also fix the one plugin which did still have an unnecessary dependency
on blockly intead of blockly/core.

* refactor(dev-scripts): Introduce exists() for readability

Currently webpack.conf.js is hard to understand.  Attempt to
improve readability by making some parts more DRY ("don't
repeat yourself") and others more DAMP ("descriptive and
 meaningful phrases").

* fix(dev-scripts): Ignore more jsdom subdependencies

Add bufferutils and utf-8-validate to IgnorePlugin config when
building tests.  These are optional dependencies of wd, which is
itself a dependency of jsdom.

Also refactor how plugins config is generated to improve readability.

* refactor(dev-scripts): Simplify resolve.extensions

There doesn't appear to be any reason not to include the '.ts'
in resolve.extensions even for pure-JS plugins, but it is
_necessary_ to include it in TS plugins.

Since the default value for resolve.extensions is
    ['.js', '.json', '.wasm']
set it to
    ['.ts', '.js', '.json', '.wasm']
which gives priority to TS, then JS, then the other default
extensions.

Also add a helpful comment explaining the purpose of
resolve.fallback.

* fix(plugins): Build tests against 'blockly', not 'blockly/node'

The latter has never been an advertised entrypoint, and will
cease to be a valid entrypoint in v11 (see google/blockly#7822).
Fortunately the 'blockly' entrypoint behaves the same as
the 'blockly/node' entrypoint does in a node.js environment.

* chore(plugins): Fix lint, formatting

* fix(dev-tools): Have runSerializationTestSuite accept Blockly

Have runSerializationTestSuite accept a second argument which is
the Blockly object to use for XML serialization/deserialization.

This works around an issue in blockly-samples that (following
the deletion of the alias for blockly in webpack.config.js)
causes tests using this function to fail due to having two copies
of jsdom loaded, where each will reject DOM objects created by
the other.  See
google#2229 (comment)
for more details.

* chore(typed-variable-modal): Skip failing test
Merge pull request google#2267 from BeksOmega/merge-master-v11
* work on fixing build

* chore: fix keyboard nav tests

* chore: fix suggested blocks
…oogle#2192)

* fix: dynamic blocks finalizing connections when children are deleted

* chore: jsdoc
* chore: update package.json to beta 7

* chore: update package locks
* feat: support keyboard navigation of flyout buttons

* fix: linting errors and rebase
* feat: move backpack to use interface for backpackability

* chore: PR comments

* fix: nits

* chore: update README

* chore: use version number
* fix!: update the scroll options to work with v11 dragging

* fix: remove unnecessary private properties

* fix: naming and logs

* chore: fixup readme

* chore: clean up other uses of ScrollDragger
…le#2334)

* Update blockly dependency from 11.0.0-beta.7 to 11.0.0-beta.9

* Disallow reenabling a call block with a disabled def.
Following the previous merge commit, the state of some of the
package-lock.json files was not quite in sync with their
corresponding package.json files.  Running npm install fixed
this and resulted in the two changes in this commit.
Merge pull request google#2348 from cpcallen/chore/merge-master
* fix: update keyboard nav to use proper getContents

* fix: remove use of flyoutitem.type

* chore: update to latest blockly beta

* chore: format
* fix: stop using generateFieldTestBlocks for bitmap field

* fix: stop using generateFieldTestBlock for HSV slider field

* fix: stop using generateFieldTestBlocks for date field

* fix: stop using generateFieldTestBlocks for the slider field

* fix: stop using generateFieldTestBlocks for the angle field

* fix: stop using generateFieldTestBlocks for dropdown grid field

* chore: format
…oogle#2358)

* fix: fix scroll-options base class

* feat: convert scroll-options to typescript

* fix: use method instead of private attribute

* Add AutoScrollable interface

* fix: remove cast to any

* fix: wheel listener on the drag layer

* fix: update readme and export interface

* fix: switch to drag instead of moveDuringDrag
* fix: update react example to v11 beta and fix imports

* fix: update svelte example to v11 beta and fix imports

* fix: update vue3 example to v11 beta and fix imports

* fix: use more specific imports for vue example

* chore: tidy import

* fix: update rollup demo to fix imports

* fix: use blockly latest instead of beta in react

* chore: format
@maribethb maribethb requested a review from BeksOmega May 20, 2024 23:15
@maribethb maribethb requested a review from a team as a code owner May 20, 2024 23:15
@maribethb maribethb merged commit 4814ec8 into google:master May 21, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants