@vc-shell/create-vc-app 2.0.0-alpha.16 → 2.0.0-alpha.17

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.test.d.ts +2 -0
  4. package/dist/commands/init.test.d.ts.map +1 -0
  5. package/dist/engine/codegen.d.ts.map +1 -1
  6. package/dist/engine/helpers.d.ts +1 -1
  7. package/dist/engine/helpers.d.ts.map +1 -1
  8. package/dist/engine/helpers.test.d.ts +2 -0
  9. package/dist/engine/helpers.test.d.ts.map +1 -0
  10. package/dist/engine/template.d.ts.map +1 -1
  11. package/dist/engine/template.test.d.ts +2 -0
  12. package/dist/engine/template.test.d.ts.map +1 -0
  13. package/dist/index.js +169 -165
  14. package/dist/output.d.ts.map +1 -1
  15. package/dist/templates/dynamic-module/_package.json.ejs +6 -6
  16. package/dist/templates/dynamic-module/src/modules/index.ts.ejs +8 -5
  17. package/dist/templates/dynamic-module/tsconfig.json +1 -1
  18. package/dist/templates/host-app/_package.json.ejs +7 -9
  19. package/dist/templates/host-app/src/main.ts.ejs +17 -15
  20. package/dist/templates/host-app/tsconfig.json +1 -0
  21. package/dist/templates/module/composables/useDetails.ts.ejs +41 -38
  22. package/dist/templates/module/index.ts.ejs +11 -8
  23. package/dist/templates/module/locales/en.json.ejs +33 -22
  24. package/dist/templates/module/pages/details.vue.ejs +10 -12
  25. package/dist/templates/module/pages/list.vue.ejs +11 -13
  26. package/dist/templates/sample-module/index.ts +11 -8
  27. package/dist/templates/sample-module/pages/details.vue +8 -4
  28. package/dist/templates/sample-module/pages/list.vue +103 -119
  29. package/dist/templates/standalone/_package.json.ejs +7 -9
  30. package/dist/templates/standalone/src/bootstrap.ts.ejs +5 -5
  31. package/dist/templates/standalone/src/main.ts.ejs +29 -23
  32. package/dist/templates/standalone/tsconfig.json +1 -0
  33. package/dist/types.d.ts +2 -2
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +3 -2
  36. package/dist/templates/host-app/src/shims-vue.d.ts +0 -27
  37. package/dist/templates/host-app/src/vue-i18n.d.ts +0 -10
  38. package/dist/templates/standalone/src/shims-vue.d.ts +0 -27
  39. package/dist/templates/standalone/src/vue-i18n.d.ts +0 -10
package/dist/index.js CHANGED
@@ -1,52 +1,53 @@
1
1
  #!/usr/bin/env node
2
2
  import z from "mri";
3
- import a from "picocolors";
4
- import l from "node:path";
3
+ import t from "picocolors";
4
+ import c from "node:path";
5
5
  import { exit as U, argv as L } from "node:process";
6
6
  import { fileURLToPath as B } from "node:url";
7
7
  import A from "prompts";
8
8
  import r from "node:fs";
9
9
  import T from "ejs";
10
- const F = "2.0.0-alpha.16", O = {
10
+ const F = "2.0.0-alpha.17", O = {
11
11
  version: F
12
12
  };
13
- function f(e) {
13
+ function h(e) {
14
14
  return e.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase().replace(/[^a-z0-9-]/g, "");
15
15
  }
16
16
  function x(e) {
17
- return e.replace(/[-_\s]+(.)?/g, (n, t) => t ? t.toUpperCase() : "").replace(/^(.)/, (n, t) => t.toUpperCase());
17
+ return e.replace(/[-_\s]+(.)?/g, (n, a) => a ? a.toUpperCase() : "").replace(/^(.)/, (n, a) => a.toUpperCase());
18
18
  }
19
19
  function V(e) {
20
20
  const n = x(e);
21
21
  return n.charAt(0).toLowerCase() + n.slice(1);
22
22
  }
23
- function P(e) {
23
+ function E(e) {
24
24
  return e.replace(/[-\s]+/g, "_").replace(/([a-z])([A-Z])/g, "$1_$2").toUpperCase();
25
25
  }
26
- function N(e) {
26
+ function S(e) {
27
27
  return e.replace(/[-_]+/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
28
28
  }
29
29
  function k(e) {
30
30
  return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e);
31
31
  }
32
- function M(e) {
32
+ function C(e) {
33
33
  return e.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
34
34
  }
35
- function C(e) {
35
+ function _(e) {
36
36
  return e.trim().toLowerCase().replace(/\/+/g, "/").replace(/[^a-z0-9/-]+/g, "/").replace(/\/?$/, "/");
37
37
  }
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)
38
+ function D(e) {
39
+ const n = e.moduleName || "", a = n ? h(n) : "", s = {
40
+ hasModule: !!e.moduleName,
41
+ ModuleName: a,
42
+ ModuleNamePascalCase: n ? x(n) : "",
43
+ ModuleNameCamelCase: n ? V(n) : "",
44
+ ModuleNameUppercase: a.toUpperCase(),
45
+ ModuleNameScreamingSnake: n ? E(n) : "",
46
+ ModuleNameSentenceCase: n ? S(n) : ""
46
47
  };
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;
48
+ return e.projectName && (s.AppName = h(e.projectName), s.AppNameSentenceCase = S(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;
48
49
  }
49
- const Z = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".pdf", ".zip"]), H = {
50
+ const Z = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".pdf", ".zip"]), J = {
50
51
  _gitignore: ".gitignore",
51
52
  "_yarnrc.yml": ".yarnrc.yml",
52
53
  _browserslistrc: ".browserslistrc",
@@ -63,99 +64,97 @@ const Z = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ic
63
64
  _yarn: ".yarn",
64
65
  "_package.json": "package.json"
65
66
  };
66
- function J(e, n, t) {
67
+ function K(e, n, a) {
67
68
  n.endsWith(".ejs") && (n = n.slice(0, -4));
68
- const s = l.dirname(n);
69
+ const s = c.dirname(n);
69
70
  r.existsSync(s) || r.mkdirSync(s, { recursive: !0 });
70
- const o = l.extname(e.replace(/\.ejs$/, "")).toLowerCase();
71
+ const o = c.extname(e.replace(/\.ejs$/, "")).toLowerCase();
71
72
  if (Z.has(o))
72
73
  r.copyFileSync(e, n);
73
74
  else {
74
- const d = r.readFileSync(e, "utf-8"), p = T.render(d, t, { filename: e });
75
+ const d = r.readFileSync(e, "utf-8"), p = T.render(d, a, { filename: e });
75
76
  r.writeFileSync(n, p);
76
77
  }
77
78
  }
78
- function j(e, n, t) {
79
+ function b(e, n, a) {
79
80
  if (!r.existsSync(e)) return;
80
81
  const s = r.readdirSync(e);
81
82
  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;
83
+ const d = c.join(e, o), p = o.endsWith(".ejs") ? o.slice(0, -4) : o;
84
+ let m = J[p] ?? p;
84
85
  try {
85
- m = T.render(m, t);
86
+ m = T.render(m, a);
86
87
  } catch {
87
88
  }
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);
89
+ const l = c.join(n, m);
90
+ r.statSync(d).isDirectory() ? (r.existsSync(l) || r.mkdirSync(l, { recursive: !0 }), b(d, l, a)) : K(d, l, a);
90
91
  }
91
92
  }
92
- function K(e) {
93
+ function Y(e) {
93
94
  if (r.existsSync(e))
94
95
  for (const n of r.readdirSync(e)) {
95
96
  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);
97
+ const a = c.join(e, n);
98
+ r.statSync(a).isDirectory() ? r.rmSync(a, { recursive: !0, force: !0 }) : r.unlinkSync(a);
98
99
  }
99
100
  }
100
- function _(e) {
101
+ function I(e) {
101
102
  if (!r.existsSync(e)) return !0;
102
103
  const n = r.readdirSync(e);
103
104
  return n.length === 0 || n.length === 1 && n[0] === ".git";
104
105
  }
105
- const Y = {
106
+ const q = {
106
107
  standalone: "Standalone App",
107
- "dynamic-module": "Dynamic Module",
108
- "host-app": "Host App"
108
+ "dynamic-module": "Dynamic Module"
109
109
  };
110
- function q(e) {
111
- const n = Y[e.projectType], t = e.projectType !== "host-app";
110
+ function W(e) {
111
+ const n = q[e.projectType], a = !!e.moduleName;
112
112
  console.log(`
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("╰─────────────────────────────────────────╯")}
113
+ ${t.green("╭─────────────────────────────────────────╮")}
114
+ ${t.green("│")} ${t.green("│")}
115
+ ${t.green("│")} ${t.bold("VC Shell App created successfully!")} ${t.green("│")}
116
+ ${t.green("│")} ${t.green("│")}
117
+ ${t.green("│")} Project: ${t.cyan(e.projectName.padEnd(28))}${t.green("│")}
118
+ ${t.green("│")} Type: ${t.cyan(n.padEnd(28))}${t.green("│")}
119
+ ${a && e.moduleName ? ` ${t.green("│")} Module: ${t.cyan(e.moduleName.padEnd(28))}${t.green("│")}
120
+ ` : ""} ${t.green("│")} ${t.green("│")}
121
+ ${t.green("╰─────────────────────────────────────────╯")}
122
122
 
123
- ${a.bold("Next steps:")}
123
+ ${t.bold("Next steps:")}
124
124
 
125
125
  1. cd ${e.projectName}
126
126
  2. yarn install
127
127
  3. yarn serve
128
- ${t && e.moduleName ? `
128
+ ${a && e.moduleName ? `
129
129
  Module is ready at:
130
- src/modules/${W(e.moduleName)}/
130
+ src/modules/${H(e.moduleName)}/
131
131
  ` : ""}
132
- ${a.dim("Docs: https://docs.virtocommerce.org/platform/developer-guide/latest/custom-apps-development/vc-shell/vc-shell-overview/")}
132
+ ${t.dim("Docs: https://docs.virtocommerce.org/platform/developer-guide/latest/custom-apps-development/vc-shell/vc-shell-overview/")}
133
133
  `);
134
134
  }
135
- function W(e) {
135
+ function H(e) {
136
136
  return e.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase().replace(/[^a-z0-9-]/g, "");
137
137
  }
138
138
  const X = [
139
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" }
140
+ { title: "Dynamic Module — remote module loaded by host via Module Federation", value: "dynamic-module" }
142
141
  ];
143
142
  async function G(e, n) {
144
- const t = process.cwd();
143
+ const a = process.cwd();
145
144
  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;
145
+ const d = o || "vc-app", p = () => o === "." ? c.basename(c.resolve()) : o, m = !!(o && e.type);
146
+ let l;
148
147
  if (m) {
149
148
  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)}/`),
149
+ const g = c.resolve(a, o);
150
+ r.existsSync(g) && !I(g) && !e.overwrite && (console.error(t.red(`Target directory "${o}" is not empty. Use --overwrite to overwrite.`)), process.exit(1));
151
+ const u = p(), y = e.type, f = e["module-name"], N = y === "dynamic-module" ? f || S(u) : f || void 0;
152
+ l = {
153
+ projectName: h(u),
154
+ packageName: e["package-name"] || (k(u) ? u : C(u)),
155
+ projectType: y,
156
+ moduleName: N,
157
+ basePath: e["base-path"] || _(`/apps/${h(u)}/`),
159
158
  tenantRoutes: e["tenant-routes"] || !1,
160
159
  aiAgent: e["ai-agent"] || !1,
161
160
  dashboard: e.dashboard || !1,
@@ -163,7 +162,7 @@ async function G(e, n) {
163
162
  };
164
163
  } else {
165
164
  const g = () => {
166
- throw new Error(a.red("✖") + " Creation cancelled");
165
+ throw new Error(t.red("✖") + " Creation cancelled");
167
166
  };
168
167
  try {
169
168
  const u = await A(
@@ -171,22 +170,22 @@ async function G(e, n) {
171
170
  {
172
171
  name: "projectName",
173
172
  type: o ? null : "text",
174
- message: a.reset("Project name:"),
173
+ message: t.reset("Project name:"),
175
174
  initial: d,
176
175
  onState: (w) => {
177
- o = f(String(w.value).trim()) || d;
176
+ o = h(String(w.value).trim()) || d;
178
177
  },
179
- format: (w) => f(String(w).trim())
178
+ format: (w) => h(String(w).trim())
180
179
  },
181
180
  {
182
- type: () => !r.existsSync(l.resolve(t, o)) || _(l.resolve(t, o)) ? null : "confirm",
181
+ type: () => !r.existsSync(c.resolve(a, o)) || I(c.resolve(a, o)) ? null : "confirm",
183
182
  name: "overwrite",
184
183
  message: () => (o === "." ? "Current directory" : `Target directory "${o}"`) + " is not empty. Remove existing files and continue?"
185
184
  },
186
185
  {
187
- type: (w, { overwrite: R }) => {
188
- if (R === !1)
189
- throw new Error(a.red("✖") + " Operation cancelled");
186
+ type: (w, { overwrite: M }) => {
187
+ if (M === !1)
188
+ throw new Error(t.red("✖") + " Operation cancelled");
190
189
  return null;
191
190
  },
192
191
  name: "overwriteChecker"
@@ -194,91 +193,97 @@ async function G(e, n) {
194
193
  {
195
194
  name: "packageName",
196
195
  type: () => k(p()) ? null : "text",
197
- message: a.reset("Package name:"),
198
- initial: () => M(p()),
196
+ message: t.reset("Package name:"),
197
+ initial: () => C(p()),
199
198
  validate: (w) => k(w) || "Invalid package.json name"
200
199
  },
201
200
  {
202
201
  type: "select",
203
202
  name: "projectType",
204
- message: a.reset("Project type:"),
203
+ message: t.reset("Project type:"),
205
204
  choices: X
206
205
  }
207
206
  ],
208
207
  { onCancel: g }
209
- ), h = o ? f(o) : u.projectName, v = u.projectType || "standalone", $ = N(h), S = "/apps/" + f(h) + "/", b = await A(
208
+ ), y = o ? h(o) : u.projectName, f = u.projectType || "standalone", N = S(y), j = "/apps/" + h(y) + "/", $ = await A(
210
209
  [
210
+ {
211
+ name: "includeModule",
212
+ type: f === "standalone" ? "confirm" : null,
213
+ message: "Include starter module?",
214
+ initial: !0
215
+ },
211
216
  {
212
217
  name: "moduleName",
213
- type: v === "host-app" ? null : "text",
214
- message: a.reset("Module name:"),
215
- initial: $,
218
+ type: (w, M) => f === "standalone" && !M.includeModule ? null : "text",
219
+ message: t.reset("Module name:"),
220
+ initial: N,
216
221
  format: (w) => String(w).trim()
217
222
  },
218
223
  {
219
224
  name: "basePath",
220
- type: v === "dynamic-module" ? null : "text",
221
- message: a.reset("Base path:"),
222
- initial: S,
223
- format: (w) => C(String(w).trim())
225
+ type: f === "dynamic-module" ? null : "text",
226
+ message: t.reset("Base path:"),
227
+ initial: j,
228
+ format: (w) => _(String(w).trim())
224
229
  },
225
230
  {
226
- type: v === "dynamic-module" ? null : "confirm",
231
+ type: f === "dynamic-module" ? null : "confirm",
227
232
  name: "tenantRoutes",
228
233
  message: "Include tenant routing (/:tenantId prefix)?",
229
234
  initial: !1
230
235
  },
231
236
  {
232
- type: v === "dynamic-module" ? null : "confirm",
237
+ type: f === "dynamic-module" ? null : "confirm",
233
238
  name: "aiAgent",
234
239
  message: "Include AI Agent configuration?",
235
240
  initial: !1
236
241
  },
237
242
  {
238
- type: v === "dynamic-module" ? null : "confirm",
243
+ type: f === "dynamic-module" ? null : "confirm",
239
244
  name: "dashboard",
240
245
  message: "Include Dashboard with widgets?",
241
246
  initial: !0
242
247
  },
243
248
  {
244
249
  name: "mocks",
245
- type: v === "host-app" ? null : "confirm",
250
+ type: "confirm",
246
251
  message: "Include sample module with mock data?",
247
252
  initial: !1
248
253
  }
249
254
  ],
250
255
  { onCancel: g }
251
256
  );
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
257
+ l = {
258
+ projectName: y,
259
+ packageName: u.packageName || (k(y) ? y : C(y)),
260
+ projectType: f,
261
+ moduleName: $.moduleName || ($.includeModule !== !1 ? N : void 0),
262
+ basePath: $.basePath || _(j),
263
+ tenantRoutes: $.tenantRoutes || !1,
264
+ aiAgent: $.aiAgent || !1,
265
+ dashboard: $.dashboard ?? !0,
266
+ mocks: $.mocks || !1
262
267
  };
263
268
  } catch (u) {
264
269
  console.log(u.message), process.exit(1);
265
270
  }
266
271
  }
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)}...
272
+ const i = c.resolve(a, o);
273
+ r.existsSync(i) && !I(i) ? Y(i) : r.existsSync(i) || r.mkdirSync(i, { recursive: !0 }), console.log(`
274
+ Scaffolding ${t.cyan(l.projectType)} in ${t.green(i)}...
270
275
  `);
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);
276
+ const v = D(l);
277
+ if (b(c.join(n, l.projectType), i, v), l.moduleName) {
278
+ const g = h(l.moduleName), u = l.projectType === "dynamic-module" ? c.join(i, "src/modules") : c.join(i, "src/modules", g);
279
+ b(c.join(n, "module"), u, v);
275
280
  }
276
- c.mocks && c.projectType !== "host-app" && j(l.join(n, "sample-module"), l.join(i, "src/modules/sample"), y), q(c);
281
+ l.mocks && b(c.join(n, "sample-module"), c.join(i, "src/modules/sample"), v), W(l);
277
282
  }
278
- function D(e, n) {
279
- const t = /^import\s.+$/gm;
283
+ function R(e, n) {
284
+ const a = /^import\s.+$/gm;
280
285
  let s = null, o;
281
- for (; (o = t.exec(e)) !== null; )
286
+ for (; (o = a.exec(e)) !== null; )
282
287
  s = o;
283
288
  if (s) {
284
289
  const d = s.index + s[0].length;
@@ -289,36 +294,36 @@ function D(e, n) {
289
294
  ` + e;
290
295
  }
291
296
  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}";`);
297
+ let a = r.readFileSync(e, "utf-8");
298
+ const s = x(n), o = h(n);
299
+ a = R(a, `import ${s} from "./modules/${o}";`);
295
300
  const d = /\.use\([A-Z]\w+,\s*\{\s*router\s*\}\)/g;
296
301
  let p = null, m;
297
- for (; (m = d.exec(t)) !== null; )
302
+ for (; (m = d.exec(a)) !== null; )
298
303
  p = m;
299
304
  if (p) {
300
- const c = p.index + p[0].length, i = `
305
+ const l = p.index + p[0].length, i = `
301
306
  .use(${s}, { router })`;
302
- t = t.slice(0, c) + i + t.slice(c);
307
+ a = a.slice(0, l) + i + a.slice(l);
303
308
  }
304
- r.writeFileSync(e, t);
309
+ r.writeFileSync(e, a);
305
310
  }
306
311
  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"`);
312
+ let a = r.readFileSync(e, "utf-8");
313
+ const s = h(n), o = E(n);
314
+ if (!a.includes("addMenuItem")) {
315
+ const v = /import\s*\{([^}]+)\}\s*from\s*["']@vc-shell\/framework["']/.exec(a);
316
+ if (v) {
317
+ const g = v[1].trim() + ", addMenuItem";
318
+ a = a.replace(v[0], `import { ${g} } from "@vc-shell/framework"`);
314
319
  } else
315
- t = D(t, 'import { addMenuItem } from "@vc-shell/framework";');
320
+ a = R(a, 'import { addMenuItem } from "@vc-shell/framework";');
316
321
  }
317
322
  const d = /addMenuItem\(\{[\s\S]*?\}\);/g;
318
323
  let p = null, m;
319
- for (; (m = d.exec(t)) !== null; )
324
+ for (; (m = d.exec(a)) !== null; )
320
325
  p = m;
321
- const c = `
326
+ const l = `
322
327
  addMenuItem({
323
328
  title: "${o}.MENU.TITLE",
324
329
  icon: "lucide-box",
@@ -327,63 +332,63 @@ function ee(e, n) {
327
332
  });`;
328
333
  if (p) {
329
334
  const i = p.index + p[0].length;
330
- t = t.slice(0, i) + `
331
- ` + c + t.slice(i);
335
+ a = a.slice(0, i) + `
336
+ ` + l + a.slice(i);
332
337
  } else {
333
- const i = t.lastIndexOf("}");
334
- i !== -1 && (t = t.slice(0, i) + c + `
335
- ` + t.slice(i));
338
+ const i = a.lastIndexOf("}");
339
+ i !== -1 && (a = a.slice(0, i) + l + `
340
+ ` + a.slice(i));
336
341
  }
337
- r.writeFileSync(e, t);
342
+ r.writeFileSync(e, a);
338
343
  }
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));
344
+ async function ae(e, n) {
345
+ const a = process.cwd(), s = e._?.[1], o = c.join(a, "package.json");
346
+ r.existsSync(o) || (console.error(t.red("Error: No package.json found. Run this command from a vc-shell project root.")), process.exit(1));
342
347
  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));
348
+ ({ ...d.dependencies, ...d.devDependencies })["@vc-shell/framework"] || (console.error(t.red("Error: Not a vc-shell project (@vc-shell/framework not found in dependencies).")), process.exit(1));
344
349
  let m = s;
345
350
  m || (m = (await A({
346
351
  type: "text",
347
352
  name: "moduleName",
348
353
  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))
354
+ validate: (j) => j.trim().length > 0 || "Module name is required"
355
+ })).moduleName), m || (console.error(t.red("Module name is required.")), process.exit(1));
356
+ const l = h(m), i = x(m), v = c.join(a, "src/modules"), g = c.join(v, l);
357
+ r.existsSync(v) || r.mkdirSync(v, { recursive: !0 }), r.existsSync(g) && (console.error(t.red(`Error: Module "${l}" already exists at ${c.relative(a, g)}`)), process.exit(1));
358
+ const u = D({ moduleName: m, projectName: c.basename(a) });
359
+ b(c.join(n, "module"), g, u), console.log(t.green(` ✔ Created ${c.relative(a, g)}/`));
360
+ const y = c.join(a, "src/main.ts");
361
+ if (r.existsSync(y))
357
362
  try {
358
- Q(h, m), console.log(a.green(` ✔ Updated src/main.ts — added import & app.use(${i})`));
363
+ Q(y, m), console.log(t.green(` ✔ Updated src/main.ts — added import & app.use(${i})`));
359
364
  } 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 });`));
365
+ console.warn(t.yellow(" ⚠ Could not auto-update src/main.ts. Add manually:")), console.warn(t.yellow(` import ${i} from "./modules/${l}";`)), console.warn(t.yellow(` app.use(${i}, { router });`));
361
366
  }
362
- const v = l.join(t, "src/bootstrap.ts");
363
- if (r.existsSync(v))
367
+ const f = c.join(a, "src/bootstrap.ts");
368
+ if (r.existsSync(f))
364
369
  try {
365
- ee(v, m), console.log(a.green(` ✔ Updated src/bootstrap.ts — added menu item "${N(m)}"`));
370
+ ee(f, m), console.log(t.green(` ✔ Updated src/bootstrap.ts — added menu item "${S(m)}"`));
366
371
  } catch {
367
- console.warn(a.yellow(" ⚠ Could not auto-update src/bootstrap.ts. Add addMenuItem() manually."));
372
+ console.warn(t.yellow(" ⚠ Could not auto-update src/bootstrap.ts. Add addMenuItem() manually."));
368
373
  }
369
374
  console.log(`
370
- Module "${c}" is ready! Run ${a.bold(a.green("yarn serve"))} to see it.
375
+ Module "${l}" is ready! Run ${t.bold(t.green("yarn serve"))} to see it.
371
376
  `);
372
377
  }
373
- const I = l.resolve(B(import.meta.url), "..", "templates");
374
- function ae() {
378
+ const P = c.resolve(B(import.meta.url), "..", "templates");
379
+ function te() {
375
380
  console.log(`
376
- ${a.bold(a.green("create-vc-app"))} — Create VC Shell applications and modules
381
+ ${t.bold(t.green("create-vc-app"))} — Create VC Shell applications and modules
377
382
 
378
- ${a.bold("Usage:")}
383
+ ${t.bold("Usage:")}
379
384
  create-vc-app [project-name] [options] Create a new project
380
385
  create-vc-app add-module <module-name> Add a module to existing project
381
386
 
382
- ${a.bold("Options (create):")}
383
- --type <type> Project type: standalone | dynamic-module | host-app
387
+ ${t.bold("Options (create):")}
388
+ --type <type> Project type: standalone | dynamic-module
384
389
  --name, --app-name <name> Application name
385
390
  --package-name <name> npm package name
386
- --module-name <name> Initial module name
391
+ --module-name <name> Initial module name (opt-in for standalone)
387
392
  --base-path <path> Base path [default: /apps/<name>/]
388
393
  --tenant-routes Include tenant routing (/:tenantId prefix)
389
394
  --ai-agent Include AI Agent configuration
@@ -393,14 +398,13 @@ ${a.bold("Options (create):")}
393
398
  --help, -h Show this help
394
399
  --version, -v Show version
395
400
 
396
- ${a.bold("Examples:")}
401
+ ${t.bold("Examples:")}
397
402
  create-vc-app my-app
398
403
  create-vc-app my-app --type standalone --dashboard --mocks
399
404
  create-vc-app my-module --type dynamic-module --module-name "Reviews"
400
- create-vc-app my-shell --type host-app --dashboard --tenant-routes
401
405
  create-vc-app add-module orders
402
406
 
403
- ${a.bold("Docs:")} https://docs.virtocommerce.org/platform/developer-guide/latest/custom-apps-development/vc-shell/vc-shell-overview/
407
+ ${t.bold("Docs:")} https://docs.virtocommerce.org/platform/developer-guide/latest/custom-apps-development/vc-shell/vc-shell-overview/
404
408
  `);
405
409
  }
406
410
  async function ne() {
@@ -410,15 +414,15 @@ async function ne() {
410
414
  string: ["type", "name", "app-name", "package-name", "module-name", "base-path"]
411
415
  });
412
416
  if (e.help) {
413
- ae();
417
+ te();
414
418
  return;
415
419
  }
416
420
  if (e.version) {
417
421
  console.log(`create-vc-app v${O.version}`);
418
422
  return;
419
423
  }
420
- e._[0] === "add-module" ? await te(e, I) : await G(e, I);
424
+ e._[0] === "add-module" ? await ae(e, P) : await G(e, P);
421
425
  }
422
426
  ne().catch((e) => {
423
- console.error(a.red(e.message || String(e))), U(1);
427
+ console.error(t.red(e.message || String(e))), U(1);
424
428
  });
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAsB1D"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAOjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAsB1D"}
@@ -10,17 +10,17 @@
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^20.10.5",
13
- "@vc-shell/ts-config": "^2.0.0-alpha.16",
13
+ "@vc-shell/ts-config": "^2.0.0-alpha.17",
14
14
  "cross-env": "^7.0.3",
15
15
  "sass": "^1.87.0",
16
16
  "typescript": "^5.8.3",
17
17
  "vite": "^6.3.3",
18
- "vue-tsc": "^2.2.10"
18
+ "vue-tsc": "^3.2.5"
19
19
  },
20
20
  "dependencies": {
21
- "@vc-shell/config-generator": "^2.0.0-alpha.16",
22
- "@vc-shell/framework": "^2.0.0-alpha.16",
23
- "vue": "^3.5.13",
24
- "vue-router": "^4.2.5"
21
+ "@vc-shell/config-generator": "^2.0.0-alpha.17",
22
+ "@vc-shell/framework": "^2.0.0-alpha.17",
23
+ "vue": "^3.5.30",
24
+ "vue-router": "^5.0.3"
25
25
  }
26
26
  }
@@ -1,5 +1,8 @@
1
- import * as pages from "./pages";
2
- import * as locales from "./locales";
3
- import { createAppModule } from "@vc-shell/framework";
4
-
5
- export default createAppModule(pages, locales);
1
+ import * as blades from "./pages";
2
+ import * as locales from "./locales";
3
+ import { defineAppModule } from "@vc-shell/framework";
4
+
5
+ export default defineAppModule({
6
+ blades,
7
+ locales,
8
+ });
@@ -4,7 +4,7 @@
4
4
  "baseUrl": ".",
5
5
  "outDir": "dist",
6
6
  "rootDir": "src",
7
- "types": ["vite/client"]
7
+ "types": ["vite/client", "@vc-shell/framework/globals"]
8
8
  },
9
9
  "include": [
10
10
  "./src/**/*.ts",