From 677ff6f9589ef84b849822e17a705583a55e50db Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:46:32 -0700 Subject: [PATCH] fix(deps): after installing deps, replace Blockly v11 with v12 RC --- .gitignore | 3 +++ package.json | 1 + temp-use-blockly-v12-rc.sh | 26 ++++++++++++++++++++++++++ tsconfig.json | 3 +++ 4 files changed, 33 insertions(+) create mode 100755 temp-use-blockly-v12-rc.sh diff --git a/.gitignore b/.gitignore index ca5e13595f..fb708b5c85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Temporary until Blockly v12 release +/blockly-rc/ + # OSX .DS_Store diff --git a/package.json b/package.json index 7dfa03160b..980da3277f 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "scripts": { "build": "webpack --mode production", "prepare": "husky || true", + "prepublish": "./temp-use-blockly-v12-rc.sh", "start": "webpack serve --open --mode development", "test": "echo \"Error: no test specified\" && exit 1", "test:lint": "eslint ." diff --git a/temp-use-blockly-v12-rc.sh b/temp-use-blockly-v12-rc.sh new file mode 100755 index 0000000000..1b52deac87 --- /dev/null +++ b/temp-use-blockly-v12-rc.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# vim: set tw=118 ts=2 sw=2 expandtab + +# This script is intended to be run from the root of the scratch-blocks repo. +# This will check out the Blockly v12 Release Candidate branch, +# build it, and link it into node_modules/ + +# TODO: Remove this script once Blockly v12 is available from https://www.npmjs.com/package/blockly + +# WARNING: This uses `npm link`, which causes system-wide changes! + +set -e -x + +if [ ! -d "blockly-rc" ]; then + git clone --branch rc/v12.0.0 git@github.com:google/blockly.git blockly-rc +else + git -C blockly-rc checkout rc/v12.0.0 + git -C blockly-rc pull +fi +npm -C blockly-rc ci +npm -C blockly-rc run package + +# --legacy-peer-deps can be removed once the Blockly plugins used by scratch-blocks support Blockly v12 +# --prefer-offline speeds this up by roughly 2x on my computer (!!) +# --prefer-offline should be OK since we're probably running immediately after a non-offline `npm i` or `npm ci` +npm link --prefer-offline --legacy-peer-deps blockly-rc/dist/ diff --git a/tsconfig.json b/tsconfig.json index 9035b59753..d7603609a0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,7 @@ { + "exclude": [ + "./blockly-rc/" + ], "compilerOptions": { "outDir": "./dist/", "noImplicitAny": true,