File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 47
47
"dependencies" : {
48
48
"pxt-common-packages" : " 12.3.29" ,
49
49
"pxt-core" : " 11.4.16"
50
+ },
51
+ "overrides" : {
52
+ "@blockly/field-colour" : {
53
+ "blockly" : " ^12.0.0-beta.4"
54
+ },
55
+ "@blockly/plugin-workspace-search" : {
56
+ "blockly" : " ^12.0.0-beta.4"
57
+ },
58
+ "@blockly/keyboard-navigation" : {
59
+ "blockly" : " ^12.0.0-beta.4"
60
+ }
61
+ },
62
+ "scripts" : {
63
+ "postinstall" : " node ./scripts/patchBlocklyFieldColour.js"
50
64
}
51
- }
65
+ }
Original file line number Diff line number Diff line change
1
+ // This script patches Blockly's FieldColour plugin which has a typing
2
+ // error with the Blockly 12 beta. Presumably this plugin will receive
3
+ // an update when Blockly 12 is officially released and at that time
4
+ // this script can be removed.
5
+
6
+ const fs = require ( "fs" ) ;
7
+ const path = require ( "path" ) ;
8
+
9
+ if ( ! fs . existsSync ( path . resolve ( "./node_modules/@blockly/field-colour/package.json" ) ) ) {
10
+ return ;
11
+ }
12
+
13
+ const packageJson = JSON . parse ( fs . readFileSync ( path . resolve ( "./node_modules/@blockly/field-colour/package.json" ) , "utf8" ) ) ;
14
+
15
+ if ( packageJson . version !== "5.0.12" ) {
16
+ throw new Error ( "patchBlocklyFieldColour was written for @blockly/field-colour version 5.0.12. If the version has been updated, update or remove this script!" ) ;
17
+ }
18
+
19
+
20
+ function patchFile ( filepath ) {
21
+ const contents = fs . readFileSync ( filepath , "utf8" ) ;
22
+
23
+ const patched = contents . replace (
24
+ "protected isFullBlockField(): boolean" ,
25
+ "public isFullBlockField(): boolean"
26
+ ) ;
27
+
28
+ fs . writeFileSync ( filepath , patched , "utf8" ) ;
29
+ }
30
+
31
+ patchFile ( path . resolve ( __dirname , ".." , "./node_modules/@blockly/field-colour/dist/field_colour.d.ts" ) ) ;
32
+ patchFile ( path . resolve ( __dirname , ".." , "./node_modules/@blockly/field-colour/src/field_colour.ts" ) ) ;
33
+
34
+ console . log ( "Patched @blockly/field-colour" )
You can’t perform that action at this time.
0 commit comments