chore: remove legacy lerna packagement from examples #2662
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
Allows GitHub pages to be published correctly while using lerna v9+.
Proposed Changes
node_modules/blocklyand any@blocklyplugins into anexamples/lib/directory, and then updates all the examples to use this location instead of relying directly onnode_modules/blocklyexisting (this is done in a separate commit to make it easier to review)Reason for Changes
The primary driver for this change is actually #2658
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_modulesanyway. 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
blocklyand all the plugins out of wherever they're located (using node'sresolvefunctionality) into that known location.Test Coverage
npm run testand other scripts to make sure they only run stuff for pluginsindex.htmlfiles to make sure they can be opened on the file systemnpm run test:ghpagesto make sure the github pages site runs locallynpm run publish:checkVersionsto make sure lerna still knows how to publish despite examples being in the workspace nowDocumentation
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.