bartbutenaers / node-red-contrib-blockly

A Node Red node for visual programming a function using Blockly
Apache License 2.0
89 stars 22 forks source link

Merge of my local changes #64

Closed bartbutenaers closed 3 years ago

bartbutenaers commented 3 years ago

I have an old local version of the blockly node at home. Due to the pull request of @jsccjj those changes will have to be reviewed and tested, because they probably won't work anymore.

These are the major changes:

  1. Load blockly as an npm dependency instead of downloading and importing all blockly files manually to our repository. The advantage of this change is that we only need to change the Blockly version number in our package.json file.
  2. Load the data picker, which is a separate npm module -> when this is done, we can implement Add date picker block (see issue).
  3. I have a added some blocks to the Node-RED toolbox, to support new functionality of the function node API:
    • New block for node environment variable
    • New block for node done support
    • The existing node properties block has (besides node name and id) now extra the node output count.
bartbutenaers commented 3 years ago

@cymplecy , @jsccjj , I have made some changes in the 1.1.0 branch for point "3":

The problem with the environment block, is that you are only allowed to get the value of an environment variable. You are not allowed to set it. So we need to prevent somehow that this new block cannot be dropped e.g. in the node-set block. It is too long ago that I worked with Blockly, so I don't know anymore how to accomplish that. If you guys have an idea, please let me know!

P.S. I got a little surprise at work that I have to work tomorrow on sunday. So not much time left to continue on this release this weekend :-(

bartbutenaers commented 3 years ago

Hi @cymplecy , @jsccjj , I had to wait 30 minutes while waiting for my son to help him with his statistics exam... So to avoid wasting this time interval, I have tested my old local changes for "2" and "3" in the 1.1.0 branch version of this node ;-) And I was lucky since it seemed to be still working....

So we specify the minimal required version and with "^" the latest minor release will automatically be downloaded if available. And if we want to switch to a new major Blockly version, we only need to adjust the version number to the new major version number.

This allows us to keep our node easier up-to-date with future Blockly releases from Google.

P.S. the @blockly/field-date NPM package allows us now to implement a Date picker block (see here).

cymplecy commented 3 years ago

Going to power up a test instance tonight and get my brain back into Blocky Dev mode :)

On Sat, 29 May 2021, 15:16 bartbutenaers, @.***> wrote:

Hi @cymplecy https://github.com/cymplecy , @jsccjj https://github.com/jsccjj , I had to wait 30 minutes while waiting for my son to help him with his statistics exam... So to avoid wasting this time interval, I have tested my old local changes for "2" and "3" in the 1.1.0 branch version of this node ;-) And I was lucky since it seemed to be still working....

  • I have removed the Blockly library clone that we had copied locally to our project.
  • All the files Blockly files required by the frontend are now served by the backend endpoint, which will get all the required files from the downloaded NPM module directories (see next step).
  • I have added Blockly NPM dependencies https://github.com/bartbutenaers/node-red-contrib-blockly/blob/release-1.1.0/package.json#L5 to our package.json file:

    "dependencies": { "blockly": "^5.20210325.1", @.***/field-date": "^4.2.14" },

So we specify the minimal required version and with "^" the latest minor release will automatically be downloaded if available. And if we want to switch to a new major Blockly version, we only need to adjust the version number to the new major version number.

This allows us to keep our node easier up-to-date with future Blockly releases from Google.

P.S. the @blockly/field-date NPM package allows us now to implement a Date picker block (see here https://github.com/bartbutenaers/node-red-contrib-blockly/issues/36).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bartbutenaers/node-red-contrib-blockly/issues/64#issuecomment-850840762, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR7RNFIQCBKMNEEFU4H5JLTQDZM7ANCNFSM45VBDYZA .

jsccjj commented 3 years ago

Same here. I will start looking into the code tonight

bartbutenaers commented 3 years ago

@cymplecy, I think all 3 points have been implemented. Can you please close this issue if it is all ok for you?

cymplecy commented 3 years ago

All seem OK