Improvements.
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --hot",
|
||||
"build": "webpack",
|
||||
"build": "node --max_old_space_size=4096 ../node_modules/webpack/bin/webpack.js --mode production",
|
||||
"build-docs": "ts-node ./scripts/build-docs",
|
||||
"pub": "gh-pages -d dist"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
34
playground/scripts/build-docs.ts
Normal file
34
playground/scripts/build-docs.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
JsonSchemaGenerator,
|
||||
TypeScriptTypeGenerator,
|
||||
} from "@hediet/semantic-json";
|
||||
import { writeFileSync, mkdirSync } from "fs";
|
||||
import { join } from "path";
|
||||
import { globalVisualizationFactory } from "@hediet/visualization-core";
|
||||
import "../src/visualizations";
|
||||
|
||||
const tsGen = new TypeScriptTypeGenerator();
|
||||
const tp = tsGen.getType(globalVisualizationFactory.getSerializer());
|
||||
|
||||
const tsSrc = `export type KnownVisualizationData = ${tp};\n\n\n${[
|
||||
...tsGen.definitions.values(),
|
||||
]
|
||||
.map(v => v.getDefinitionSource({ exported: true }) + `\n\n`)
|
||||
.join("")}`;
|
||||
|
||||
const targetDir = join(__dirname, "../dist/docs");
|
||||
|
||||
mkdirSync(targetDir, { recursive: true });
|
||||
|
||||
writeFileSync(join(targetDir, "visualization-data.ts"), tsSrc, {
|
||||
encoding: "utf-8",
|
||||
});
|
||||
|
||||
const schema = new JsonSchemaGenerator().getJsonSchemaWithDefinitions(
|
||||
globalVisualizationFactory.getSerializer()
|
||||
);
|
||||
const jsonSchema = JSON.stringify(schema, undefined, 4);
|
||||
|
||||
writeFileSync(join(targetDir, "visualization-data-schema.json"), jsonSchema, {
|
||||
encoding: "utf-8",
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@@ -16,6 +16,8 @@
|
||||
|
||||
// This bundles the monaco editor. Uncomment it to load monaco dynamically.
|
||||
// Dynamic loading increases webpack build speed significantly.
|
||||
import "monaco-editor";
|
||||
if (typeof process === undefined) {
|
||||
require("monaco-editor");
|
||||
}
|
||||
|
||||
import "@hediet/visualization-bundle"; // */
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { TypeScriptTypeGenerator } from "@hediet/semantic-json";
|
||||
import { writeFileSync } from "fs";
|
||||
import { globalVisualizationFactory } from "@hediet/visualization-core";
|
||||
import "./src/index";
|
||||
|
||||
const t = new TypeScriptTypeGenerator();
|
||||
const tp = t.getType(globalVisualizationFactory.getSerializer());
|
||||
|
||||
const src = `export type KnownVisualizationData = ${tp};\n\n\n${[
|
||||
...t.definitions.values(),
|
||||
]
|
||||
.map(v => v.getDefinitionSource({ exported: true }) + `\n\n`)
|
||||
.join("")}`;
|
||||
|
||||
writeFileSync("./out.ts", src, { encoding: "utf-8" });
|
||||
Reference in New Issue
Block a user