Skip to content

Commit

Permalink
chore(dev-scripts)!: Remove support acquiring Blockly through git
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cpcallen committed Feb 29, 2024
1 parent b60f7be commit e14c67f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions plugins/dev-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const webpack = require('webpack');
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);

const packageJson = require(resolveApp('package.json'));

module.exports = (env) => {
const mode = env.mode;
const isDevelopment = mode === 'development';
Expand Down Expand Up @@ -58,16 +56,6 @@ module.exports = (env) => {
target = 'node';
}

// Add 'dist' to the end of the blockly module alias if we have acquired
// blockly from git instead of npm.
let blocklyAliasSuffix = '';
const blocklyDependency =
(packageJson.dependencies && packageJson.dependencies['blockly']) ||
(packageJson.devDependencies && packageJson.devDependencies['blockly']);
if (blocklyDependency && blocklyDependency.indexOf('git://') === 0) {
blocklyAliasSuffix = '/dist';
}

return {
target,
mode: isProduction ? 'production' : 'development',
Expand All @@ -85,7 +73,7 @@ module.exports = (env) => {
},
resolve: {
alias: {
blockly: resolveApp(`node_modules/blockly${blocklyAliasSuffix}`),
'blockly': resolveApp('node_modules/blockly'),
},
extensions: ['.ts', '.js'].filter(
(ext) => isTypescript || !ext.includes('ts'),
Expand Down

0 comments on commit e14c67f

Please sign in to comment.