@vc-shell/create-vc-app 2.0.0-alpha.3 → 2.0.0-alpha.30

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