make code isomorphic, quick export script
This commit is contained in:
parent
43f0d06184
commit
c5988b30f0
6 changed files with 48 additions and 27 deletions
19
export_blockly.js
Normal file
19
export_blockly.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import fs from 'fs'
|
||||
|
||||
import { allBlocksJson } from './src/blocks/index.js'
|
||||
import toolbox from './src/toolbox.js'
|
||||
|
||||
if(fs.existsSync('export')) {
|
||||
fs.rmSync('export', { recursive: true, force: true })
|
||||
}
|
||||
|
||||
fs.mkdirSync('export')
|
||||
|
||||
// workspace.xml
|
||||
fs.copyFileSync('./src/workspace.xml', 'export/workspace.xml')
|
||||
|
||||
// blocks.json
|
||||
fs.writeFileSync('export/blocks.json', JSON.stringify(allBlocksJson, null, 2))
|
||||
|
||||
// toolbox.json
|
||||
fs.writeFileSync('export/toolbox.json', JSON.stringify(toolbox, null, 2))
|
||||
|
|
@ -2,12 +2,14 @@
|
|||
"name": "blockly-tool",
|
||||
"version": "1.0.0",
|
||||
"description": "A Blockly tooling project",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"export": "node export_blockly.js"
|
||||
},
|
||||
"keywords": [
|
||||
"blockly"
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
import * as Blockly from 'blockly';
|
||||
import Blockly from 'blockly'
|
||||
|
||||
import action_root from './custom/action_root'
|
||||
import feed_selector from './custom/feed_selector'
|
||||
// import trigger_all from './custom/trigger_all'
|
||||
import reactive_trigger from './custom/reactive_trigger'
|
||||
import comparison_selector from './custom/comparison_selector'
|
||||
// import trigger_on_change from './custom/trigger_on_change'
|
||||
import action_publish_to_feed from './custom/action_publish_to_feed'
|
||||
import action_send_email from './custom/action_send_email'
|
||||
// import transform_regex from './custom/transform_regex'
|
||||
import action_root from './custom/action_root.js'
|
||||
import feed_selector from './custom/feed_selector.js'
|
||||
// import trigger_all from './custom/trigger_all.js'
|
||||
import reactive_trigger from './custom/reactive_trigger.js'
|
||||
import comparison_selector from './custom/comparison_selector.js'
|
||||
// import trigger_on_change from './custom/trigger_on_change.js'
|
||||
import action_publish_to_feed from './custom/action_publish_to_feed.js'
|
||||
import action_send_email from './custom/action_send_email.js'
|
||||
// import transform_regex from './custom/transform_regex.js'
|
||||
|
||||
import math_number from './common/math_number'
|
||||
import text from './common/text'
|
||||
import text_multiline from './common/text_multiline'
|
||||
import logic_boolean from './common/logic_boolean'
|
||||
import logic_null from './common/logic_null'
|
||||
// import controls_if from './common/controls_if'
|
||||
// import logic_compare from './common/logic_compare'
|
||||
// import logic_negate from './common/logic_negate'
|
||||
// import logic_operation from './common/logic_operation'
|
||||
// import math_arithmetic from './common/math_arithmetic'
|
||||
// import variables_set from './common/variables_set'
|
||||
// import variables_get from './common/variables_get'
|
||||
// import math_change from './common/math_change'
|
||||
import math_number from './common/math_number.js'
|
||||
import text from './common/text.js'
|
||||
import text_multiline from './common/text_multiline.js'
|
||||
import logic_boolean from './common/logic_boolean.js'
|
||||
import logic_null from './common/logic_null.js'
|
||||
// import controls_if from './common/controls_if.js'
|
||||
// import logic_compare from './common/logic_compare.js'
|
||||
// import logic_negate from './common/logic_negate.js'
|
||||
// import logic_operation from './common/logic_operation.js'
|
||||
// import math_arithmetic from './common/math_arithmetic.js'
|
||||
// import variables_set from './common/variables_set.js'
|
||||
// import variables_get from './common/variables_get.js'
|
||||
// import math_change from './common/math_change.js'
|
||||
|
||||
|
||||
const
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as Blockly from 'blockly'
|
||||
import Blockly from 'blockly'
|
||||
import { allBlocksJson, allGenerators } from './blocks'
|
||||
import toolbox from './toolbox'
|
||||
import { save, load } from './serialization'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as Blockly from 'blockly/core'
|
||||
import Blockly from 'blockly/core'
|
||||
|
||||
const storageKey = 'blocklyToolWorkspace'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { allBlockCategories, allBlockLabels } from './blocks'
|
||||
import { allBlockCategories, allBlockLabels } from './blocks/index.js'
|
||||
|
||||
|
||||
const
|
||||
|
|
|
|||
Loading…
Reference in a new issue