miqro 1.8.3 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/cli.js +23 -37
- package/dist/utils/index.js +2 -2
- package/package.json +2 -2
- package/dist/cmds/wc-cache-templates.d.ts +0 -2
- package/dist/cmds/wc-cache-templates.js +0 -47
- package/dist/cmds/wc-new.d.ts +0 -4
- package/dist/cmds/wc-new.js +0 -160
- package/dist/utils/xml.d.ts +0 -1
- package/dist/utils/xml.js +0 -96
package/README.md
CHANGED
|
@@ -9,3 +9,42 @@ to see available cmds
|
|
|
9
9
|
```
|
|
10
10
|
npx miqro
|
|
11
11
|
```
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Available commands:
|
|
15
|
+
|
|
16
|
+
==api development==
|
|
17
|
+
|
|
18
|
+
new create a new project.
|
|
19
|
+
new:typescript create a new typescript project.
|
|
20
|
+
new:main creates a new main file.
|
|
21
|
+
new:route creates a new route.
|
|
22
|
+
config print config as a json.
|
|
23
|
+
config:bash print config as a bash script.
|
|
24
|
+
config:env print config as a env file.
|
|
25
|
+
config:init inits your config folder.
|
|
26
|
+
doc api folder auto doc as a json.
|
|
27
|
+
doc:md api folder auto doc as a markdown.
|
|
28
|
+
|
|
29
|
+
==start helpers==
|
|
30
|
+
|
|
31
|
+
start start script in cluster mode.
|
|
32
|
+
watch watch folder for changes.
|
|
33
|
+
serve serve static files.
|
|
34
|
+
|
|
35
|
+
==testing==
|
|
36
|
+
|
|
37
|
+
test run test files.
|
|
38
|
+
new:test create new test.js file.
|
|
39
|
+
|
|
40
|
+
==sequelize helpers==
|
|
41
|
+
|
|
42
|
+
db:console a query console for sequelize.
|
|
43
|
+
db:dump:data dump the data of the database.
|
|
44
|
+
db:push:data push a dump to the database.
|
|
45
|
+
db:make:migration generate migrations from model changes.
|
|
46
|
+
db:make:migration:force:clean:state force 'local' model state.
|
|
47
|
+
db:migrate loads config and run migrations.
|
|
48
|
+
db:init init sequelize configuration.
|
|
49
|
+
db:create:model creates an example model.
|
|
50
|
+
```
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,6 @@ const start_1 = require("./cmds/start");
|
|
|
6
6
|
const test_1 = require("./cmds/test");
|
|
7
7
|
const watch_1 = require("./cmds/watch");
|
|
8
8
|
const new_1 = require("./cmds/new");
|
|
9
|
-
const wc_new_1 = require("./cmds/wc-new");
|
|
10
9
|
const doc_json_1 = require("./cmds/doc-json");
|
|
11
10
|
const doc_md_1 = require("./cmds/doc-md");
|
|
12
11
|
const config_init_1 = require("./cmds/config-init");
|
|
@@ -25,100 +24,87 @@ const db_createmodel_1 = require("./cmds/db-createmodel");
|
|
|
25
24
|
const db_push_data_1 = require("./cmds/db-push-data");
|
|
26
25
|
const db_dump_data_1 = require("./cmds/db-dump-data");
|
|
27
26
|
const db_migrate_1 = require("./cmds/db-migrate");
|
|
28
|
-
//import {main as wcCompileSFC, usage as wcCompileSFCUsage} from "./cmds/wc-compile-sfc";
|
|
29
|
-
const wc_cache_templates_1 = require("./cmds/wc-cache-templates");
|
|
30
27
|
// noinspection SpellCheckingInspection
|
|
31
28
|
(0, utils_1.mainCMD)({
|
|
32
|
-
["new"]: { section: "api development", cb: new_1.mainJS, tabs: 5, description: `create a new project
|
|
33
|
-
["new:typescript"]: { cb: new_1.mainTS, tabs: 4, description: `create a new typescript project
|
|
29
|
+
["new"]: { section: "api development", cb: new_1.mainJS, tabs: 5, description: `create a new project.` },
|
|
30
|
+
["new:typescript"]: { cb: new_1.mainTS, tabs: 4, description: `create a new typescript project.` },
|
|
34
31
|
["new:main"]: {
|
|
35
32
|
//section: "http scafolding",
|
|
36
33
|
cb: handler_main_new_1.main,
|
|
37
34
|
tabs: 4,
|
|
38
|
-
description: `creates a new main file
|
|
35
|
+
description: `creates a new main file.`
|
|
39
36
|
},
|
|
40
|
-
["new:route"]: { cb: handler_apiroute_new_1.main, tabs: 4, description: `creates a new route
|
|
37
|
+
["new:route"]: { cb: handler_apiroute_new_1.main, tabs: 4, description: `creates a new route.` },
|
|
41
38
|
["config"]: {
|
|
42
39
|
//section: "config managment",
|
|
43
40
|
cb: config_1.main,
|
|
44
41
|
tabs: 5,
|
|
45
|
-
description: `
|
|
42
|
+
description: `print config as a json.`
|
|
46
43
|
},
|
|
47
44
|
["config:bash"]: {
|
|
48
45
|
cb: config_bash_1.main,
|
|
49
46
|
tabs: 4,
|
|
50
|
-
description: `
|
|
47
|
+
description: `print config as a bash script.`
|
|
51
48
|
},
|
|
52
49
|
["config:env"]: {
|
|
53
50
|
cb: config_env_1.main,
|
|
54
51
|
tabs: 4,
|
|
55
|
-
description: `
|
|
52
|
+
description: `print config as a env file.`
|
|
56
53
|
},
|
|
57
|
-
["config:init"]: { cb: config_init_1.main, tabs: 4, description: `inits your config folder
|
|
54
|
+
["config:init"]: { cb: config_init_1.main, tabs: 4, description: `inits your config folder.` },
|
|
58
55
|
["doc"]: {
|
|
59
56
|
//section: "api documentation",
|
|
60
57
|
tabs: 5,
|
|
61
58
|
cb: doc_json_1.main,
|
|
62
|
-
description: `
|
|
59
|
+
description: `api folder auto doc as a json.`
|
|
63
60
|
},
|
|
64
61
|
["doc:md"]: {
|
|
65
62
|
cb: doc_md_1.main,
|
|
66
63
|
tabs: 5,
|
|
67
|
-
description: `
|
|
64
|
+
description: `api folder auto doc as a markdown.`
|
|
68
65
|
},
|
|
69
|
-
["new:front"]: { section: "front development", cb: wc_new_1.mainJS, tabs: 4, description: `create a new project. ${wc_new_1.usageJS}` },
|
|
70
|
-
["new:front:typescript"]: { cb: wc_new_1.mainTS, tabs: 3, description: `create a new typescript project. ${wc_new_1.usageTS}` },
|
|
71
|
-
["generate:template:cache"]: {
|
|
72
|
-
//section: "web components",
|
|
73
|
-
tabs: 3,
|
|
74
|
-
cb: wc_cache_templates_1.main, description: `generate a cache.json for webcomponents. ${wc_cache_templates_1.usage}`
|
|
75
|
-
},
|
|
76
|
-
/*["sfc"]: {
|
|
77
|
-
tabs: 6,
|
|
78
|
-
cb: wcCompileSFC, description: `transpiles a single file webcomponent to commonjs file for packing. ${wcCompileSFCUsage}`
|
|
79
|
-
},*/
|
|
80
66
|
["start"]: {
|
|
81
67
|
section: "start helpers",
|
|
82
68
|
tabs: 5,
|
|
83
69
|
cb: start_1.main,
|
|
84
|
-
description: `start
|
|
70
|
+
description: `start script in cluster mode.`
|
|
85
71
|
},
|
|
86
72
|
["watch"]: {
|
|
87
73
|
//section: "watch",
|
|
88
74
|
cb: watch_1.main,
|
|
89
75
|
tabs: 5,
|
|
90
|
-
description: `watch
|
|
76
|
+
description: `watch folder for changes.`
|
|
91
77
|
},
|
|
92
78
|
["serve"]: {
|
|
93
79
|
//section: "serve static files",
|
|
94
80
|
tabs: 5,
|
|
95
|
-
cb: serve_1.main, description: `serve static files
|
|
81
|
+
cb: serve_1.main, description: `serve static files.`
|
|
96
82
|
},
|
|
97
|
-
["test"]: { section: "testing", cb: test_1.main, tabs: 5, description: `run test files
|
|
98
|
-
["new:test"]: { cb: new_test_1.main, tabs: 4, description: `create new test.js file
|
|
83
|
+
["test"]: { section: "testing", cb: test_1.main, tabs: 5, description: `run test files.` },
|
|
84
|
+
["new:test"]: { cb: new_test_1.main, tabs: 4, description: `create new test.js file.` },
|
|
99
85
|
["db:console"]: {
|
|
100
86
|
section: "sequelize helpers",
|
|
101
87
|
cb: db_console_1.main,
|
|
102
88
|
tabs: 4,
|
|
103
|
-
description: `
|
|
89
|
+
description: `a query console for sequelize.`
|
|
104
90
|
},
|
|
105
91
|
["db:dump:data"]: {
|
|
106
92
|
cb: db_dump_data_1.main,
|
|
107
93
|
tabs: 4,
|
|
108
|
-
description: `dump the data of the database
|
|
94
|
+
description: `dump the data of the database.`
|
|
109
95
|
},
|
|
110
|
-
["db:push:data"]: { cb: db_push_data_1.main, tabs: 4, description: `push a dump to the database
|
|
96
|
+
["db:push:data"]: { cb: db_push_data_1.main, tabs: 4, description: `push a dump to the database.` },
|
|
111
97
|
["db:make:migration"]: {
|
|
112
98
|
cb: db_makemigrations_1.main,
|
|
113
99
|
tabs: 3,
|
|
114
|
-
description: `
|
|
100
|
+
description: `generate migrations from model changes.`
|
|
115
101
|
},
|
|
116
102
|
["db:make:migration:force:clean:state"]: {
|
|
117
103
|
cb: db_sync_makemigrations_1.main,
|
|
118
104
|
tabs: 1,
|
|
119
|
-
description: `
|
|
105
|
+
description: `force 'local' model state.`
|
|
120
106
|
},
|
|
121
|
-
["db:migrate"]: { cb: db_migrate_1.main, tabs: 4, description: `loads config
|
|
122
|
-
["db:init"]: { cb: db_init_1.main, tabs: 5, description: `init sequelize configuration
|
|
123
|
-
["db:create:model"]: { cb: db_createmodel_1.main, tabs: 4, description: `creates an example model
|
|
107
|
+
["db:migrate"]: { cb: db_migrate_1.main, tabs: 4, description: `loads config and run migrations.` },
|
|
108
|
+
["db:init"]: { cb: db_init_1.main, tabs: 5, description: `init sequelize configuration.` },
|
|
109
|
+
["db:create:model"]: { cb: db_createmodel_1.main, tabs: 4, description: `creates an example model.` }
|
|
124
110
|
}, "npx miqro <command> [args]", console);
|
package/dist/utils/index.js
CHANGED
|
@@ -82,12 +82,12 @@ const mainCMD = (cmds, usage, logger, cmdArg = process.argv[2], exit = true) =>
|
|
|
82
82
|
logger.info(`Available commands:\n`);
|
|
83
83
|
for (const cmd of Object.keys(cmds)) {
|
|
84
84
|
if (cmds[cmd].section) {
|
|
85
|
-
logger.info(`\n
|
|
85
|
+
logger.info(`\n==${cmds[cmd].section}==\n`);
|
|
86
86
|
}
|
|
87
87
|
//const description = cmds[cmd].description.split("\n").map(s => `${getTabs(/*cmds[cmd].tabs*/2)}${s}`).join("\n");
|
|
88
88
|
//const description = cmds[cmd].description.split("\n").map(s => `${getTabs(/*cmds[cmd].tabs*/1)}${s}`).join("\n");
|
|
89
89
|
const description = cmds[cmd].description.split("\n").map(s => `${getTabs(cmds[cmd].tabs)}${s}`).join("\n");
|
|
90
|
-
logger.info(
|
|
90
|
+
logger.info(`${cmd}${description}`);
|
|
91
91
|
//logger.info(`${cmd}\n${description}`);
|
|
92
92
|
}
|
|
93
93
|
logger.info("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miqro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "claukers",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@miqro/core": "^1.
|
|
20
|
+
"@miqro/core": "^1.7.0",
|
|
21
21
|
"@miqro/parser": "^0.1.5",
|
|
22
22
|
"@miqro/runner": "^1.2.8",
|
|
23
23
|
"@miqro/test": "^0.2.4",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main = exports.usage = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const util_1 = require("util");
|
|
7
|
-
function recursiveSearch(path, found = []) {
|
|
8
|
-
const files = (0, fs_1.readdirSync)(path);
|
|
9
|
-
for (const file of files) {
|
|
10
|
-
const filePath = (0, path_1.resolve)(path, file);
|
|
11
|
-
if ((0, fs_1.statSync)(filePath).isDirectory()) {
|
|
12
|
-
recursiveSearch(filePath, found);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const ext = (0, path_1.extname)(filePath);
|
|
16
|
-
if (ext === ".html" || ext === ".htm") {
|
|
17
|
-
found.push(filePath);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return found;
|
|
22
|
-
}
|
|
23
|
-
exports.usage = "npx miqro generate:template:cache <src> <out.json>";
|
|
24
|
-
const main = async () => {
|
|
25
|
-
if (process.argv.length !== 5 || process.argv[3].length < 1 || process.argv[4].length < 1) {
|
|
26
|
-
throw new Error(exports.usage);
|
|
27
|
-
}
|
|
28
|
-
const directory = process.argv[3].toLocaleLowerCase();
|
|
29
|
-
const outfile = process.argv[4].toLocaleLowerCase();
|
|
30
|
-
const path = (0, path_1.resolve)(process.cwd(), directory);
|
|
31
|
-
const outFilePath = (0, path_1.resolve)(process.cwd(), outfile);
|
|
32
|
-
if (!(0, fs_1.statSync)(path).isDirectory()) {
|
|
33
|
-
throw new Error((0, util_1.format)("%s not a directory", path));
|
|
34
|
-
}
|
|
35
|
-
const foundTemplates = recursiveSearch(path);
|
|
36
|
-
console.log("caching %o", foundTemplates);
|
|
37
|
-
console.log("to %s", outFilePath);
|
|
38
|
-
const cache = {};
|
|
39
|
-
for (const template of foundTemplates) {
|
|
40
|
-
if (template) {
|
|
41
|
-
const url = (0, path_1.relative)(path, template);
|
|
42
|
-
cache[url] = (0, fs_1.readFileSync)(template).toString("utf-8");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
(0, fs_1.writeFileSync)(outFilePath, `${JSON.stringify(cache, undefined, 0)}`);
|
|
46
|
-
};
|
|
47
|
-
exports.main = main;
|
package/dist/cmds/wc-new.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const usageJS = "usage: npx miqro new:front <identifier ex: NEW_APP>";
|
|
2
|
-
export declare const usageTS = "usage: npx miqro new:front:typescript <identifier ex: NEW_APP>";
|
|
3
|
-
export declare const mainJS: (typescript?: boolean) => void;
|
|
4
|
-
export declare const mainTS: () => void;
|
package/dist/cmds/wc-new.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mainTS = exports.mainJS = exports.usageTS = exports.usageJS = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
const indexHTML = {
|
|
8
|
-
js: () => `<html>` +
|
|
9
|
-
`<script type="text/javascript" src="app.bundle.min.js"></script>` +
|
|
10
|
-
`<body>` +
|
|
11
|
-
`<my-app></my-app>` +
|
|
12
|
-
`</body>` +
|
|
13
|
-
`</html>`
|
|
14
|
-
};
|
|
15
|
-
const indexComponent = {
|
|
16
|
-
js: () => `const {define} = require("@miqro/web-components")\n` +
|
|
17
|
-
`\n` +
|
|
18
|
-
`define("my-app", function() {\n` +
|
|
19
|
-
` return "<p>Hello World!</p>";\n` +
|
|
20
|
-
`});`,
|
|
21
|
-
ts: () => `import {define, RenderFunctionThis} from "@miqro/web-components"\n` +
|
|
22
|
-
`\n` +
|
|
23
|
-
`define("my-app", function(this: RenderFunctionThis) {\n` +
|
|
24
|
-
` return "<p>Hello World!</p>";\n` +
|
|
25
|
-
`});`
|
|
26
|
-
};
|
|
27
|
-
const webpackconfig = {
|
|
28
|
-
js: () => `module.exports = {\n` +
|
|
29
|
-
` mode: "production",\n` +
|
|
30
|
-
` entry: "./src/index.js",\n` +
|
|
31
|
-
` output: {\n` +
|
|
32
|
-
` path: require("path").resolve(__dirname, 'build'),\n` +
|
|
33
|
-
` filename: "app.bundle.min.js"\n` +
|
|
34
|
-
` }\n` +
|
|
35
|
-
`};`,
|
|
36
|
-
ts: () => `module.exports = {\n` +
|
|
37
|
-
` mode: "production",\n` +
|
|
38
|
-
` entry: "./dist/index.js",\n` +
|
|
39
|
-
` output: {\n` +
|
|
40
|
-
` path: require("path").resolve(__dirname, 'build'),\n` +
|
|
41
|
-
` filename: "app.bundle.min.js"\n` +
|
|
42
|
-
` }\n` +
|
|
43
|
-
`};`,
|
|
44
|
-
};
|
|
45
|
-
const gitignoreTemplate = {
|
|
46
|
-
ts: () => `node_modules/
|
|
47
|
-
dist/
|
|
48
|
-
`,
|
|
49
|
-
js: () => `node_modules/`
|
|
50
|
-
};
|
|
51
|
-
const packageTemplate = {
|
|
52
|
-
ts: (name) => `{
|
|
53
|
-
"name": "${name}",
|
|
54
|
-
"version": "1.0.0",
|
|
55
|
-
"description": "",
|
|
56
|
-
"private": true,
|
|
57
|
-
"main": "dist/main.js",
|
|
58
|
-
"scripts": {
|
|
59
|
-
"prebuild": "rm -Rf build/; rm -Rf dist/; mkdir build && cp -R public/ build/",
|
|
60
|
-
"build": "tsc && webpack",
|
|
61
|
-
"prestart": "npm run build",
|
|
62
|
-
"start": "npx miqro serve build/ /"
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
},
|
|
66
|
-
"dependencies": {
|
|
67
|
-
},
|
|
68
|
-
"author": "",
|
|
69
|
-
"license": "ISC"
|
|
70
|
-
}`,
|
|
71
|
-
js: (name) => `{
|
|
72
|
-
"name": "${name}",
|
|
73
|
-
"version": "1.0.0",
|
|
74
|
-
"description": "",
|
|
75
|
-
"private": true,
|
|
76
|
-
"main": "src/main.js",
|
|
77
|
-
"scripts": {
|
|
78
|
-
"prebuild": "rm -Rf build/; rm -Rf dist/; mkdir build && cp -R public/ build/",
|
|
79
|
-
"build": "webpack",
|
|
80
|
-
"prestart": "npm run build",
|
|
81
|
-
"start": "npx miqro serve build/ /"
|
|
82
|
-
},
|
|
83
|
-
"devDependencies": {
|
|
84
|
-
},
|
|
85
|
-
"dependencies": {
|
|
86
|
-
},
|
|
87
|
-
"author": "",
|
|
88
|
-
"license": "ISC"
|
|
89
|
-
}`
|
|
90
|
-
};
|
|
91
|
-
exports.usageJS = `usage: npx miqro new:front <identifier ex: NEW_APP>`;
|
|
92
|
-
exports.usageTS = `usage: npx miqro new:front:typescript <identifier ex: NEW_APP>`;
|
|
93
|
-
const mainJS = (typescript = false) => {
|
|
94
|
-
if (process.argv.length !== 4 || process.argv[3].length < 1) {
|
|
95
|
-
throw new Error(typescript ? exports.usageTS : exports.usageJS);
|
|
96
|
-
}
|
|
97
|
-
const identifier = process.argv[3].toLocaleLowerCase();
|
|
98
|
-
const appFolder = (0, path_1.resolve)(process.cwd(), identifier);
|
|
99
|
-
if ((0, fs_1.existsSync)(appFolder)) {
|
|
100
|
-
throw new Error(`${appFolder} already exists!`);
|
|
101
|
-
}
|
|
102
|
-
console.log(`creating ${appFolder}`);
|
|
103
|
-
(0, fs_1.mkdirSync)(appFolder, {
|
|
104
|
-
recursive: true
|
|
105
|
-
});
|
|
106
|
-
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, "package.json"), packageTemplate[typescript ? "ts" : "js"](identifier));
|
|
107
|
-
(0, utils_1.execSync)(`npm install miqro --save-dev`, {
|
|
108
|
-
cwd: appFolder
|
|
109
|
-
});
|
|
110
|
-
(0, utils_1.execSync)(`npm install @miqro/web-components --save`, {
|
|
111
|
-
cwd: appFolder
|
|
112
|
-
});
|
|
113
|
-
if (typescript) {
|
|
114
|
-
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, "tsconfig.json"), `{
|
|
115
|
-
"compileOnSave": true,
|
|
116
|
-
"compilerOptions": {
|
|
117
|
-
"lib": ["es2021", "dom"],
|
|
118
|
-
"module": "commonjs",
|
|
119
|
-
"moduleResolution": "node",
|
|
120
|
-
"target": "es2021",
|
|
121
|
-
"strict": false,
|
|
122
|
-
"outDir": "./dist/",
|
|
123
|
-
"removeComments": true,
|
|
124
|
-
"noImplicitAny": false,
|
|
125
|
-
"preserveConstEnums": true,
|
|
126
|
-
"sourceMap": true,
|
|
127
|
-
"esModuleInterop": true,
|
|
128
|
-
"declaration": true
|
|
129
|
-
},
|
|
130
|
-
"exclude": [
|
|
131
|
-
"node_modules",
|
|
132
|
-
"test"
|
|
133
|
-
],
|
|
134
|
-
"include": [
|
|
135
|
-
"src"
|
|
136
|
-
]
|
|
137
|
-
}`);
|
|
138
|
-
(0, utils_1.execSync)(`npm install typescript --save-dev`, {
|
|
139
|
-
cwd: appFolder
|
|
140
|
-
});
|
|
141
|
-
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, ".gitignore"), gitignoreTemplate.ts());
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, ".gitignore"), gitignoreTemplate.js());
|
|
145
|
-
}
|
|
146
|
-
(0, utils_1.execSync)(`npm install webpack-cli --save-dev`, {
|
|
147
|
-
cwd: appFolder
|
|
148
|
-
});
|
|
149
|
-
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, "webpack.config.js"), typescript ? webpackconfig.ts() : webpackconfig.js());
|
|
150
|
-
(0, fs_1.mkdirSync)((0, path_1.resolve)(appFolder, "src"));
|
|
151
|
-
(0, fs_1.mkdirSync)((0, path_1.resolve)(appFolder, "public"));
|
|
152
|
-
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, "public", "index.html"), indexHTML.js());
|
|
153
|
-
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, "src", "index" + (typescript ? ".ts" : ".js")), typescript ? indexComponent.ts() : indexComponent.js());
|
|
154
|
-
console.log(`new project created on ${appFolder}`);
|
|
155
|
-
console.log(`cd ${identifier}`);
|
|
156
|
-
console.log(`npm run start`);
|
|
157
|
-
};
|
|
158
|
-
exports.mainJS = mainJS;
|
|
159
|
-
const mainTS = () => (0, exports.mainJS)(true);
|
|
160
|
-
exports.mainTS = mainTS;
|
package/dist/utils/xml.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const parseXML2JSON: (val: string) => Promise<any>;
|
package/dist/utils/xml.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseXML2JSON = void 0;
|
|
4
|
-
const { parser } = require("sax");
|
|
5
|
-
const parseXML2JSON = async (val) => {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
const ret = {
|
|
8
|
-
name: "ROOT",
|
|
9
|
-
attributes: {},
|
|
10
|
-
type: "root",
|
|
11
|
-
isSelfClosing: false,
|
|
12
|
-
text: "",
|
|
13
|
-
children: []
|
|
14
|
-
};
|
|
15
|
-
let current = {
|
|
16
|
-
ref: ret
|
|
17
|
-
};
|
|
18
|
-
const p = parser(undefined, {
|
|
19
|
-
noscript: true,
|
|
20
|
-
trim: true
|
|
21
|
-
});
|
|
22
|
-
p.onerror = (e) => {
|
|
23
|
-
// an error happened.
|
|
24
|
-
console.error(e);
|
|
25
|
-
};
|
|
26
|
-
p.oncomment = (c) => {
|
|
27
|
-
if (!current) {
|
|
28
|
-
console.error("current null");
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
const node = {
|
|
32
|
-
name: "COMMENT",
|
|
33
|
-
attributes: {},
|
|
34
|
-
type: "comment",
|
|
35
|
-
isSelfClosing: true,
|
|
36
|
-
text: c,
|
|
37
|
-
children: []
|
|
38
|
-
};
|
|
39
|
-
current.ref.children.push(node);
|
|
40
|
-
};
|
|
41
|
-
p.ontext = (t) => {
|
|
42
|
-
if (!current) {
|
|
43
|
-
console.error("current null");
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
const node = {
|
|
47
|
-
name: "TEXT",
|
|
48
|
-
attributes: {},
|
|
49
|
-
type: "text",
|
|
50
|
-
isSelfClosing: true,
|
|
51
|
-
text: t,
|
|
52
|
-
children: []
|
|
53
|
-
};
|
|
54
|
-
current.ref.children.push(node);
|
|
55
|
-
};
|
|
56
|
-
p.onopentag = (node) => {
|
|
57
|
-
// opened a tag. node has "name" and "attributes"
|
|
58
|
-
/*if (node.name.toLocaleLowerCase() === "bpmn:sequenceflow") {
|
|
59
|
-
console.log("open %o", node);
|
|
60
|
-
}*/
|
|
61
|
-
if (!current) {
|
|
62
|
-
console.error("current null");
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
node.type = "node";
|
|
66
|
-
node.text = "";
|
|
67
|
-
node.children = [];
|
|
68
|
-
current.ref.children.push(node);
|
|
69
|
-
current = {
|
|
70
|
-
parent: current,
|
|
71
|
-
ref: node
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
p.onattribute = (attr) => {
|
|
75
|
-
// console.dir(attr);
|
|
76
|
-
};
|
|
77
|
-
p.onclosetag = (node) => {
|
|
78
|
-
// opened a tag. node has "name" and "attributes"
|
|
79
|
-
// console.log("close %s", node);
|
|
80
|
-
if (!current) {
|
|
81
|
-
console.error("current null");
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
current = current.parent ? current.parent : {
|
|
85
|
-
ref: ret
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
p.onend = () => {
|
|
89
|
-
// console.log("end");
|
|
90
|
-
// parser stream is done, and ready to have more stuff written to it.
|
|
91
|
-
resolve(ret);
|
|
92
|
-
};
|
|
93
|
-
p.write(val).close();
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
exports.parseXML2JSON = parseXML2JSON;
|