From 569bf9c64bfe2461d6c8c0f168c72fca572e6a3d Mon Sep 17 00:00:00 2001 From: Evgeny Metelkin Date: Fri, 17 Nov 2023 14:47:11 +0200 Subject: [PATCH] add platform file schema --- TODO.md | 3 -- package-lock.json | 40 ++++++-------------- package.json | 2 +- src/editor-page.js | 1 + src/heta-templates/platform.json.template.js | 2 +- src/platform-shemas.js | 13 +++++++ 6 files changed, 27 insertions(+), 34 deletions(-) create mode 100644 src/platform-shemas.js diff --git a/TODO.md b/TODO.md index a55e277..83bd8fe 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,5 @@ # TODO list -- external load for platform.json + DnD -- проверка синтаксиса platform.json -- platform.yml - not to display output.log - hot keys for InfoPage - switch monaco themes diff --git a/package-lock.json b/package-lock.json index 1811b90..dbfbe75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@viz-js/viz": "^3.2.3", "ajv": "^8.12.0", - "heta-compiler": "^0.7.0", + "heta-compiler": "github:hetalang/heta-compiler", "jquery": "^3.7.0", "js-yaml": "^4.1.0", "jszip": "^3.10.1", @@ -6311,6 +6311,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -7318,8 +7319,8 @@ }, "node_modules/heta-compiler": { "version": "0.7.0", - "resolved": "https://registry.npmjs.org/heta-compiler/-/heta-compiler-0.7.0.tgz", - "integrity": "sha512-404lo2eVTNrioT9faePLqywXJRlDEsT/02gQBxNrlmn/5AA1qsZ1l4qF+mbNCg4QWvTfXTYlb2T15BmMVm5Ekg==", + "resolved": "git+ssh://git@github.com/hetalang/heta-compiler.git#db9772b7ae1c3bbc46ef2497b4765a1a782cb0e2", + "license": "Apache-2.0", "dependencies": { "@insysbio/topo-sort": "^1.0.1", "ajv": "^6.12.6", @@ -7329,7 +7330,7 @@ "fs-extra": "^7.0.1", "heta-parser": "^0.3.16", "inquirer": "^7.3.3", - "js-yaml": "^3.14.0", + "js-yaml": "^4.1.0", "lodash": "^4.17.21", "markdown-it": "^12.3.2", "mathjs": "^9.4.0", @@ -7338,7 +7339,7 @@ "nunjucks": "^3.2.4", "random-id": "^1.0.4", "semver": "^6.3.0", - "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz", + "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz", "xml-js": "^1.6.11" }, "bin": { @@ -7379,14 +7380,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/heta-compiler/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, "node_modules/heta-compiler/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -7462,18 +7455,6 @@ "node": ">=8.0.0" } }, - "node_modules/heta-compiler/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/heta-compiler/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -13146,7 +13127,8 @@ "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true }, "node_modules/ssri": { "version": "8.0.1", @@ -14790,9 +14772,9 @@ } }, "node_modules/xlsx": { - "version": "0.19.3", - "resolved": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz", - "integrity": "sha512-8IfgFctB7fkvqkTGF2MnrDrC6vzE28Wcc1aSbdDQ+4/WFtzfS73YuapbuaPZwGqpR2e0EeDMIrFOJubQVLWFNA==", + "version": "0.20.0", + "resolved": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz", + "integrity": "sha512-adg5edVTkXXGTnb0iWrc3Z47ViGgwmD47yx6VfSCZhfdKPtHcElYGs48OtcO4nwOu90Pjz5mmyl0HLcvbSRYTQ==", "license": "Apache-2.0", "bin": { "xlsx": "bin/xlsx.njs" diff --git a/package.json b/package.json index a08237b..251e1d1 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "dependencies": { "@viz-js/viz": "^3.2.3", "ajv": "^8.12.0", - "heta-compiler": "^0.7.0", + "heta-compiler": "github:hetalang/heta-compiler", "jquery": "^3.7.0", "js-yaml": "^4.1.0", "jszip": "^3.10.1", diff --git a/src/editor-page.js b/src/editor-page.js index 8e5d69c..67498de 100644 --- a/src/editor-page.js +++ b/src/editor-page.js @@ -1,4 +1,5 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'; +import './platform-shemas'; import Page from './abstract-page'; export default class EditorPage extends Page { diff --git a/src/heta-templates/platform.json.template.js b/src/heta-templates/platform.json.template.js index b4c0761..57165c6 100644 --- a/src/heta-templates/platform.json.template.js +++ b/src/heta-templates/platform.json.template.js @@ -1,5 +1,5 @@ export default `{ - "$schema": "https://github.com/hetalang/heta-compiler#", + "$schema": "https://github.com/hetalang/heta-compiler/declaration-schema.json", "id": "template", "notes": "platform notes", "version": "v0.1.0", diff --git a/src/platform-shemas.js b/src/platform-shemas.js new file mode 100644 index 0000000..d064cce --- /dev/null +++ b/src/platform-shemas.js @@ -0,0 +1,13 @@ +import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'; +import declarationSchema from 'heta-compiler/src/builder/declaration-schema.json'; + +monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ + validate: true, + schemas: [ + { + uri: "https://github.com/hetalang/heta-compiler/declaration-schema.json", + fileMatch: ['*'], + schema: declarationSchema + } + ] +});