-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The great Blockly upgrade #9865
Conversation
Can we update the Major version of PXT and the target after we merge this. Once we do that we should update the browerDbPrefixes for microbit so as to ensure projects are not completely corrupted once they try out beta
Instructions here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :). Made a small comment on package dependencies.
package.json
Outdated
@@ -66,13 +66,14 @@ | |||
"npm": ">=8.0.0" | |||
}, | |||
"dependencies": { | |||
"@blockly/keyboard-navigation": "^0.1.18", | |||
"@blockly/plugin-workspace-search": "^4.0.10", | |||
"@blockly/keyboard-navigation": "^0.5.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we aren't checking in package-lock.json, we need to lock all dependencies to specific versions.
"@types/fuse": "2.5.2", | ||
"@types/highlight.js": "9.12.2", | ||
"@types/jquery": "3.3.29", | ||
"@types/marked": "0.3.0", | ||
"@types/mocha": "2.2.44", | ||
"@types/mocha": "^2.2.44", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is risky unless we check in package-lock.json. This introduces uncertainty around what we develop against vs. what we ship with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is now a good time to include package-lock.json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing at a time! but i will revert this, not sure how it even happened
@riknoll tell me, for example with this code... Now, do you need to specify this for Blockly.BlockSvg? |
@THEb0nny you might be better off not taking this change... This was a pretty huge update to Blockly and I expect that all the pxt-ev3 fields will require a major rewrite. To answer your question, though, you don't want to import blockly here as the dependency graph can get a little weird. There are two functions defined in pxt for requiring blockly and pxtblockly:
This will import the runtime code, but not the types themselves. Some of the casts being done might throw errors |
@riknoll I'm already doing something.
|
Why am I asking about import * as Blockly from "blockly"
Error in super method for opt_validator. I googled somewhere for the solution opt_validator?: Function. Found opt_validator?: Blockly.FieldValidator
but when I add Tell me how to solve this problem correctly. I found it from here. |
the and yes, wherever possible you should just use the fields that are defined in pxt (such as FieldImages) and not pxt-ev3. it might be worth looking into if there is a way to deprecate all of them; this will likely change how the blocks look/function but will certainly make keeping up with latest pxt less of a headache. |
@riknoll (this.sourceBlock_ as Blockly.BlockSvg) can it be replaced this.sourceBlock_ as any? |
@THEb0nny i'm afraid not, there were major changes made to Blockly in the version we updated. many of the methods/properties we were using before either no longer exist or were made private (and thus inaccessible). if you are getting an error for something on Blockly.BlockSvg, I think it's likely something that was removed in that way and you need to either figure out the new way to access those properties or re-implement it from scratch. this is what i meant when i said that all of the field editors will require a major rewrite (if you want to use version 10.X.X of pxt). alternatively, you can take a dependency on the v9 branch of pxt which uses the old version of Blockly. |
@riknoll well, I made almost all the changes. I had to import BlockSvg } this way.
The only problem left is with field_color. The choice of value does not work there, but there is no error. There is something wrong with the colornumber field with the class setting. Because the class is not installed.
|
@riknoll In your field_colors showEditor_() was removed, where the class was installed. Was this done intentionally?
|
I fixed all the fields pxt-ev3. |
It's time!
This PR upgrades us to the latest version of Blockly and removes our dependency on our fork (pxt-blockly). I went over this in the tech talk, but the basic gist of what this PR does:
pxtblocks/
into modulespxtblocks/plugins/
folderHere are some test links (open in incognito):
https://arcade.makecode.com/app/c5c20c036100e88b7eeca290470f8c45c41118f9-9f2b2b0e96
https://makecode.microbit.org/app/f9ad2136c00106a54df0b4686be1651471195d35-00171f0e8a
There are a few known minor bugs that were discovered in testing today. @Jaqster and @srietkerk will be filing them in pxt-microbit so that they're tracked.
Known regressions (will file bugs):
Future work items: