Skip to content

Get rid of blockly-scripts postinstall script #1623

@maribethb

Description

@maribethb

Category

  • Plugins

Component

dev-scripts & dev-create

Describe the bug

In the template for a new plugin, we add a postinstall script that references blockly-scripts. This causes plugins using this postinstall script to emit an error when installed somewhere outside of `blockly-samples/plugins:

command failed
npm ERR! command sh -c -- blockly-scripts postinstall
npm ERR! sh: blockly-scripts: command not found

The reason for the error is that blockly-scripts is only resolved when inside blockly-samples/plugins.

But let's look at what this script is actually doing, when it works. It's in plugins/dev-scripts/scripts/postinstall.js. All it does is check if blockly was installed from a git URL and if so then it runs the build & package step for blockly itself. This is actually a bizarre thing for a plugin to do. Let's assume we fixed the access issue and this postinstall script was actually able to be run from an arbitrary application. That means if your application installs blockly from git, it wouldn't have the actual compiled output of blockly, so it's unusable. But then you install @blockly/shadow-block-converter which triggers a build in your node_modules/blockly folder and NOW you have a working copy of blockly. That makes very little sense. Having blockly build itself if you install from git should be the responsibility of blockly, not a plugin that uses blockly.

Most of the plugins already don't have this script. We should remove it from the ones that do, remove it from the template, and remove it from blockly-scripts entirely.

To Reproduce

npm install @blockly/shadow-block-converter from a location outside of blockly-samples

Expected behavior

Screenshots

Additional context

Metadata

Metadata

Assignees

Labels

category: pluginAnything in the plugins foldertype: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions