Skip to content

Conversation

@maribethb
Copy link
Contributor

The basics

The details

Resolves

Allows GitHub pages to be published correctly while using lerna v9+.

Proposed Changes

  • Removes legacy lerna package management from examples
  • Uses npm workspaces for examples directories (in addition to plugin directories, which were already using npm workspaces)
  • Updates lerna commands to only run on plugins in appropriate places
  • Adds a script that copies over the contents of node_modules/blockly and any @blockly plugins into an examples/lib/ directory, and then updates all the examples to use this location instead of relying directly on node_modules/blockly existing (this is done in a separate commit to make it easier to review)
  • Updates github pages deployment scripts + action to call the new copy script first

Reason for Changes

The primary driver for this change is actually #2658

  1. npm security now makes the only non-annoying publishing option from github actions is to use trusted publishing.
  2. we need to use lerna v9 in order to use trusted publishing
  3. lerna v9 finally eliminates the legacy package management tools (lerna bootstrap)

We were doing a weird thing with lerna where we were using npm workspaces for plugins, but using lerna's legacy package management for examples. Unsurprisingly, that situation broke. The reason we couldn't use npm workspaces for examples is that the way we used <script src="./node_modules/blockly/..."> is incompatible with hoisting. We really shouldn't be doing that, as there's no guarantee that blockly is located in ./node_modules anyway. We use webpack for plugins to do this properly, but the examples are all handcrafted HTML files.

To solve this problem, I updated all the examples to use a hardcoded location that is under my control. Then I added a script that will copy the contents of blockly and all the plugins out of wherever they're located (using node's resolve functionality) into that known location.

Test Coverage

  • Ran npm run test and other scripts to make sure they only run stuff for plugins
  • Opened all the demos index.html files to make sure they can be opened on the file system
  • Ran npm run test:ghpages to make sure the github pages site runs locally
  • Deployed the ghpages site on my personal fork to make sure it works when hosted
  • Specially checked the devsite-landing-demo to make sure it will still work when iframed on devsite
  • Ran npm run publish:checkVersions to make sure lerna still knows how to publish despite examples being in the workspace now

Documentation

Updated the scripts docs.

Additional Information

Some of the other github workflows are out of date and need to removed, but I'll do that in a separate PR.

@maribethb maribethb requested a review from a team as a code owner January 2, 2026 22:12
@maribethb maribethb requested review from gonfunko and removed request for a team January 2, 2026 22:12
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.

2 participants