mit-cml / lexical-variable-demo

Demonstrate the lexical variable plugin
4 stars 2 forks source link

how to build unpkg version for blockly v9.2.1 #2

Open mlzboy opened 8 months ago

mlzboy commented 8 months ago

I use your code build a codepen version,https://codepen.io/mlzboy/pen/qBwXQRB,It's all right,but it depends on newest version blockly,and my project was base on blockly v9.2.1,how to build lexical-variable-plugin for specific version blockly? I had try to modify package.json

{
  "name": "@mit-app-inventor/blockly-block-lexical-variables",
  "version": "2.0.0",
  "description": "A Blockly plugin providing lexical/local variable support and flydown variable getters and setters.",
  "scripts": {
    "audit:fix": "blockly-scripts auditFix",
    "build": "blockly-scripts build",
    "build-nolint": "blockly-scripts build --skip-lint",
    "clean": "blockly-scripts clean",
    "lint": "blockly-scripts lint",
    "predeploy": "blockly-scripts predeploy",
    "prepublishOnly": "npm run clean && npm run build-nolint",
    "start": "blockly-scripts start --skip-lint",
    "test": "blockly-scripts test"
  },
  "main": "./dist/index.js",
  "module": "./src/index.js",
  "unpkg": "./dist/index.js",
  "author": "",
  "keywords": [
    "blockly",
    "blockly-plugin",
    "blockly-block",
    "lexical-variables",
    "local-variables"
  ],
  "homepage": "https://github.com/mit-cml/blockly-plugins/tree/main/block-lexical-variables#readme",
  "bugs": {
    "url": "https://github.com/mit-mcl/blockly-plugins/issues"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/mit-cml/blockly-plugins.git",
    "directory": "block-lexical-variables"
  },
  "license": "Apache-2.0",
  "directories": {
    "dist": "dist",
    "src": "src"
  },
  "files": [
    "dist",
    "src"
  ],
  "type": "module",
  "devDependencies": {
    "@blockly/dev-scripts": "^1.2.27",
    "@blockly/dev-tools": "^5.2.4",
    "chai": "^4.3.7",
    "mocha": "^10.2.0"
  },
  "publishConfig": {},
  "eslintConfig": {
    "extends": "@blockly/eslint-config"
  },
  "engines": {
    "node": ">=8.17.0"
  },
  "browserslist": [
    "defaults",
    "IE 11",
    "IE_Mob 11"
  ]
}

make "@blockly/dev-scripts": "^1.2.27", "@blockly/dev-tools": "^5.2.4", the version lower,then use npm run prepublishOnly to build dist/index.js,and put this file on codepen,make a demo for v9.2.1,https://codepen.io/mlzboy/pen/jORaBwd,but this not work,throw error as bellows

image

mark-friedman commented 8 months ago

@mlzboy Maybe try version 1.0.0 of the plugin (here)

mark-friedman commented 8 months ago

@mlzboy Maybe try version 1.0.0 of the plugin (here)

Sorry, I didn't read carefully enough and didn't realize that you want to use unpkg. I don't think that you can use unpkg with v1.0.0 of the plugin. Your best bet, I think, would be to update your Blockly app to use the Blockly v10.