@vc-shell/create-vc-app 1.2.4-beta.8 → 2.0.0-alpha.1
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 +44 -74
- package/dist/commands/add-module.d.ts +2 -0
- package/dist/commands/add-module.d.ts.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/engine/codegen.d.ts +9 -0
- package/dist/engine/codegen.d.ts.map +1 -0
- package/dist/engine/helpers.d.ts +19 -0
- package/dist/engine/helpers.d.ts.map +1 -0
- package/dist/engine/template.d.ts +21 -0
- package/dist/engine/template.d.ts.map +1 -0
- package/dist/index.js +355 -526
- package/dist/output.d.ts +4 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/templates/dynamic-module/_gitignore +4 -0
- package/dist/templates/dynamic-module/_package.json.ejs +26 -0
- package/dist/templates/dynamic-module/src/modules/index.ts.ejs +5 -0
- package/dist/templates/dynamic-module/tsconfig.json +14 -0
- package/dist/templates/dynamic-module/vite.config.mts.ejs +3 -0
- package/dist/templates/{base/_env → host-app/_env.ejs} +1 -1
- package/dist/templates/{base/_package.json → host-app/_package.json.ejs} +7 -7
- package/dist/templates/{base/index.html → host-app/index.html.ejs} +1 -1
- package/dist/templates/{base/src/bootstrap.ts → host-app/src/bootstrap.ts.ejs} +6 -3
- package/dist/templates/{base/src/main.ts → host-app/src/main.ts.ejs} +7 -5
- package/dist/templates/{base/src/pages/App.vue → host-app/src/pages/App.vue.ejs} +1 -1
- package/dist/templates/host-app/src/pages/Platform.vue +19 -0
- package/dist/templates/host-app/src/router/routes.ts.ejs +107 -0
- package/dist/templates/host-app/vite.config.mts.ejs +7 -0
- package/dist/templates/module/composables/index.ts.ejs +2 -0
- package/dist/templates/module/composables/useDetails.ts.ejs +38 -0
- package/dist/templates/module/composables/useList.ts.ejs +43 -0
- package/dist/templates/module/locales/en.json.ejs +22 -0
- package/dist/templates/module/pages/details.vue.ejs +111 -0
- package/dist/templates/module/pages/index.ts.ejs +2 -0
- package/dist/templates/module/pages/list.vue.ejs +117 -0
- package/dist/templates/{sample/classic-module → sample-module}/pages/details.vue +2 -2
- package/dist/templates/{sample/classic-module → sample-module}/pages/list.vue +3 -3
- package/dist/templates/standalone/LICENSE +12 -0
- package/dist/templates/standalone/README.md +54 -0
- package/dist/templates/standalone/_browserslistrc +3 -0
- package/dist/templates/standalone/_commitlintrc.json +3 -0
- package/dist/templates/standalone/_editorconfig +22 -0
- package/dist/templates/standalone/_env.ejs +3 -0
- package/dist/templates/standalone/_env.local.ejs +1 -0
- package/dist/templates/standalone/_eslintignore +3 -0
- package/dist/templates/standalone/_eslintrc.js +41 -0
- package/dist/templates/standalone/_github/COMMIT_CONVENTION.md +91 -0
- package/dist/templates/standalone/_github/PULL_REQUEST_TEMPLATE.md +8 -0
- package/dist/templates/standalone/_gitignore +71 -0
- package/dist/templates/standalone/_package.json.ejs +0 -0
- package/dist/templates/standalone/_prettierignore +4 -0
- package/dist/templates/standalone/_prettierrc +4 -0
- package/dist/templates/standalone/_vscode/extensions.json +14 -0
- package/dist/templates/standalone/_vscode/settings.json +14 -0
- package/dist/templates/standalone/_yarn/releases/yarn-4.9.1.cjs +948 -0
- package/dist/templates/standalone/_yarnrc.yml +7 -0
- package/dist/templates/standalone/index.html.ejs +26 -0
- package/dist/templates/standalone/postcss.config.cjs +6 -0
- package/dist/templates/standalone/public/assets/1.jpeg +0 -0
- package/dist/templates/standalone/public/assets/2.jpg +0 -0
- package/dist/templates/standalone/public/assets/3.jpg +0 -0
- package/dist/templates/standalone/public/assets/app-select.svg +11 -0
- package/dist/templates/standalone/public/assets/avatar.jpg +0 -0
- package/dist/templates/standalone/public/assets/background.jpg +0 -0
- package/dist/templates/standalone/public/assets/empty.png +0 -0
- package/dist/templates/standalone/public/assets/logo-white.svg +21 -0
- package/dist/templates/standalone/public/assets/logo.svg +8 -0
- package/dist/templates/standalone/public/assets/welcome.png +0 -0
- package/dist/templates/standalone/public/img/icons/apple-touch-icon.png +0 -0
- package/dist/templates/standalone/public/img/icons/favicon-16x16.png +0 -0
- package/dist/templates/standalone/public/img/icons/favicon-32x32.png +0 -0
- package/dist/templates/standalone/public/img/icons/favicon.ico +0 -0
- package/dist/templates/standalone/public/img/icons/mstile-150x150.png +0 -0
- package/dist/templates/standalone/public/img/icons/safari-pinned-tab.svg +32 -0
- package/dist/templates/standalone/src/api_client/README.md +199 -0
- package/dist/templates/standalone/src/bootstrap.ts.ejs +26 -0
- package/dist/templates/standalone/src/components/dashboard-widgets/Welcome.vue +51 -0
- package/dist/templates/standalone/src/composables/index.ts +1 -0
- package/dist/templates/standalone/src/env.d.ts +9 -0
- package/dist/templates/standalone/src/locales/en.json +16 -0
- package/dist/templates/standalone/src/locales/index.ts +2 -0
- package/dist/templates/{sample/overrides/main.ts → standalone/src/main.ts.ejs} +22 -9
- package/dist/templates/standalone/src/pages/App.vue.ejs +38 -0
- package/dist/templates/standalone/src/pages/Dashboard.vue.ejs +7 -0
- package/dist/templates/standalone/src/router/index.ts +10 -0
- package/dist/templates/{base/src/router/routes.ts → standalone/src/router/routes.ts.ejs} +27 -7
- package/dist/templates/standalone/src/shims-vue.d.ts +27 -0
- package/dist/templates/standalone/src/styles/custom.scss +116 -0
- package/dist/templates/standalone/src/styles/index.scss +8 -0
- package/dist/templates/standalone/src/vue-i18n.d.ts +10 -0
- package/dist/templates/standalone/tailwind.config.ts +7 -0
- package/dist/templates/standalone/tsconfig.json +16 -0
- package/dist/templates/standalone/yarn.lock +0 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +7 -4
- package/dist/templates/modules/classic-module/composables/index.ts +0 -2
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +0 -24
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +0 -47
- package/dist/templates/modules/classic-module/locales/en.json +0 -37
- package/dist/templates/modules/classic-module/pages/details.vue +0 -87
- package/dist/templates/modules/classic-module/pages/list.vue +0 -257
- package/dist/templates/sample/classic-module/pages/index.ts +0 -2
- /package/dist/templates/{base → host-app}/LICENSE +0 -0
- /package/dist/templates/{base → host-app}/README.md +0 -0
- /package/dist/templates/{base → host-app}/_browserslistrc +0 -0
- /package/dist/templates/{base → host-app}/_commitlintrc.json +0 -0
- /package/dist/templates/{base → host-app}/_editorconfig +0 -0
- /package/dist/templates/{base/_env.local → host-app/_env.local.ejs} +0 -0
- /package/dist/templates/{base → host-app}/_eslintignore +0 -0
- /package/dist/templates/{base → host-app}/_eslintrc.js +0 -0
- /package/dist/templates/{base → host-app}/_github/COMMIT_CONVENTION.md +0 -0
- /package/dist/templates/{base → host-app}/_github/PULL_REQUEST_TEMPLATE.md +0 -0
- /package/dist/templates/{base → host-app}/_gitignore +0 -0
- /package/dist/templates/{base → host-app}/_prettierignore +0 -0
- /package/dist/templates/{base → host-app}/_prettierrc +0 -0
- /package/dist/templates/{base → host-app}/_vscode/extensions.json +0 -0
- /package/dist/templates/{base → host-app}/_vscode/settings.json +0 -0
- /package/dist/templates/{base → host-app}/_yarn/releases/yarn-4.9.1.cjs +0 -0
- /package/dist/templates/{base → host-app}/_yarnrc.yml +0 -0
- /package/dist/templates/{base → host-app}/postcss.config.cjs +0 -0
- /package/dist/templates/{base → host-app}/public/assets/1.jpeg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/2.jpg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/3.jpg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/app-select.svg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/avatar.jpg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/background.jpg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/empty.png +0 -0
- /package/dist/templates/{base → host-app}/public/assets/logo-white.svg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/logo.svg +0 -0
- /package/dist/templates/{base → host-app}/public/assets/welcome.png +0 -0
- /package/dist/templates/{base → host-app}/public/img/icons/apple-touch-icon.png +0 -0
- /package/dist/templates/{base → host-app}/public/img/icons/favicon-16x16.png +0 -0
- /package/dist/templates/{base → host-app}/public/img/icons/favicon-32x32.png +0 -0
- /package/dist/templates/{base → host-app}/public/img/icons/favicon.ico +0 -0
- /package/dist/templates/{base → host-app}/public/img/icons/mstile-150x150.png +0 -0
- /package/dist/templates/{base → host-app}/public/img/icons/safari-pinned-tab.svg +0 -0
- /package/dist/templates/{base → host-app}/src/api_client/README.md +0 -0
- /package/dist/templates/{base → host-app}/src/components/dashboard-widgets/Welcome.vue +0 -0
- /package/dist/templates/{base → host-app}/src/composables/index.ts +0 -0
- /package/dist/templates/{base → host-app}/src/env.d.ts +0 -0
- /package/dist/templates/{base → host-app}/src/locales/en.json +0 -0
- /package/dist/templates/{base → host-app}/src/locales/index.ts +0 -0
- /package/dist/templates/{base/src/pages/Dashboard.vue → host-app/src/pages/Dashboard.vue.ejs} +0 -0
- /package/dist/templates/{base → host-app}/src/router/index.ts +0 -0
- /package/dist/templates/{base → host-app}/src/shims-vue.d.ts +0 -0
- /package/dist/templates/{base → host-app}/src/styles/custom.scss +0 -0
- /package/dist/templates/{base → host-app}/src/styles/index.scss +0 -0
- /package/dist/templates/{base → host-app}/src/vue-i18n.d.ts +0 -0
- /package/dist/templates/{base → host-app}/tailwind.config.ts +0 -0
- /package/dist/templates/{base → host-app}/tsconfig.json +0 -0
- /package/dist/templates/{base → host-app}/yarn.lock +0 -0
- /package/dist/templates/{modules/classic-module/index.ts → module/index.ts.ejs} +0 -0
- /package/dist/templates/{modules/classic-module → module}/locales/index.ts +0 -0
- /package/dist/templates/{sample/classic-module → sample-module}/composables/index.ts +0 -0
- /package/dist/templates/{sample/classic-module → sample-module}/composables/useDetails/index.ts +0 -0
- /package/dist/templates/{sample/classic-module → sample-module}/composables/useList/index.ts +0 -0
- /package/dist/templates/{sample/classic-module → sample-module}/index.ts +0 -0
- /package/dist/templates/{sample/classic-module → sample-module}/locales/en.json +0 -0
- /package/dist/templates/{sample/classic-module → sample-module}/locales/index.ts +0 -0
- /package/dist/templates/{modules/classic-module → sample-module}/pages/index.ts +0 -0
- /package/dist/templates/{mocks → sample-module}/sample-data/constants.ts +0 -0
- /package/dist/templates/{mocks → sample-module}/sample-data/index.ts +0 -0
- /package/dist/templates/{mocks → sample-module}/sample-data/methods.ts +0 -0
- /package/dist/templates/{base/vite.config.mts → standalone/vite.config.mts.ejs} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,340 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import z from "mri";
|
|
3
|
+
import a from "picocolors";
|
|
4
|
+
import l from "node:path";
|
|
5
|
+
import { exit as U, argv as L } from "node:process";
|
|
6
|
+
import { fileURLToPath as B } from "node:url";
|
|
7
|
+
import A from "prompts";
|
|
8
|
+
import r from "node:fs";
|
|
9
|
+
import T from "ejs";
|
|
10
|
+
const F = "2.0.0-alpha.1", O = {
|
|
11
|
+
version: F
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var a = ze.call(e, $), r = e[$];
|
|
15
|
-
try {
|
|
16
|
-
e[$] = void 0;
|
|
17
|
-
var o = !0;
|
|
18
|
-
} catch {
|
|
19
|
-
}
|
|
20
|
-
var i = De.call(e);
|
|
21
|
-
return o && (a ? e[$] = r : delete e[$]), i;
|
|
22
|
-
}
|
|
23
|
-
var Ze = Object.prototype, Fe = Ze.toString;
|
|
24
|
-
function Ve(e) {
|
|
25
|
-
return Fe.call(e);
|
|
26
|
-
}
|
|
27
|
-
var He = "[object Null]", We = "[object Undefined]", Z = b ? b.toStringTag : void 0;
|
|
28
|
-
function Be(e) {
|
|
29
|
-
return e == null ? e === void 0 ? We : He : Z && Z in Object(e) ? Ie(e) : Ve(e);
|
|
30
|
-
}
|
|
31
|
-
function Je(e) {
|
|
32
|
-
return e != null && typeof e == "object";
|
|
33
|
-
}
|
|
34
|
-
var Ge = "[object Symbol]";
|
|
35
|
-
function Ye(e) {
|
|
36
|
-
return typeof e == "symbol" || Je(e) && Be(e) == Ge;
|
|
37
|
-
}
|
|
38
|
-
function qe(e, a) {
|
|
39
|
-
for (var r = -1, o = e == null ? 0 : e.length, i = Array(o); ++r < o; )
|
|
40
|
-
i[r] = a(e[r], r, e);
|
|
41
|
-
return i;
|
|
42
|
-
}
|
|
43
|
-
var Ke = Array.isArray, F = b ? b.prototype : void 0, V = F ? F.toString : void 0;
|
|
44
|
-
function Q(e) {
|
|
45
|
-
if (typeof e == "string")
|
|
46
|
-
return e;
|
|
47
|
-
if (Ke(e))
|
|
48
|
-
return qe(e, Q) + "";
|
|
49
|
-
if (Ye(e))
|
|
50
|
-
return V ? V.call(e) : "";
|
|
51
|
-
var a = e + "";
|
|
52
|
-
return a == "0" && 1 / e == -1 / 0 ? "-0" : a;
|
|
13
|
+
function f(e) {
|
|
14
|
+
return e.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase().replace(/[^a-z0-9-]/g, "");
|
|
53
15
|
}
|
|
54
|
-
function
|
|
55
|
-
return e
|
|
16
|
+
function x(e) {
|
|
17
|
+
return e.replace(/[-_\s]+(.)?/g, (n, t) => t ? t.toUpperCase() : "").replace(/^(.)/, (n, t) => t.toUpperCase());
|
|
56
18
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
for (var u = Array(i); ++o < i; )
|
|
61
|
-
u[o] = e[o + a];
|
|
62
|
-
return u;
|
|
19
|
+
function V(e) {
|
|
20
|
+
const n = x(e);
|
|
21
|
+
return n.charAt(0).toLowerCase() + n.slice(1);
|
|
63
22
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
return r = r === void 0 ? o : r, !a && r >= o ? e : Qe(e, a, r);
|
|
67
|
-
}
|
|
68
|
-
var ea = "\\ud800-\\udfff", aa = "\\u0300-\\u036f", ra = "\\ufe20-\\ufe2f", na = "\\u20d0-\\u20ff", oa = aa + ra + na, ta = "\\ufe0e\\ufe0f", ia = "\\u200d", sa = RegExp("[" + ia + ea + oa + ta + "]");
|
|
69
|
-
function X(e) {
|
|
70
|
-
return sa.test(e);
|
|
71
|
-
}
|
|
72
|
-
function ua(e) {
|
|
73
|
-
return e.split("");
|
|
74
|
-
}
|
|
75
|
-
var ee = "\\ud800-\\udfff", ca = "\\u0300-\\u036f", la = "\\ufe20-\\ufe2f", fa = "\\u20d0-\\u20ff", pa = ca + la + fa, ma = "\\ufe0e\\ufe0f", da = "[" + ee + "]", U = "[" + pa + "]", P = "\\ud83c[\\udffb-\\udfff]", ga = "(?:" + U + "|" + P + ")", ae = "[^" + ee + "]", re = "(?:\\ud83c[\\udde6-\\uddff]){2}", ne = "[\\ud800-\\udbff][\\udc00-\\udfff]", xa = "\\u200d", oe = ga + "?", te = "[" + ma + "]?", ba = "(?:" + xa + "(?:" + [ae, re, ne].join("|") + ")" + te + oe + ")*", va = te + oe + ba, ya = "(?:" + [ae + U + "?", U, re, ne, da].join("|") + ")", ha = RegExp(P + "(?=" + P + ")|" + ya + va, "g");
|
|
76
|
-
function $a(e) {
|
|
77
|
-
return e.match(ha) || [];
|
|
78
|
-
}
|
|
79
|
-
function Sa(e) {
|
|
80
|
-
return X(e) ? $a(e) : ua(e);
|
|
81
|
-
}
|
|
82
|
-
function ie(e) {
|
|
83
|
-
return function(a) {
|
|
84
|
-
a = R(a);
|
|
85
|
-
var r = X(a) ? Sa(a) : void 0, o = r ? r[0] : a.charAt(0), i = r ? Xe(r, 1).join("") : a.slice(1);
|
|
86
|
-
return o[e]() + i;
|
|
87
|
-
};
|
|
23
|
+
function P(e) {
|
|
24
|
+
return e.replace(/[-\s]+/g, "_").replace(/([a-z])([A-Z])/g, "$1_$2").toUpperCase();
|
|
88
25
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return L(R(e).toLowerCase());
|
|
26
|
+
function N(e) {
|
|
27
|
+
return e.replace(/[-_]+/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
|
|
92
28
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
r = a(r, e[i], i, e);
|
|
96
|
-
return r;
|
|
97
|
-
}
|
|
98
|
-
function wa(e) {
|
|
99
|
-
return function(a) {
|
|
100
|
-
return e?.[a];
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
var ja = {
|
|
104
|
-
// Latin-1 Supplement block.
|
|
105
|
-
À: "A",
|
|
106
|
-
Á: "A",
|
|
107
|
-
Â: "A",
|
|
108
|
-
Ã: "A",
|
|
109
|
-
Ä: "A",
|
|
110
|
-
Å: "A",
|
|
111
|
-
à: "a",
|
|
112
|
-
á: "a",
|
|
113
|
-
â: "a",
|
|
114
|
-
ã: "a",
|
|
115
|
-
ä: "a",
|
|
116
|
-
å: "a",
|
|
117
|
-
Ç: "C",
|
|
118
|
-
ç: "c",
|
|
119
|
-
Ð: "D",
|
|
120
|
-
ð: "d",
|
|
121
|
-
È: "E",
|
|
122
|
-
É: "E",
|
|
123
|
-
Ê: "E",
|
|
124
|
-
Ë: "E",
|
|
125
|
-
è: "e",
|
|
126
|
-
é: "e",
|
|
127
|
-
ê: "e",
|
|
128
|
-
ë: "e",
|
|
129
|
-
Ì: "I",
|
|
130
|
-
Í: "I",
|
|
131
|
-
Î: "I",
|
|
132
|
-
Ï: "I",
|
|
133
|
-
ì: "i",
|
|
134
|
-
í: "i",
|
|
135
|
-
î: "i",
|
|
136
|
-
ï: "i",
|
|
137
|
-
Ñ: "N",
|
|
138
|
-
ñ: "n",
|
|
139
|
-
Ò: "O",
|
|
140
|
-
Ó: "O",
|
|
141
|
-
Ô: "O",
|
|
142
|
-
Õ: "O",
|
|
143
|
-
Ö: "O",
|
|
144
|
-
Ø: "O",
|
|
145
|
-
ò: "o",
|
|
146
|
-
ó: "o",
|
|
147
|
-
ô: "o",
|
|
148
|
-
õ: "o",
|
|
149
|
-
ö: "o",
|
|
150
|
-
ø: "o",
|
|
151
|
-
Ù: "U",
|
|
152
|
-
Ú: "U",
|
|
153
|
-
Û: "U",
|
|
154
|
-
Ü: "U",
|
|
155
|
-
ù: "u",
|
|
156
|
-
ú: "u",
|
|
157
|
-
û: "u",
|
|
158
|
-
ü: "u",
|
|
159
|
-
Ý: "Y",
|
|
160
|
-
ý: "y",
|
|
161
|
-
ÿ: "y",
|
|
162
|
-
Æ: "Ae",
|
|
163
|
-
æ: "ae",
|
|
164
|
-
Þ: "Th",
|
|
165
|
-
þ: "th",
|
|
166
|
-
ß: "ss",
|
|
167
|
-
// Latin Extended-A block.
|
|
168
|
-
Ā: "A",
|
|
169
|
-
Ă: "A",
|
|
170
|
-
Ą: "A",
|
|
171
|
-
ā: "a",
|
|
172
|
-
ă: "a",
|
|
173
|
-
ą: "a",
|
|
174
|
-
Ć: "C",
|
|
175
|
-
Ĉ: "C",
|
|
176
|
-
Ċ: "C",
|
|
177
|
-
Č: "C",
|
|
178
|
-
ć: "c",
|
|
179
|
-
ĉ: "c",
|
|
180
|
-
ċ: "c",
|
|
181
|
-
č: "c",
|
|
182
|
-
Ď: "D",
|
|
183
|
-
Đ: "D",
|
|
184
|
-
ď: "d",
|
|
185
|
-
đ: "d",
|
|
186
|
-
Ē: "E",
|
|
187
|
-
Ĕ: "E",
|
|
188
|
-
Ė: "E",
|
|
189
|
-
Ę: "E",
|
|
190
|
-
Ě: "E",
|
|
191
|
-
ē: "e",
|
|
192
|
-
ĕ: "e",
|
|
193
|
-
ė: "e",
|
|
194
|
-
ę: "e",
|
|
195
|
-
ě: "e",
|
|
196
|
-
Ĝ: "G",
|
|
197
|
-
Ğ: "G",
|
|
198
|
-
Ġ: "G",
|
|
199
|
-
Ģ: "G",
|
|
200
|
-
ĝ: "g",
|
|
201
|
-
ğ: "g",
|
|
202
|
-
ġ: "g",
|
|
203
|
-
ģ: "g",
|
|
204
|
-
Ĥ: "H",
|
|
205
|
-
Ħ: "H",
|
|
206
|
-
ĥ: "h",
|
|
207
|
-
ħ: "h",
|
|
208
|
-
Ĩ: "I",
|
|
209
|
-
Ī: "I",
|
|
210
|
-
Ĭ: "I",
|
|
211
|
-
Į: "I",
|
|
212
|
-
İ: "I",
|
|
213
|
-
ĩ: "i",
|
|
214
|
-
ī: "i",
|
|
215
|
-
ĭ: "i",
|
|
216
|
-
į: "i",
|
|
217
|
-
ı: "i",
|
|
218
|
-
Ĵ: "J",
|
|
219
|
-
ĵ: "j",
|
|
220
|
-
Ķ: "K",
|
|
221
|
-
ķ: "k",
|
|
222
|
-
ĸ: "k",
|
|
223
|
-
Ĺ: "L",
|
|
224
|
-
Ļ: "L",
|
|
225
|
-
Ľ: "L",
|
|
226
|
-
Ŀ: "L",
|
|
227
|
-
Ł: "L",
|
|
228
|
-
ĺ: "l",
|
|
229
|
-
ļ: "l",
|
|
230
|
-
ľ: "l",
|
|
231
|
-
ŀ: "l",
|
|
232
|
-
ł: "l",
|
|
233
|
-
Ń: "N",
|
|
234
|
-
Ņ: "N",
|
|
235
|
-
Ň: "N",
|
|
236
|
-
Ŋ: "N",
|
|
237
|
-
ń: "n",
|
|
238
|
-
ņ: "n",
|
|
239
|
-
ň: "n",
|
|
240
|
-
ŋ: "n",
|
|
241
|
-
Ō: "O",
|
|
242
|
-
Ŏ: "O",
|
|
243
|
-
Ő: "O",
|
|
244
|
-
ō: "o",
|
|
245
|
-
ŏ: "o",
|
|
246
|
-
ő: "o",
|
|
247
|
-
Ŕ: "R",
|
|
248
|
-
Ŗ: "R",
|
|
249
|
-
Ř: "R",
|
|
250
|
-
ŕ: "r",
|
|
251
|
-
ŗ: "r",
|
|
252
|
-
ř: "r",
|
|
253
|
-
Ś: "S",
|
|
254
|
-
Ŝ: "S",
|
|
255
|
-
Ş: "S",
|
|
256
|
-
Š: "S",
|
|
257
|
-
ś: "s",
|
|
258
|
-
ŝ: "s",
|
|
259
|
-
ş: "s",
|
|
260
|
-
š: "s",
|
|
261
|
-
Ţ: "T",
|
|
262
|
-
Ť: "T",
|
|
263
|
-
Ŧ: "T",
|
|
264
|
-
ţ: "t",
|
|
265
|
-
ť: "t",
|
|
266
|
-
ŧ: "t",
|
|
267
|
-
Ũ: "U",
|
|
268
|
-
Ū: "U",
|
|
269
|
-
Ŭ: "U",
|
|
270
|
-
Ů: "U",
|
|
271
|
-
Ű: "U",
|
|
272
|
-
Ų: "U",
|
|
273
|
-
ũ: "u",
|
|
274
|
-
ū: "u",
|
|
275
|
-
ŭ: "u",
|
|
276
|
-
ů: "u",
|
|
277
|
-
ű: "u",
|
|
278
|
-
ų: "u",
|
|
279
|
-
Ŵ: "W",
|
|
280
|
-
ŵ: "w",
|
|
281
|
-
Ŷ: "Y",
|
|
282
|
-
ŷ: "y",
|
|
283
|
-
Ÿ: "Y",
|
|
284
|
-
Ź: "Z",
|
|
285
|
-
Ż: "Z",
|
|
286
|
-
Ž: "Z",
|
|
287
|
-
ź: "z",
|
|
288
|
-
ż: "z",
|
|
289
|
-
ž: "z",
|
|
290
|
-
IJ: "IJ",
|
|
291
|
-
ij: "ij",
|
|
292
|
-
Œ: "Oe",
|
|
293
|
-
œ: "oe",
|
|
294
|
-
ʼn: "'n",
|
|
295
|
-
ſ: "s"
|
|
296
|
-
}, Ra = wa(ja), Aa = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Na = "\\u0300-\\u036f", Oa = "\\ufe20-\\ufe2f", Ma = "\\u20d0-\\u20ff", Ea = Na + Oa + Ma, Ta = "[" + Ea + "]", Ua = RegExp(Ta, "g");
|
|
297
|
-
function Pa(e) {
|
|
298
|
-
return e = R(e), e && e.replace(Aa, Ra).replace(Ua, "");
|
|
299
|
-
}
|
|
300
|
-
var La = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
301
|
-
function _a(e) {
|
|
302
|
-
return e.match(La) || [];
|
|
303
|
-
}
|
|
304
|
-
var za = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
305
|
-
function Da(e) {
|
|
306
|
-
return za.test(e);
|
|
29
|
+
function k(e) {
|
|
30
|
+
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e);
|
|
307
31
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
ar + "+" + J + "(?=" + [H, x + W, "$"].join("|") + ")",
|
|
311
|
-
x + "?" + W + "+" + B,
|
|
312
|
-
x + "+" + J,
|
|
313
|
-
or,
|
|
314
|
-
nr,
|
|
315
|
-
me,
|
|
316
|
-
ir
|
|
317
|
-
].join("|"), "g");
|
|
318
|
-
function ur(e) {
|
|
319
|
-
return e.match(sr) || [];
|
|
32
|
+
function M(e) {
|
|
33
|
+
return e.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
|
|
320
34
|
}
|
|
321
|
-
function
|
|
322
|
-
return e
|
|
35
|
+
function C(e) {
|
|
36
|
+
return e.trim().toLowerCase().replace(/\/+/g, "/").replace(/[^a-z0-9/-]+/g, "/").replace(/\/?$/, "/");
|
|
323
37
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
38
|
+
function E(e) {
|
|
39
|
+
const n = e.moduleName, t = f(n), s = {
|
|
40
|
+
ModuleName: t,
|
|
41
|
+
ModuleNamePascalCase: x(n),
|
|
42
|
+
ModuleNameCamelCase: V(n),
|
|
43
|
+
ModuleNameUppercase: t.toUpperCase(),
|
|
44
|
+
ModuleNameScreamingSnake: P(n),
|
|
45
|
+
ModuleNameSentenceCase: N(n)
|
|
328
46
|
};
|
|
47
|
+
return e.projectName && (s.AppName = f(e.projectName), s.AppNameSentenceCase = N(e.projectName)), e.packageName !== void 0 && (s.PackageName = e.packageName || "", s.BasePath = e.basePath || "", s.tenantRoutes = e.tenantRoutes || !1, s.aiAgent = e.aiAgent || !1, s.dashboard = e.dashboard || !1, s.mocks = e.mocks || !1), s;
|
|
329
48
|
}
|
|
330
|
-
|
|
331
|
-
return a = a.toLowerCase(), e + (r ? Ca(a) : a);
|
|
332
|
-
}), pr = ie("toLowerCase"), mr = _(function(e, a, r) {
|
|
333
|
-
return e + (r ? "_" : "") + a.toLowerCase();
|
|
334
|
-
}), k = _(function(e, a, r) {
|
|
335
|
-
return e + (r ? " " : "") + L(a);
|
|
336
|
-
});
|
|
337
|
-
const dr = {
|
|
49
|
+
const Z = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".pdf", ".zip"]), H = {
|
|
338
50
|
_gitignore: ".gitignore",
|
|
339
51
|
"_yarnrc.yml": ".yarnrc.yml",
|
|
340
52
|
_browserslistrc: ".browserslistrc",
|
|
@@ -350,246 +62,363 @@ const dr = {
|
|
|
350
62
|
_vscode: ".vscode",
|
|
351
63
|
_yarn: ".yarn",
|
|
352
64
|
"_package.json": "package.json"
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
65
|
+
};
|
|
66
|
+
function J(e, n, t) {
|
|
67
|
+
n.endsWith(".ejs") && (n = n.slice(0, -4));
|
|
68
|
+
const s = l.dirname(n);
|
|
69
|
+
r.existsSync(s) || r.mkdirSync(s, { recursive: !0 });
|
|
70
|
+
const o = l.extname(e.replace(/\.ejs$/, "")).toLowerCase();
|
|
71
|
+
if (Z.has(o))
|
|
72
|
+
r.copyFileSync(e, n);
|
|
73
|
+
else {
|
|
74
|
+
const d = r.readFileSync(e, "utf-8"), p = T.render(d, t, { filename: e });
|
|
75
|
+
r.writeFileSync(n, p);
|
|
361
76
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
77
|
+
}
|
|
78
|
+
function j(e, n, t) {
|
|
79
|
+
if (!r.existsSync(e)) return;
|
|
80
|
+
const s = r.readdirSync(e);
|
|
81
|
+
for (const o of s) {
|
|
82
|
+
const d = l.join(e, o);
|
|
83
|
+
let p = o.endsWith(".ejs") ? o.slice(0, -4) : o, m = H[p] ?? p;
|
|
84
|
+
try {
|
|
85
|
+
m = T.render(m, t);
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
const c = l.join(n, m);
|
|
89
|
+
r.statSync(d).isDirectory() ? (r.existsSync(c) || r.mkdirSync(c, { recursive: !0 }), j(d, c, t)) : J(d, c, t);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function K(e) {
|
|
93
|
+
if (r.existsSync(e))
|
|
94
|
+
for (const n of r.readdirSync(e)) {
|
|
95
|
+
if (n === ".git") continue;
|
|
96
|
+
const t = l.join(e, n);
|
|
97
|
+
r.statSync(t).isDirectory() ? r.rmSync(t, { recursive: !0, force: !0 }) : r.unlinkSync(t);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function _(e) {
|
|
101
|
+
if (!r.existsSync(e)) return !0;
|
|
102
|
+
const n = r.readdirSync(e);
|
|
103
|
+
return n.length === 0 || n.length === 1 && n[0] === ".git";
|
|
104
|
+
}
|
|
105
|
+
const Y = {
|
|
106
|
+
standalone: "Standalone App",
|
|
107
|
+
"dynamic-module": "Dynamic Module",
|
|
108
|
+
"host-app": "Host App"
|
|
365
109
|
};
|
|
366
|
-
function
|
|
110
|
+
function q(e) {
|
|
111
|
+
const n = Y[e.projectType], t = e.projectType !== "host-app";
|
|
367
112
|
console.log(`
|
|
368
|
-
${
|
|
369
|
-
|
|
370
|
-
${
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
${
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
--module-name <name> Module name (defaults to app name in title case)
|
|
378
|
-
--base-path <path> Base path for the application [default: /apps/<app-name>/]
|
|
379
|
-
--mocks Include additional module with sample data
|
|
380
|
-
--overwrite Overwrite existing files without confirmation
|
|
381
|
-
--help, -h Show this help message
|
|
382
|
-
--version, -v Show version
|
|
113
|
+
${a.green("╭─────────────────────────────────────────╮")}
|
|
114
|
+
${a.green("│")} ${a.green("│")}
|
|
115
|
+
${a.green("│")} ${a.bold("VC Shell App created successfully!")} ${a.green("│")}
|
|
116
|
+
${a.green("│")} ${a.green("│")}
|
|
117
|
+
${a.green("│")} Project: ${a.cyan(e.projectName.padEnd(28))}${a.green("│")}
|
|
118
|
+
${a.green("│")} Type: ${a.cyan(n.padEnd(28))}${a.green("│")}
|
|
119
|
+
${t && e.moduleName ? ` ${a.green("│")} Module: ${a.cyan(e.moduleName.padEnd(28))}${a.green("│")}
|
|
120
|
+
` : ""} ${a.green("│")} ${a.green("│")}
|
|
121
|
+
${a.green("╰─────────────────────────────────────────╯")}
|
|
383
122
|
|
|
384
|
-
${
|
|
385
|
-
create-vc-app my-app
|
|
386
|
-
create-vc-app my-app --variant classic --mocks
|
|
387
|
-
create-vc-app my-app --module-name "My Module" --base-path "/custom/path/"
|
|
388
|
-
create-vc-app . --name existing-project --overwrite
|
|
389
|
-
|
|
390
|
-
${t.bold("Non-interactive mode:")}
|
|
391
|
-
create-vc-app my-app --variant classic --module-name "My Module" --mocks --overwrite
|
|
123
|
+
${a.bold("Next steps:")}
|
|
392
124
|
|
|
393
|
-
${
|
|
394
|
-
|
|
395
|
-
|
|
125
|
+
1. cd ${e.projectName}
|
|
126
|
+
2. yarn install
|
|
127
|
+
3. yarn serve
|
|
128
|
+
${t && e.moduleName ? `
|
|
129
|
+
Module is ready at:
|
|
130
|
+
src/modules/${W(e.moduleName)}/
|
|
131
|
+
` : ""}
|
|
132
|
+
${a.dim("Docs: https://docs.virtocommerce.org/platform/developer-guide/latest/custom-apps-development/vc-shell/vc-shell-overview/")}
|
|
396
133
|
`);
|
|
397
134
|
}
|
|
398
|
-
function
|
|
399
|
-
return
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
async function vr() {
|
|
435
|
-
const e = br();
|
|
436
|
-
if (e.help) {
|
|
437
|
-
gr();
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
if (e.version) {
|
|
441
|
-
console.log(`create-vc-app version ${I.version}`);
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
const a = xr(e);
|
|
445
|
-
a.valid || (console.error(t.red("Error:")), a.errors.forEach((n) => console.error(t.red(` ${n}`))), process.exit(1)), console.log(` ${t.bold(t.green(`
|
|
446
|
-
create-vc-app version: ${I.version}
|
|
447
|
-
`))}`);
|
|
448
|
-
const r = Me();
|
|
449
|
-
let o = e._[0] || e.name || e["app-name"];
|
|
450
|
-
const i = o || "vc-app", u = () => o === "." ? c.basename(c.resolve()) : o, $e = !!(o || e.name || e["app-name"]);
|
|
451
|
-
let l;
|
|
452
|
-
try {
|
|
453
|
-
if ($e && e.variant) {
|
|
454
|
-
o = o || e.name || e["app-name"] || i, o || (console.error(t.red("Project name is required")), process.exit(1)), s.existsSync(o) && !q(o) && !e.overwrite && (console.error(
|
|
455
|
-
t.red(`Target directory "${o}" is not empty. Use --overwrite to overwrite existing files.`)
|
|
456
|
-
), process.exit(1));
|
|
457
|
-
const n = u(), g = e["package-name"] || (w(n) ? n : p(n)), S = e["module-name"] || k(n), N = e["base-path"] || Y(`/apps/${p(n)}/`);
|
|
458
|
-
l = {
|
|
459
|
-
appName: p(o),
|
|
460
|
-
packageName: g,
|
|
461
|
-
variant: e.variant,
|
|
462
|
-
moduleName: S,
|
|
463
|
-
basePath: N,
|
|
464
|
-
mocks: e.mocks || !1
|
|
465
|
-
}, console.log(t.cyan("Creating app with the following configuration:")), console.log(t.cyan(` App name: ${l.appName}`)), console.log(t.cyan(` Package name: ${l.packageName}`)), console.log(t.cyan(` Variant: ${l.variant}`)), console.log(t.cyan(` Module name: ${l.moduleName}`)), console.log(t.cyan(` Base path: ${l.basePath}`)), console.log(t.cyan(` Mocks: ${l.mocks ? "Yes" : "No"}`)), console.log();
|
|
466
|
-
} else
|
|
467
|
-
l = await Ae(
|
|
135
|
+
function W(e) {
|
|
136
|
+
return e.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase().replace(/[^a-z0-9-]/g, "");
|
|
137
|
+
}
|
|
138
|
+
const X = [
|
|
139
|
+
{ title: "Standalone App — full application with bundled modules", value: "standalone" },
|
|
140
|
+
{ title: "Dynamic Module — remote module loaded by host via Module Federation", value: "dynamic-module" },
|
|
141
|
+
{ title: "Host App — shell application that loads dynamic modules", value: "host-app" }
|
|
142
|
+
];
|
|
143
|
+
async function G(e, n) {
|
|
144
|
+
const t = process.cwd();
|
|
145
|
+
let o = e._?.[0] || e.name || e["app-name"];
|
|
146
|
+
const d = o || "vc-app", p = () => o === "." ? l.basename(l.resolve()) : o, m = !!(o && e.type);
|
|
147
|
+
let c;
|
|
148
|
+
if (m) {
|
|
149
|
+
o = o || d;
|
|
150
|
+
const g = l.resolve(t, o);
|
|
151
|
+
r.existsSync(g) && !_(g) && !e.overwrite && (console.error(a.red(`Target directory "${o}" is not empty. Use --overwrite to overwrite.`)), process.exit(1));
|
|
152
|
+
const u = p(), h = e.type;
|
|
153
|
+
c = {
|
|
154
|
+
projectName: f(u),
|
|
155
|
+
packageName: e["package-name"] || (k(u) ? u : M(u)),
|
|
156
|
+
projectType: h,
|
|
157
|
+
moduleName: e["module-name"] || N(u),
|
|
158
|
+
basePath: e["base-path"] || C(`/apps/${f(u)}/`),
|
|
159
|
+
tenantRoutes: e["tenant-routes"] || !1,
|
|
160
|
+
aiAgent: e["ai-agent"] || !1,
|
|
161
|
+
dashboard: e.dashboard || !1,
|
|
162
|
+
mocks: e.mocks || !1
|
|
163
|
+
};
|
|
164
|
+
} else {
|
|
165
|
+
const g = () => {
|
|
166
|
+
throw new Error(a.red("✖") + " Creation cancelled");
|
|
167
|
+
};
|
|
168
|
+
try {
|
|
169
|
+
const u = await A(
|
|
468
170
|
[
|
|
469
171
|
{
|
|
470
|
-
name: "
|
|
172
|
+
name: "projectName",
|
|
471
173
|
type: o ? null : "text",
|
|
472
|
-
message:
|
|
473
|
-
initial:
|
|
474
|
-
onState: (
|
|
475
|
-
|
|
174
|
+
message: a.reset("Project name:"),
|
|
175
|
+
initial: d,
|
|
176
|
+
onState: (w) => {
|
|
177
|
+
o = f(String(w.value).trim()) || d;
|
|
178
|
+
},
|
|
179
|
+
format: (w) => f(String(w).trim())
|
|
476
180
|
},
|
|
477
181
|
{
|
|
478
|
-
type: () => !
|
|
182
|
+
type: () => !r.existsSync(l.resolve(t, o)) || _(l.resolve(t, o)) ? null : "confirm",
|
|
479
183
|
name: "overwrite",
|
|
480
184
|
message: () => (o === "." ? "Current directory" : `Target directory "${o}"`) + " is not empty. Remove existing files and continue?"
|
|
481
185
|
},
|
|
482
186
|
{
|
|
483
|
-
type: (
|
|
484
|
-
if (
|
|
485
|
-
throw new Error(
|
|
187
|
+
type: (w, { overwrite: R }) => {
|
|
188
|
+
if (R === !1)
|
|
189
|
+
throw new Error(a.red("✖") + " Operation cancelled");
|
|
486
190
|
return null;
|
|
487
191
|
},
|
|
488
192
|
name: "overwriteChecker"
|
|
489
193
|
},
|
|
490
194
|
{
|
|
491
195
|
name: "packageName",
|
|
492
|
-
type: () =>
|
|
493
|
-
message:
|
|
494
|
-
initial: () => p(
|
|
495
|
-
validate: (
|
|
196
|
+
type: () => k(p()) ? null : "text",
|
|
197
|
+
message: a.reset("Package name:"),
|
|
198
|
+
initial: () => M(p()),
|
|
199
|
+
validate: (w) => k(w) || "Invalid package.json name"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
type: "select",
|
|
203
|
+
name: "projectType",
|
|
204
|
+
message: a.reset("Project type:"),
|
|
205
|
+
choices: X
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
{ onCancel: g }
|
|
209
|
+
), h = o ? f(o) : u.projectName, v = u.projectType || "standalone", $ = N(h), S = "/apps/" + f(h) + "/", b = await A(
|
|
210
|
+
[
|
|
211
|
+
{
|
|
212
|
+
name: "moduleName",
|
|
213
|
+
type: v === "host-app" ? null : "text",
|
|
214
|
+
message: a.reset("Module name:"),
|
|
215
|
+
initial: $,
|
|
216
|
+
format: (w) => String(w).trim()
|
|
496
217
|
},
|
|
497
218
|
{
|
|
498
219
|
name: "basePath",
|
|
499
|
-
type: "text",
|
|
500
|
-
message:
|
|
501
|
-
initial:
|
|
502
|
-
format: (
|
|
220
|
+
type: v === "dynamic-module" ? null : "text",
|
|
221
|
+
message: a.reset("Base path:"),
|
|
222
|
+
initial: S,
|
|
223
|
+
format: (w) => C(String(w).trim())
|
|
503
224
|
},
|
|
504
225
|
{
|
|
505
|
-
type: "
|
|
506
|
-
name: "
|
|
507
|
-
message:
|
|
508
|
-
|
|
509
|
-
title: n.display,
|
|
510
|
-
value: n.name
|
|
511
|
-
}))
|
|
226
|
+
type: v === "dynamic-module" ? null : "confirm",
|
|
227
|
+
name: "tenantRoutes",
|
|
228
|
+
message: "Include tenant routing (/:tenantId prefix)?",
|
|
229
|
+
initial: !1
|
|
512
230
|
},
|
|
513
231
|
{
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
message:
|
|
517
|
-
initial:
|
|
518
|
-
|
|
232
|
+
type: v === "dynamic-module" ? null : "confirm",
|
|
233
|
+
name: "aiAgent",
|
|
234
|
+
message: "Include AI Agent configuration?",
|
|
235
|
+
initial: !1
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
type: v === "dynamic-module" ? null : "confirm",
|
|
239
|
+
name: "dashboard",
|
|
240
|
+
message: "Include Dashboard with widgets?",
|
|
241
|
+
initial: !0
|
|
519
242
|
},
|
|
520
243
|
{
|
|
521
244
|
name: "mocks",
|
|
522
|
-
type: "confirm",
|
|
523
|
-
message: "
|
|
245
|
+
type: v === "host-app" ? null : "confirm",
|
|
246
|
+
message: "Include sample module with mock data?",
|
|
524
247
|
initial: !1
|
|
525
248
|
}
|
|
526
249
|
],
|
|
527
|
-
{
|
|
528
|
-
onCancel: () => {
|
|
529
|
-
throw new Error(t.red("✖") + " Creation cancelled");
|
|
530
|
-
}
|
|
531
|
-
}
|
|
250
|
+
{ onCancel: g }
|
|
532
251
|
);
|
|
533
|
-
|
|
534
|
-
|
|
252
|
+
c = {
|
|
253
|
+
projectName: h,
|
|
254
|
+
packageName: u.packageName || (k(h) ? h : M(h)),
|
|
255
|
+
projectType: v,
|
|
256
|
+
moduleName: b.moduleName || $,
|
|
257
|
+
basePath: b.basePath || C(S),
|
|
258
|
+
tenantRoutes: b.tenantRoutes || !1,
|
|
259
|
+
aiAgent: b.aiAgent || !1,
|
|
260
|
+
dashboard: b.dashboard ?? !0,
|
|
261
|
+
mocks: b.mocks || !1
|
|
262
|
+
};
|
|
263
|
+
} catch (u) {
|
|
264
|
+
console.log(u.message), process.exit(1);
|
|
265
|
+
}
|
|
535
266
|
}
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
267
|
+
const i = l.resolve(t, o);
|
|
268
|
+
r.existsSync(i) && !_(i) ? K(i) : r.existsSync(i) || r.mkdirSync(i, { recursive: !0 }), console.log(`
|
|
269
|
+
Scaffolding ${a.cyan(c.projectType)} in ${a.green(i)}...
|
|
270
|
+
`);
|
|
271
|
+
const y = E(c);
|
|
272
|
+
if (j(l.join(n, c.projectType), i, y), c.projectType !== "host-app") {
|
|
273
|
+
const g = f(c.moduleName), u = c.projectType === "dynamic-module" ? l.join(i, "src/modules") : l.join(i, "src/modules", g);
|
|
274
|
+
j(l.join(n, "module"), u, y);
|
|
275
|
+
}
|
|
276
|
+
c.mocks && c.projectType !== "host-app" && j(l.join(n, "sample-module"), l.join(i, "src/modules/sample"), y), q(c);
|
|
277
|
+
}
|
|
278
|
+
function D(e, n) {
|
|
279
|
+
const t = /^import\s.+$/gm;
|
|
280
|
+
let s = null, o;
|
|
281
|
+
for (; (o = t.exec(e)) !== null; )
|
|
282
|
+
s = o;
|
|
283
|
+
if (s) {
|
|
284
|
+
const d = s.index + s[0].length;
|
|
285
|
+
return e.slice(0, d) + `
|
|
286
|
+
` + n + e.slice(d);
|
|
287
|
+
}
|
|
288
|
+
return n + `
|
|
289
|
+
` + e;
|
|
290
|
+
}
|
|
291
|
+
function Q(e, n) {
|
|
292
|
+
let t = r.readFileSync(e, "utf-8");
|
|
293
|
+
const s = x(n), o = f(n);
|
|
294
|
+
t = D(t, `import ${s} from "./modules/${o}";`);
|
|
295
|
+
const d = /\.use\([A-Z]\w+,\s*\{\s*router\s*\}\)/g;
|
|
296
|
+
let p = null, m;
|
|
297
|
+
for (; (m = d.exec(t)) !== null; )
|
|
298
|
+
p = m;
|
|
299
|
+
if (p) {
|
|
300
|
+
const c = p.index + p[0].length, i = `
|
|
301
|
+
.use(${s}, { router })`;
|
|
302
|
+
t = t.slice(0, c) + i + t.slice(c);
|
|
303
|
+
}
|
|
304
|
+
r.writeFileSync(e, t);
|
|
305
|
+
}
|
|
306
|
+
function ee(e, n) {
|
|
307
|
+
let t = r.readFileSync(e, "utf-8");
|
|
308
|
+
const s = f(n), o = P(n);
|
|
309
|
+
if (!t.includes("addMenuItem")) {
|
|
310
|
+
const y = /import\s*\{([^}]+)\}\s*from\s*["']@vc-shell\/framework["']/.exec(t);
|
|
311
|
+
if (y) {
|
|
312
|
+
const g = y[1].trim() + ", addMenuItem";
|
|
313
|
+
t = t.replace(y[0], `import { ${g} } from "@vc-shell/framework"`);
|
|
314
|
+
} else
|
|
315
|
+
t = D(t, 'import { addMenuItem } from "@vc-shell/framework";');
|
|
316
|
+
}
|
|
317
|
+
const d = /addMenuItem\(\{[\s\S]*?\}\);/g;
|
|
318
|
+
let p = null, m;
|
|
319
|
+
for (; (m = d.exec(t)) !== null; )
|
|
320
|
+
p = m;
|
|
321
|
+
const c = `
|
|
322
|
+
addMenuItem({
|
|
323
|
+
title: "${o}.MENU.TITLE",
|
|
324
|
+
icon: "lucide-box",
|
|
325
|
+
priority: 10,
|
|
326
|
+
url: "/${s}",
|
|
327
|
+
});`;
|
|
328
|
+
if (p) {
|
|
329
|
+
const i = p.index + p[0].length;
|
|
330
|
+
t = t.slice(0, i) + `
|
|
331
|
+
` + c + t.slice(i);
|
|
332
|
+
} else {
|
|
333
|
+
const i = t.lastIndexOf("}");
|
|
334
|
+
i !== -1 && (t = t.slice(0, i) + c + `
|
|
335
|
+
` + t.slice(i));
|
|
336
|
+
}
|
|
337
|
+
r.writeFileSync(e, t);
|
|
338
|
+
}
|
|
339
|
+
async function te(e, n) {
|
|
340
|
+
const t = process.cwd(), s = e._?.[1], o = l.join(t, "package.json");
|
|
341
|
+
r.existsSync(o) || (console.error(a.red("Error: No package.json found. Run this command from a vc-shell project root.")), process.exit(1));
|
|
342
|
+
const d = JSON.parse(r.readFileSync(o, "utf-8"));
|
|
343
|
+
({ ...d.dependencies, ...d.devDependencies })["@vc-shell/framework"] || (console.error(a.red("Error: Not a vc-shell project (@vc-shell/framework not found in dependencies).")), process.exit(1));
|
|
344
|
+
let m = s;
|
|
345
|
+
m || (m = (await A({
|
|
346
|
+
type: "text",
|
|
347
|
+
name: "moduleName",
|
|
348
|
+
message: "Module name:",
|
|
349
|
+
validate: (S) => S.trim().length > 0 || "Module name is required"
|
|
350
|
+
})).moduleName), m || (console.error(a.red("Module name is required.")), process.exit(1));
|
|
351
|
+
const c = f(m), i = x(m), y = l.join(t, "src/modules"), g = l.join(y, c);
|
|
352
|
+
r.existsSync(y) || r.mkdirSync(y, { recursive: !0 }), r.existsSync(g) && (console.error(a.red(`Error: Module "${c}" already exists at ${l.relative(t, g)}`)), process.exit(1));
|
|
353
|
+
const u = E({ moduleName: m, projectName: l.basename(t) });
|
|
354
|
+
j(l.join(n, "module"), g, u), console.log(a.green(` ✔ Created ${l.relative(t, g)}/`));
|
|
355
|
+
const h = l.join(t, "src/main.ts");
|
|
356
|
+
if (r.existsSync(h))
|
|
357
|
+
try {
|
|
358
|
+
Q(h, m), console.log(a.green(` ✔ Updated src/main.ts — added import & app.use(${i})`));
|
|
359
|
+
} catch {
|
|
360
|
+
console.warn(a.yellow(" ⚠ Could not auto-update src/main.ts. Add manually:")), console.warn(a.yellow(` import ${i} from "./modules/${c}";`)), console.warn(a.yellow(` app.use(${i}, { router });`));
|
|
361
|
+
}
|
|
362
|
+
const v = l.join(t, "src/bootstrap.ts");
|
|
363
|
+
if (r.existsSync(v))
|
|
364
|
+
try {
|
|
365
|
+
ee(v, m), console.log(a.green(` ✔ Updated src/bootstrap.ts — added menu item "${N(m)}"`));
|
|
366
|
+
} catch {
|
|
367
|
+
console.warn(a.yellow(" ⚠ Could not auto-update src/bootstrap.ts. Add addMenuItem() manually."));
|
|
575
368
|
}
|
|
369
|
+
console.log(`
|
|
370
|
+
Module "${c}" is ready! Run ${a.bold(a.green("yarn serve"))} to see it.
|
|
371
|
+
`);
|
|
372
|
+
}
|
|
373
|
+
const I = l.resolve(B(import.meta.url), "..", "templates");
|
|
374
|
+
function ae() {
|
|
375
|
+
console.log(`
|
|
376
|
+
${a.bold(a.green("create-vc-app"))} — Create VC Shell applications and modules
|
|
377
|
+
|
|
378
|
+
${a.bold("Usage:")}
|
|
379
|
+
create-vc-app [project-name] [options] Create a new project
|
|
380
|
+
create-vc-app add-module <module-name> Add a module to existing project
|
|
381
|
+
|
|
382
|
+
${a.bold("Options (create):")}
|
|
383
|
+
--type <type> Project type: standalone | dynamic-module | host-app
|
|
384
|
+
--name, --app-name <name> Application name
|
|
385
|
+
--package-name <name> npm package name
|
|
386
|
+
--module-name <name> Initial module name
|
|
387
|
+
--base-path <path> Base path [default: /apps/<name>/]
|
|
388
|
+
--tenant-routes Include tenant routing (/:tenantId prefix)
|
|
389
|
+
--ai-agent Include AI Agent configuration
|
|
390
|
+
--dashboard Include Dashboard with widgets
|
|
391
|
+
--mocks Include sample module with mock data
|
|
392
|
+
--overwrite Overwrite existing files
|
|
393
|
+
--help, -h Show this help
|
|
394
|
+
--version, -v Show version
|
|
395
|
+
|
|
396
|
+
${a.bold("Examples:")}
|
|
397
|
+
create-vc-app my-app
|
|
398
|
+
create-vc-app my-app --type standalone --dashboard --mocks
|
|
399
|
+
create-vc-app my-module --type dynamic-module --module-name "Reviews"
|
|
400
|
+
create-vc-app my-shell --type host-app --dashboard --tenant-routes
|
|
401
|
+
create-vc-app add-module orders
|
|
402
|
+
|
|
403
|
+
${a.bold("Docs:")} https://docs.virtocommerce.org/platform/developer-guide/latest/custom-apps-development/vc-shell/vc-shell-overview/
|
|
404
|
+
`);
|
|
405
|
+
}
|
|
406
|
+
async function ne() {
|
|
407
|
+
const e = z(L.slice(2), {
|
|
408
|
+
alias: { h: "help", v: "version" },
|
|
409
|
+
boolean: ["help", "version", "mocks", "overwrite", "tenant-routes", "ai-agent", "dashboard"],
|
|
410
|
+
string: ["type", "name", "app-name", "package-name", "module-name", "base-path"]
|
|
411
|
+
});
|
|
412
|
+
if (e.help) {
|
|
413
|
+
ae();
|
|
414
|
+
return;
|
|
576
415
|
}
|
|
577
|
-
if (
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
m(`sample/${n}`, "src/modules/sample");
|
|
581
|
-
}), v === "classic" && T[v].forEach((n) => {
|
|
582
|
-
m(`sample/${n}`, "src/modules/sample");
|
|
583
|
-
}), m("mocks", "src/modules/sample"), m("sample/overrides", "src")), console.log(`
|
|
584
|
-
Done. You can now run application:
|
|
585
|
-
`), f !== r) {
|
|
586
|
-
const n = c.relative(r, f);
|
|
587
|
-
console.log(
|
|
588
|
-
` ${t.bold(t.green(`cd ${n.includes(" ") ? `"${n}"` : n}`))}`
|
|
589
|
-
);
|
|
416
|
+
if (e.version) {
|
|
417
|
+
console.log(`create-vc-app v${O.version}`);
|
|
418
|
+
return;
|
|
590
419
|
}
|
|
591
|
-
|
|
420
|
+
e._[0] === "add-module" ? await te(e, I) : await G(e, I);
|
|
592
421
|
}
|
|
593
|
-
|
|
594
|
-
console.error(e);
|
|
422
|
+
ne().catch((e) => {
|
|
423
|
+
console.error(a.red(e.message || String(e))), U(1);
|
|
595
424
|
});
|