@vc-shell/create-vc-app 1.0.202 → 1.0.204

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 (26) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/index.js +190 -180
  3. package/dist/templates/base/_package.json +5 -5
  4. package/dist/templates/mocks/sample-data/constants.ts +98 -0
  5. package/dist/templates/mocks/sample-data/index.ts +2 -0
  6. package/dist/templates/mocks/sample-data/methods.ts +65 -0
  7. package/dist/templates/sample/classic-module/composables/index.ts +2 -0
  8. package/dist/templates/sample/classic-module/composables/useDetails/index.ts +41 -0
  9. package/dist/templates/sample/classic-module/composables/useList/index.ts +41 -0
  10. package/dist/templates/sample/classic-module/index.ts +8 -0
  11. package/dist/templates/sample/classic-module/locales/en.json +59 -0
  12. package/dist/templates/sample/classic-module/locales/index.ts +2 -0
  13. package/dist/templates/sample/classic-module/pages/details.vue +257 -0
  14. package/dist/templates/sample/classic-module/pages/index.ts +2 -0
  15. package/dist/templates/sample/classic-module/pages/list.vue +267 -0
  16. package/dist/templates/sample/dynamic-module/composables/index.ts +2 -0
  17. package/dist/templates/sample/dynamic-module/composables/useDetails/index.ts +49 -0
  18. package/dist/templates/sample/dynamic-module/composables/useList/index.ts +54 -0
  19. package/dist/templates/sample/dynamic-module/index.ts +8 -0
  20. package/dist/templates/sample/dynamic-module/locales/en.json +69 -0
  21. package/dist/templates/sample/dynamic-module/locales/index.ts +2 -0
  22. package/dist/templates/sample/dynamic-module/pages/details.ts +100 -0
  23. package/dist/templates/sample/dynamic-module/pages/index.ts +4 -0
  24. package/dist/templates/sample/dynamic-module/pages/list.ts +81 -0
  25. package/dist/templates/sample/overrides/main.ts +53 -0
  26. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## [1.0.204](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.203...v1.0.204) (2024-04-30)
2
+
3
+
4
+ ### Features
5
+
6
+ * **create-vc-app:** new prompt with ability to add sample data module ([7816a8b](https://github.com/VirtoCommerce/vc-shell/commit/7816a8b2ce872f3ca7e54c7a328481edf4adb854))
7
+
8
+
9
+
10
+ ## [1.0.203](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.202...v1.0.203) (2024-04-25)
11
+
12
+
13
+
1
14
  ## [1.0.202](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.200...v1.0.202) (2024-04-25)
2
15
 
3
16
 
package/dist/index.js CHANGED
@@ -1,140 +1,140 @@
1
1
  #!/usr/bin/env node
2
- import Se from "prompts";
3
- import he from "mri";
4
- import u from "chalk";
2
+ import Ce from "prompts";
3
+ import $e from "mri";
4
+ import s from "chalk";
5
5
  import i from "node:path";
6
- import s from "node:fs";
7
- import { fileURLToPath as Ce } from "node:url";
8
- import { cwd as $e, argv as Re, exit as je } from "node:process";
9
- const Ae = "@vc-shell/create-vc-app", we = "Application scaffolding", ke = "1.0.202", Oe = "module", Ne = "./dist/index.js", Me = [
6
+ import u from "node:fs";
7
+ import { fileURLToPath as Re } from "node:url";
8
+ import { cwd as je, argv as Ae, exit as we } from "node:process";
9
+ const ke = "@vc-shell/create-vc-app", Oe = "Application scaffolding", Ne = "1.0.204", Me = "module", Te = "./dist/index.js", Ue = [
10
10
  "dist"
11
- ], Te = {
11
+ ], Ee = {
12
12
  build: "vite build && yarn postbuild",
13
13
  postbuild: "shx cp -R src/templates dist/"
14
- }, Ue = {
14
+ }, Le = {
15
15
  "@types/prompts": "^2.4.4",
16
- "@vc-shell/ts-config": "^1.0.202",
16
+ "@vc-shell/ts-config": "^1.0.204",
17
17
  copyfiles: "^2.4.1",
18
18
  "cross-env": "^7.0.3",
19
19
  shx: "^0.3.4",
20
20
  typescript: "^5.3.3"
21
- }, Ee = {
21
+ }, _e = {
22
22
  chalk: "^2.4.2",
23
23
  mri: "^1.2.0",
24
24
  prompts: "^2.4.2",
25
25
  tslib: "^2.5.3",
26
26
  vite: "^5.0.11",
27
27
  "vite-plugin-dts": "^3.6.4"
28
- }, Le = {
28
+ }, Pe = {
29
29
  access: "public",
30
30
  registry: "https://registry.npmjs.org/"
31
- }, _e = "yarn@4.0.2", Pe = {
32
- name: Ae,
33
- description: we,
34
- version: ke,
35
- type: Oe,
36
- bin: Ne,
37
- files: Me,
38
- scripts: Te,
39
- devDependencies: Ue,
40
- dependencies: Ee,
41
- publishConfig: Le,
42
- packageManager: _e
31
+ }, ze = "yarn@4.0.2", De = {
32
+ name: ke,
33
+ description: Oe,
34
+ version: Ne,
35
+ type: Me,
36
+ bin: Te,
37
+ files: Ue,
38
+ scripts: Ee,
39
+ devDependencies: Le,
40
+ dependencies: _e,
41
+ publishConfig: Pe,
42
+ packageManager: ze
43
43
  };
44
- var ze = typeof global == "object" && global && global.Object === Object && global, De = typeof self == "object" && self && self.Object === Object && self, Fe = ze || De || Function("return this")(), p = Fe.Symbol, V = Object.prototype, Ie = V.hasOwnProperty, Ze = V.toString, x = p ? p.toStringTag : void 0;
45
- function Ve(e) {
46
- var n = Ie.call(e, x), r = e[x];
44
+ var Fe = typeof global == "object" && global && global.Object === Object && global, Ie = typeof self == "object" && self && self.Object === Object && self, Ze = Fe || Ie || Function("return this")(), m = Ze.Symbol, H = Object.prototype, Ve = H.hasOwnProperty, We = H.toString, y = m ? m.toStringTag : void 0;
45
+ function He(e) {
46
+ var n = Ve.call(e, y), r = e[y];
47
47
  try {
48
- e[x] = void 0;
48
+ e[y] = void 0;
49
49
  var a = !0;
50
50
  } catch {
51
51
  }
52
- var t = Ze.call(e);
53
- return a && (n ? e[x] = r : delete e[x]), t;
52
+ var t = We.call(e);
53
+ return a && (n ? e[y] = r : delete e[y]), t;
54
54
  }
55
- var We = Object.prototype, He = We.toString;
56
- function Be(e) {
57
- return He.call(e);
55
+ var Be = Object.prototype, Je = Be.toString;
56
+ function Ge(e) {
57
+ return Je.call(e);
58
58
  }
59
- var Je = "[object Null]", Ge = "[object Undefined]", E = p ? p.toStringTag : void 0;
60
- function Ye(e) {
61
- return e == null ? e === void 0 ? Ge : Je : E && E in Object(e) ? Ve(e) : Be(e);
59
+ var Ye = "[object Null]", qe = "[object Undefined]", _ = m ? m.toStringTag : void 0;
60
+ function Ke(e) {
61
+ return e == null ? e === void 0 ? qe : Ye : _ && _ in Object(e) ? He(e) : Ge(e);
62
62
  }
63
- function qe(e) {
63
+ function Qe(e) {
64
64
  return e != null && typeof e == "object";
65
65
  }
66
- var Ke = "[object Symbol]";
67
- function Qe(e) {
68
- return typeof e == "symbol" || qe(e) && Ye(e) == Ke;
66
+ var Xe = "[object Symbol]";
67
+ function er(e) {
68
+ return typeof e == "symbol" || Qe(e) && Ke(e) == Xe;
69
69
  }
70
- function Xe(e, n) {
70
+ function rr(e, n) {
71
71
  for (var r = -1, a = e == null ? 0 : e.length, t = Array(a); ++r < a; )
72
72
  t[r] = n(e[r], r, e);
73
73
  return t;
74
74
  }
75
- var er = Array.isArray, rr = 1 / 0, L = p ? p.prototype : void 0, _ = L ? L.toString : void 0;
76
- function W(e) {
75
+ var nr = Array.isArray, or = 1 / 0, P = m ? m.prototype : void 0, z = P ? P.toString : void 0;
76
+ function B(e) {
77
77
  if (typeof e == "string")
78
78
  return e;
79
+ if (nr(e))
80
+ return rr(e, B) + "";
79
81
  if (er(e))
80
- return Xe(e, W) + "";
81
- if (Qe(e))
82
- return _ ? _.call(e) : "";
82
+ return z ? z.call(e) : "";
83
83
  var n = e + "";
84
- return n == "0" && 1 / e == -rr ? "-0" : n;
84
+ return n == "0" && 1 / e == -or ? "-0" : n;
85
85
  }
86
- function S(e) {
87
- return e == null ? "" : W(e);
86
+ function C(e) {
87
+ return e == null ? "" : B(e);
88
88
  }
89
- function nr(e, n, r) {
89
+ function tr(e, n, r) {
90
90
  var a = -1, t = e.length;
91
91
  n < 0 && (n = -n > t ? 0 : t + n), r = r > t ? t : r, r < 0 && (r += t), t = n > r ? 0 : r - n >>> 0, n >>>= 0;
92
92
  for (var c = Array(t); ++a < t; )
93
93
  c[a] = e[a + n];
94
94
  return c;
95
95
  }
96
- function tr(e, n, r) {
96
+ function ar(e, n, r) {
97
97
  var a = e.length;
98
- return r = r === void 0 ? a : r, !n && r >= a ? e : nr(e, n, r);
98
+ return r = r === void 0 ? a : r, !n && r >= a ? e : tr(e, n, r);
99
99
  }
100
- var or = "\\ud800-\\udfff", ar = "\\u0300-\\u036f", ur = "\\ufe20-\\ufe2f", sr = "\\u20d0-\\u20ff", ir = ar + ur + sr, cr = "\\ufe0e\\ufe0f", fr = "\\u200d", lr = RegExp("[" + fr + or + ir + cr + "]");
101
- function H(e) {
102
- return lr.test(e);
100
+ var sr = "\\ud800-\\udfff", ur = "\\u0300-\\u036f", ir = "\\ufe20-\\ufe2f", cr = "\\u20d0-\\u20ff", fr = ur + ir + cr, lr = "\\ufe0e\\ufe0f", dr = "\\u200d", pr = RegExp("[" + dr + sr + fr + lr + "]");
101
+ function J(e) {
102
+ return pr.test(e);
103
103
  }
104
- function dr(e) {
104
+ function mr(e) {
105
105
  return e.split("");
106
106
  }
107
- var B = "\\ud800-\\udfff", pr = "\\u0300-\\u036f", gr = "\\ufe20-\\ufe2f", mr = "\\u20d0-\\u20ff", xr = pr + gr + mr, br = "\\ufe0e\\ufe0f", yr = "[" + B + "]", w = "[" + xr + "]", k = "\\ud83c[\\udffb-\\udfff]", vr = "(?:" + w + "|" + k + ")", J = "[^" + B + "]", G = "(?:\\ud83c[\\udde6-\\uddff]){2}", Y = "[\\ud800-\\udbff][\\udc00-\\udfff]", Sr = "\\u200d", q = vr + "?", K = "[" + br + "]?", hr = "(?:" + Sr + "(?:" + [J, G, Y].join("|") + ")" + K + q + ")*", Cr = K + q + hr, $r = "(?:" + [J + w + "?", w, G, Y, yr].join("|") + ")", Rr = RegExp(k + "(?=" + k + ")|" + $r + Cr, "g");
108
- function jr(e) {
109
- return e.match(Rr) || [];
107
+ var G = "\\ud800-\\udfff", gr = "\\u0300-\\u036f", xr = "\\ufe20-\\ufe2f", br = "\\u20d0-\\u20ff", yr = gr + xr + br, vr = "\\ufe0e\\ufe0f", hr = "[" + G + "]", O = "[" + yr + "]", N = "\\ud83c[\\udffb-\\udfff]", Sr = "(?:" + O + "|" + N + ")", Y = "[^" + G + "]", q = "(?:\\ud83c[\\udde6-\\uddff]){2}", K = "[\\ud800-\\udbff][\\udc00-\\udfff]", Cr = "\\u200d", Q = Sr + "?", X = "[" + vr + "]?", $r = "(?:" + Cr + "(?:" + [Y, q, K].join("|") + ")" + X + Q + ")*", Rr = X + Q + $r, jr = "(?:" + [Y + O + "?", O, q, K, hr].join("|") + ")", Ar = RegExp(N + "(?=" + N + ")|" + jr + Rr, "g");
108
+ function wr(e) {
109
+ return e.match(Ar) || [];
110
110
  }
111
- function Ar(e) {
112
- return H(e) ? jr(e) : dr(e);
111
+ function kr(e) {
112
+ return J(e) ? wr(e) : mr(e);
113
113
  }
114
- function Q(e) {
114
+ function ee(e) {
115
115
  return function(n) {
116
- n = S(n);
117
- var r = H(n) ? Ar(n) : void 0, a = r ? r[0] : n.charAt(0), t = r ? tr(r, 1).join("") : n.slice(1);
116
+ n = C(n);
117
+ var r = J(n) ? kr(n) : void 0, a = r ? r[0] : n.charAt(0), t = r ? ar(r, 1).join("") : n.slice(1);
118
118
  return a[e]() + t;
119
119
  };
120
120
  }
121
- var wr = Q("toUpperCase");
122
- const O = wr;
123
- function kr(e) {
124
- return O(S(e).toLowerCase());
121
+ var Or = ee("toUpperCase");
122
+ const M = Or;
123
+ function Nr(e) {
124
+ return M(C(e).toLowerCase());
125
125
  }
126
- function Or(e, n, r, a) {
126
+ function Mr(e, n, r, a) {
127
127
  var t = -1, c = e == null ? 0 : e.length;
128
128
  for (a && c && (r = e[++t]); ++t < c; )
129
129
  r = n(r, e[t], t, e);
130
130
  return r;
131
131
  }
132
- function Nr(e) {
132
+ function Tr(e) {
133
133
  return function(n) {
134
134
  return e?.[n];
135
135
  };
136
136
  }
137
- var Mr = {
137
+ var Ur = {
138
138
  // Latin-1 Supplement block.
139
139
  À: "A",
140
140
  Á: "A",
@@ -327,54 +327,54 @@ var Mr = {
327
327
  œ: "oe",
328
328
  ʼn: "'n",
329
329
  ſ: "s"
330
- }, Tr = Nr(Mr);
331
- const Ur = Tr;
332
- var Er = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Lr = "\\u0300-\\u036f", _r = "\\ufe20-\\ufe2f", Pr = "\\u20d0-\\u20ff", zr = Lr + _r + Pr, Dr = "[" + zr + "]", Fr = RegExp(Dr, "g");
333
- function Ir(e) {
334
- return e = S(e), e && e.replace(Er, Ur).replace(Fr, "");
335
- }
336
- var Zr = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
330
+ }, Er = Tr(Ur);
331
+ const Lr = Er;
332
+ var _r = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Pr = "\\u0300-\\u036f", zr = "\\ufe20-\\ufe2f", Dr = "\\u20d0-\\u20ff", Fr = Pr + zr + Dr, Ir = "[" + Fr + "]", Zr = RegExp(Ir, "g");
337
333
  function Vr(e) {
338
- return e.match(Zr) || [];
334
+ return e = C(e), e && e.replace(_r, Lr).replace(Zr, "");
339
335
  }
340
- var Wr = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
336
+ var Wr = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
341
337
  function Hr(e) {
342
- return Wr.test(e);
338
+ return e.match(Wr) || [];
343
339
  }
344
- var X = "\\ud800-\\udfff", Br = "\\u0300-\\u036f", Jr = "\\ufe20-\\ufe2f", Gr = "\\u20d0-\\u20ff", Yr = Br + Jr + Gr, ee = "\\u2700-\\u27bf", re = "a-z\\xdf-\\xf6\\xf8-\\xff", qr = "\\xac\\xb1\\xd7\\xf7", Kr = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Qr = "\\u2000-\\u206f", Xr = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", ne = "A-Z\\xc0-\\xd6\\xd8-\\xde", en = "\\ufe0e\\ufe0f", te = qr + Kr + Qr + Xr, oe = "['’]", P = "[" + te + "]", rn = "[" + Yr + "]", ae = "\\d+", nn = "[" + ee + "]", ue = "[" + re + "]", se = "[^" + X + te + ae + ee + re + ne + "]", tn = "\\ud83c[\\udffb-\\udfff]", on = "(?:" + rn + "|" + tn + ")", an = "[^" + X + "]", ie = "(?:\\ud83c[\\udde6-\\uddff]){2}", ce = "[\\ud800-\\udbff][\\udc00-\\udfff]", d = "[" + ne + "]", un = "\\u200d", z = "(?:" + ue + "|" + se + ")", sn = "(?:" + d + "|" + se + ")", D = "(?:" + oe + "(?:d|ll|m|re|s|t|ve))?", F = "(?:" + oe + "(?:D|LL|M|RE|S|T|VE))?", fe = on + "?", le = "[" + en + "]?", cn = "(?:" + un + "(?:" + [an, ie, ce].join("|") + ")" + le + fe + ")*", fn = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", ln = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", dn = le + fe + cn, pn = "(?:" + [nn, ie, ce].join("|") + ")" + dn, gn = RegExp([
345
- d + "?" + ue + "+" + D + "(?=" + [P, d, "$"].join("|") + ")",
346
- sn + "+" + F + "(?=" + [P, d + z, "$"].join("|") + ")",
347
- d + "?" + z + "+" + D,
348
- d + "+" + F,
349
- ln,
350
- fn,
351
- ae,
352
- pn
340
+ var Br = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
341
+ function Jr(e) {
342
+ return Br.test(e);
343
+ }
344
+ var re = "\\ud800-\\udfff", Gr = "\\u0300-\\u036f", Yr = "\\ufe20-\\ufe2f", qr = "\\u20d0-\\u20ff", Kr = Gr + Yr + qr, ne = "\\u2700-\\u27bf", oe = "a-z\\xdf-\\xf6\\xf8-\\xff", Qr = "\\xac\\xb1\\xd7\\xf7", Xr = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", en = "\\u2000-\\u206f", rn = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", te = "A-Z\\xc0-\\xd6\\xd8-\\xde", nn = "\\ufe0e\\ufe0f", ae = Qr + Xr + en + rn, se = "['’]", D = "[" + ae + "]", on = "[" + Kr + "]", ue = "\\d+", tn = "[" + ne + "]", ie = "[" + oe + "]", ce = "[^" + re + ae + ue + ne + oe + te + "]", an = "\\ud83c[\\udffb-\\udfff]", sn = "(?:" + on + "|" + an + ")", un = "[^" + re + "]", fe = "(?:\\ud83c[\\udde6-\\uddff]){2}", le = "[\\ud800-\\udbff][\\udc00-\\udfff]", p = "[" + te + "]", cn = "\\u200d", F = "(?:" + ie + "|" + ce + ")", fn = "(?:" + p + "|" + ce + ")", I = "(?:" + se + "(?:d|ll|m|re|s|t|ve))?", Z = "(?:" + se + "(?:D|LL|M|RE|S|T|VE))?", de = sn + "?", pe = "[" + nn + "]?", ln = "(?:" + cn + "(?:" + [un, fe, le].join("|") + ")" + pe + de + ")*", dn = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", pn = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", mn = pe + de + ln, gn = "(?:" + [tn, fe, le].join("|") + ")" + mn, xn = RegExp([
345
+ p + "?" + ie + "+" + I + "(?=" + [D, p, "$"].join("|") + ")",
346
+ fn + "+" + Z + "(?=" + [D, p + F, "$"].join("|") + ")",
347
+ p + "?" + F + "+" + I,
348
+ p + "+" + Z,
349
+ pn,
350
+ dn,
351
+ ue,
352
+ gn
353
353
  ].join("|"), "g");
354
- function mn(e) {
355
- return e.match(gn) || [];
354
+ function bn(e) {
355
+ return e.match(xn) || [];
356
356
  }
357
- function xn(e, n, r) {
358
- return e = S(e), n = r ? void 0 : n, n === void 0 ? Hr(e) ? mn(e) : Vr(e) : e.match(n) || [];
357
+ function yn(e, n, r) {
358
+ return e = C(e), n = r ? void 0 : n, n === void 0 ? Jr(e) ? bn(e) : Hr(e) : e.match(n) || [];
359
359
  }
360
- var bn = "['’]", yn = RegExp(bn, "g");
361
- function N(e) {
360
+ var vn = "['’]", hn = RegExp(vn, "g");
361
+ function T(e) {
362
362
  return function(n) {
363
- return Or(xn(Ir(n).replace(yn, "")), e, "");
363
+ return Mr(yn(Vr(n).replace(hn, "")), e, "");
364
364
  };
365
365
  }
366
- var vn = N(function(e, n, r) {
367
- return n = n.toLowerCase(), e + (r ? kr(n) : n);
366
+ var Sn = T(function(e, n, r) {
367
+ return n = n.toLowerCase(), e + (r ? Nr(n) : n);
368
368
  });
369
- const I = vn;
370
- var Sn = Q("toLowerCase");
371
- const hn = Sn;
372
- var Cn = N(function(e, n, r) {
369
+ const V = Sn;
370
+ var Cn = ee("toLowerCase");
371
+ const $n = Cn;
372
+ var Rn = T(function(e, n, r) {
373
373
  return e + (r ? "_" : "") + n.toLowerCase();
374
- }), A = N(function(e, n, r) {
375
- return e + (r ? " " : "") + O(n);
374
+ }), w = T(function(e, n, r) {
375
+ return e + (r ? " " : "") + M(n);
376
376
  });
377
- const $n = {
377
+ const jn = {
378
378
  _gitignore: ".gitignore",
379
379
  "_yarnrc.yml": ".yarnrc.yml",
380
380
  _browserslistrc: ".browserslistrc",
@@ -391,29 +391,29 @@ const $n = {
391
391
  _yarn: ".yarn",
392
392
  "_package.json": "package.json"
393
393
  };
394
- function Z(e) {
394
+ function W(e) {
395
395
  return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e);
396
396
  }
397
- function b(e) {
397
+ function v(e) {
398
398
  return e.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
399
399
  }
400
- function Rn(e) {
400
+ function An(e) {
401
401
  return e.trim().toLowerCase().replace(/\/+/g, "/").replace(/[^a-z0-9/-]+/g, "/").replace(/\/?$/, "/");
402
402
  }
403
- function de(e) {
404
- if (s.existsSync(e))
405
- s.readdirSync(e).forEach((n) => {
403
+ function me(e) {
404
+ if (u.existsSync(e))
405
+ u.readdirSync(e).forEach((n) => {
406
406
  const r = i.join(e, n);
407
- s.lstatSync(r).isDirectory() ? de(r) : s.unlinkSync(r);
407
+ u.lstatSync(r).isDirectory() ? me(r) : u.unlinkSync(r);
408
408
  });
409
409
  else
410
410
  return;
411
411
  }
412
- function jn(e) {
413
- const n = s.readdirSync(e);
412
+ function wn(e) {
413
+ const n = u.readdirSync(e);
414
414
  return n.length === 0 || n.length === 1 && n[0] === ".git";
415
415
  }
416
- const An = [
416
+ const kn = [
417
417
  {
418
418
  name: "dynamic",
419
419
  display: "Dynamic view modules boilerplate"
@@ -422,61 +422,61 @@ const An = [
422
422
  name: "classic",
423
423
  display: "Classic view modules boilerplate"
424
424
  }
425
- ], wn = {
425
+ ], k = {
426
426
  classic: ["classic-module"],
427
427
  dynamic: ["dynamic-module"]
428
428
  };
429
- async function kn() {
430
- console.log(` ${u.bold(u.green(`
431
- create-vc-app version: ${Pe.version}
429
+ async function On() {
430
+ console.log(` ${s.bold(s.green(`
431
+ create-vc-app version: ${De.version}
432
432
  `))}`);
433
- const e = $e();
434
- let r = he(Re.slice(2))._[0];
433
+ const e = je();
434
+ let r = $e(Ae.slice(2))._[0];
435
435
  const a = r || "vc-app", t = () => r === "." ? i.basename(i.resolve()) : r;
436
436
  let c;
437
437
  try {
438
- c = await Se(
438
+ c = await Ce(
439
439
  [
440
440
  {
441
441
  name: "appName",
442
442
  type: r ? null : "text",
443
- message: u.reset("Project name:"),
443
+ message: s.reset("Project name:"),
444
444
  initial: a,
445
- onState: (o) => r = b(String(o.value).trim()) || a,
446
- format: (o) => b(String(o).trim())
445
+ onState: (o) => r = v(String(o.value).trim()) || a,
446
+ format: (o) => v(String(o).trim())
447
447
  },
448
448
  {
449
- type: () => !s.existsSync(r) || jn(r) ? null : "confirm",
449
+ type: () => !u.existsSync(r) || wn(r) ? null : "confirm",
450
450
  name: "overwrite",
451
451
  message: () => (r === "." ? "Current directory" : `Target directory "${r}"`) + " is not empty. Remove existing files and continue?"
452
452
  },
453
453
  {
454
- type: (o, { overwrite: y }) => {
455
- if (y === !1)
456
- throw new Error(u.red("✖") + " Operation cancelled");
454
+ type: (o, { overwrite: h }) => {
455
+ if (h === !1)
456
+ throw new Error(s.red("✖") + " Operation cancelled");
457
457
  return null;
458
458
  },
459
459
  name: "overwriteChecker"
460
460
  },
461
461
  {
462
462
  name: "packageName",
463
- type: () => Z(t()) ? null : "text",
464
- message: u.reset("Package name:"),
465
- initial: () => b(t()),
466
- validate: (o) => Z(o) || "Invalid package.json name"
463
+ type: () => W(t()) ? null : "text",
464
+ message: s.reset("Package name:"),
465
+ initial: () => v(t()),
466
+ validate: (o) => W(o) || "Invalid package.json name"
467
467
  },
468
468
  {
469
469
  name: "basePath",
470
470
  type: "text",
471
- message: u.reset("Base path:"),
472
- initial: () => "/apps/" + b(t()) + "/",
473
- format: (o) => Rn(String(o).trim())
471
+ message: s.reset("Base path:"),
472
+ initial: () => "/apps/" + v(t()) + "/",
473
+ format: (o) => An(String(o).trim())
474
474
  },
475
475
  {
476
476
  type: "select",
477
477
  name: "variant",
478
- message: u.reset("Select module variant:"),
479
- choices: An.map((o) => ({
478
+ message: s.reset("Select module variant:"),
479
+ choices: kn.map((o) => ({
480
480
  title: o.display,
481
481
  value: o.name
482
482
  }))
@@ -484,73 +484,83 @@ create-vc-app version: ${Pe.version}
484
484
  {
485
485
  name: "moduleName",
486
486
  type: "text",
487
- message: u.reset("Module name:"),
488
- initial: () => A(t()),
487
+ message: s.reset("Module name:"),
488
+ initial: () => w(t()),
489
489
  format: (o) => String(o).trim()
490
+ },
491
+ {
492
+ name: "mocks",
493
+ type: "confirm",
494
+ message: "Do you want to include additional module with sample data?",
495
+ initial: !1
490
496
  }
491
497
  ],
492
498
  {
493
499
  onCancel: () => {
494
- throw new Error(u.red("✖") + " Creation cancelled");
500
+ throw new Error(s.red("✖") + " Creation cancelled");
495
501
  }
496
502
  }
497
503
  );
498
504
  } catch (o) {
499
- console.log(o.message), je(1);
505
+ console.log(o.message), we(1);
500
506
  }
501
- const { packageName: pe, variant: ge, moduleName: l, appName: M, basePath: me } = c, h = /* @__PURE__ */ new Map([
502
- ["{{ModuleName}}", b(l)],
503
- ["{{ModuleNamePascalCase}}", O(I(l))],
504
- ["{{ModuleNameUppercase}}", l.toUpperCase()],
505
- ["{{ModuleNameUppercaseSnakeCase}}", Cn(l).toUpperCase()],
506
- ["{{ModuleNameExports}}", hn(I(l))],
507
- ["{{ModuleNameSentenceCase}}", A(l)],
508
- ["{{AppName}}", M],
509
- ["{{AppNameSentenceCase}}", A(M)],
510
- ["{{BasePath}}", me],
511
- ["{{PackageName}}", pe || t()]
507
+ const { packageName: ge, variant: g, moduleName: d, appName: U, basePath: xe, mocks: be } = c, $ = /* @__PURE__ */ new Map([
508
+ ["{{ModuleName}}", v(d)],
509
+ ["{{ModuleNamePascalCase}}", M(V(d))],
510
+ ["{{ModuleNameUppercase}}", d.toUpperCase()],
511
+ ["{{ModuleNameUppercaseSnakeCase}}", Rn(d).toUpperCase()],
512
+ ["{{ModuleNameExports}}", $n(V(d))],
513
+ ["{{ModuleNameSentenceCase}}", w(d)],
514
+ ["{{AppName}}", U],
515
+ ["{{AppNameSentenceCase}}", w(U)],
516
+ ["{{BasePath}}", xe],
517
+ ["{{PackageName}}", ge || t()]
512
518
  ]), f = i.join(e, r);
513
- s.existsSync(f) ? de(f) : s.existsSync(f) || s.mkdirSync(f), console.log(`
519
+ u.existsSync(f) ? me(f) : u.existsSync(f) || u.mkdirSync(f), console.log(`
514
520
  Scaffolding app in ${f}...`);
515
- const xe = i.resolve(Ce(import.meta.url), "..", "templates");
516
- function C(o, y = "") {
517
- const T = i.resolve(xe, o), be = s.readdirSync(T);
518
- for (const g of be) {
519
- const $ = i.join(T, g);
520
- let v = $n[g] ?? g;
521
- for (const [U, m] of h.entries()) {
522
- const j = new RegExp(U, "g");
523
- v = v.replace(j, m);
521
+ const ye = i.resolve(Re(import.meta.url), "..", "templates");
522
+ function l(o, h = "") {
523
+ const E = i.resolve(ye, o), ve = u.readdirSync(E);
524
+ for (const x of ve) {
525
+ const R = i.join(E, x);
526
+ let S = jn[x] ?? x;
527
+ for (const [L, b] of $.entries()) {
528
+ const A = new RegExp(L, "g");
529
+ S = S.replace(A, b);
524
530
  }
525
- const R = i.join(f, y, v);
526
- if (s.statSync($).isDirectory())
527
- s.mkdirSync(R, { recursive: !0 }), C(i.join(o, g), i.join(y, v));
531
+ const j = i.join(f, h, S);
532
+ if (u.statSync(R).isDirectory())
533
+ u.mkdirSync(j, { recursive: !0 }), l(i.join(o, x), i.join(h, S));
528
534
  else if ([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".pdf", ".zip"].includes(
529
- i.extname(g).toLowerCase()
535
+ i.extname(x).toLowerCase()
530
536
  ))
531
- s.copyFileSync($, R);
537
+ u.copyFileSync(R, j);
532
538
  else {
533
- let m = s.readFileSync($, "utf-8");
534
- for (const [j, ye] of h.entries()) {
535
- const ve = new RegExp(j, "g");
536
- m = m.replace(ve, ye);
539
+ let b = u.readFileSync(R, "utf-8");
540
+ for (const [A, he] of $.entries()) {
541
+ const Se = new RegExp(A, "g");
542
+ b = b.replace(Se, he);
537
543
  }
538
- s.writeFileSync(R, m);
544
+ u.writeFileSync(j, b);
539
545
  }
540
546
  }
541
547
  }
542
- if (C("base"), wn[ge].forEach((o) => {
543
- C(`modules/${o}`, "src/modules/" + h.get("{{ModuleName}}"));
544
- }), console.log(`
548
+ if (l("base"), k[g].forEach((o) => {
549
+ l(`modules/${o}`, "src/modules/" + $.get("{{ModuleName}}"));
550
+ }), be && (g === "dynamic" && k[g].forEach((o) => {
551
+ l(`sample/${o}`, "src/modules/sample");
552
+ }), g === "classic" && k[g].forEach((o) => {
553
+ l(`sample/${o}`, "src/modules/sample");
554
+ }), l("mocks", "src/modules/sample"), l("sample/overrides", "src")), console.log(`
545
555
  Done. You can now run application:
546
556
  `), f !== e) {
547
557
  const o = i.relative(e, f);
548
558
  console.log(
549
- ` ${u.bold(u.green(`cd ${o.includes(" ") ? `"${o}"` : o}`))}`
559
+ ` ${s.bold(s.green(`cd ${o.includes(" ") ? `"${o}"` : o}`))}`
550
560
  );
551
561
  }
552
- console.log(` ${u.bold(u.green("yarn"))}`), console.log(` ${u.bold(u.green("yarn serve"))}`);
562
+ console.log(` ${s.bold(s.green("yarn"))}`), console.log(` ${s.bold(s.green("yarn serve"))}`);
553
563
  }
554
- kn().catch((e) => {
564
+ On().catch((e) => {
555
565
  console.error(e);
556
566
  });
@@ -23,9 +23,9 @@
23
23
  "@types/node": "^20.10.5",
24
24
  "@typescript-eslint/eslint-plugin": "^6.16.0",
25
25
  "@typescript-eslint/parser": "^6.16.0",
26
- "@vc-shell/api-client-generator": "^1.0.202",
27
- "@vc-shell/release-config": "^1.0.202",
28
- "@vc-shell/ts-config": "^1.0.202",
26
+ "@vc-shell/api-client-generator": "^1.0.204",
27
+ "@vc-shell/release-config": "^1.0.204",
28
+ "@vc-shell/ts-config": "^1.0.204",
29
29
  "@vitejs/plugin-vue": "^5.0.3",
30
30
  "@vue/eslint-config-prettier": "^9.0.0",
31
31
  "@vue/eslint-config-typescript": "^12.0.0",
@@ -55,8 +55,8 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@fortawesome/fontawesome-free": "^5.15.3",
58
- "@vc-shell/config-generator": "^1.0.202",
59
- "@vc-shell/framework": "^1.0.202",
58
+ "@vc-shell/config-generator": "^1.0.204",
59
+ "@vc-shell/framework": "^1.0.204",
60
60
  "@vueuse/core": "^10.7.1",
61
61
  "@vueuse/integrations": "^10.7.1",
62
62
  "moment": "^2.30.1",