@vc-shell/create-vc-app 1.0.340 → 1.1.0-alpha.2
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/CHANGELOG.md +22 -0
- package/README.md +30 -30
- package/dist/index.js +154 -186
- package/dist/templates/base/LICENSE +12 -12
- package/dist/templates/base/README.md +54 -54
- package/dist/templates/base/_browserslistrc +3 -3
- package/dist/templates/base/_commitlintrc.json +3 -3
- package/dist/templates/base/_editorconfig +22 -22
- package/dist/templates/base/_env +3 -3
- package/dist/templates/base/_env.local +1 -1
- package/dist/templates/base/_eslintignore +3 -3
- package/dist/templates/base/_eslintrc.js +41 -41
- package/dist/templates/base/_github/COMMIT_CONVENTION.md +91 -91
- package/dist/templates/base/_github/PULL_REQUEST_TEMPLATE.md +8 -8
- package/dist/templates/base/_gitignore +71 -71
- package/dist/templates/base/_husky/commit-msg +4 -4
- package/dist/templates/base/_husky/pre-commit +4 -4
- package/dist/templates/base/_package.json +5 -6
- package/dist/templates/base/_prettierignore +4 -4
- package/dist/templates/base/_prettierrc +4 -4
- package/dist/templates/base/_vscode/extensions.json +14 -14
- package/dist/templates/base/_vscode/settings.json +14 -14
- package/dist/templates/base/_yarn/releases/yarn-4.0.2.cjs +893 -893
- package/dist/templates/base/_yarnrc.yml +7 -7
- package/dist/templates/base/index.html +26 -26
- package/dist/templates/base/postcss.config.cjs +6 -6
- package/dist/templates/base/public/assets/app-select.svg +11 -11
- package/dist/templates/base/public/assets/logo-white.svg +21 -21
- package/dist/templates/base/public/assets/logo.svg +8 -8
- package/dist/templates/base/public/img/icons/safari-pinned-tab.svg +32 -32
- package/dist/templates/base/scripts/release.ts +18 -18
- package/dist/templates/base/src/api_client/README.md +78 -78
- package/dist/templates/base/src/composables/index.ts +1 -1
- package/dist/templates/base/src/env.d.ts +9 -9
- package/dist/templates/base/src/locales/en.json +3 -3
- package/dist/templates/base/src/locales/index.ts +2 -2
- package/dist/templates/base/src/router/index.ts +10 -10
- package/dist/templates/base/src/router/routes.ts +78 -78
- package/dist/templates/base/src/shims-vue.d.ts +63 -63
- package/dist/templates/base/src/styles/base.scss +38 -38
- package/dist/templates/base/src/styles/colors.scss +10 -10
- package/dist/templates/base/src/styles/custom.scss +2 -2
- package/dist/templates/base/tailwind.config.ts +7 -7
- package/dist/templates/base/tsconfig.json +16 -16
- package/dist/templates/base/vite.config.mts +5 -5
- package/dist/templates/mocks/sample-data/constants.ts +86 -86
- package/dist/templates/mocks/sample-data/index.ts +2 -2
- package/dist/templates/mocks/sample-data/methods.ts +65 -65
- package/dist/templates/modules/classic-module/composables/index.ts +2 -2
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +19 -19
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +23 -23
- package/dist/templates/modules/classic-module/index.ts +8 -8
- package/dist/templates/modules/classic-module/locales/en.json +28 -28
- package/dist/templates/modules/classic-module/locales/index.ts +2 -2
- package/dist/templates/modules/classic-module/pages/details.vue +61 -61
- package/dist/templates/modules/classic-module/pages/index.ts +2 -2
- package/dist/templates/modules/classic-module/pages/list.vue +162 -162
- package/dist/templates/modules/dynamic-module/composables/index.ts +2 -2
- package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +37 -37
- package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +49 -49
- package/dist/templates/modules/dynamic-module/index.ts +8 -8
- package/dist/templates/modules/dynamic-module/locales/en.json +35 -35
- package/dist/templates/modules/dynamic-module/locales/index.ts +2 -2
- package/dist/templates/modules/dynamic-module/pages/details.ts +20 -20
- package/dist/templates/modules/dynamic-module/pages/index.ts +4 -4
- package/dist/templates/modules/dynamic-module/pages/list.ts +35 -35
- package/dist/templates/sample/classic-module/composables/index.ts +2 -2
- package/dist/templates/sample/classic-module/composables/useDetails/index.ts +41 -41
- package/dist/templates/sample/classic-module/composables/useList/index.ts +41 -41
- package/dist/templates/sample/classic-module/index.ts +8 -8
- package/dist/templates/sample/classic-module/locales/en.json +59 -59
- package/dist/templates/sample/classic-module/locales/index.ts +2 -2
- package/dist/templates/sample/classic-module/pages/details.vue +257 -257
- package/dist/templates/sample/classic-module/pages/index.ts +2 -2
- package/dist/templates/sample/dynamic-module/composables/index.ts +2 -2
- package/dist/templates/sample/dynamic-module/composables/useDetails/index.ts +46 -46
- package/dist/templates/sample/dynamic-module/composables/useList/index.ts +50 -50
- package/dist/templates/sample/dynamic-module/index.ts +8 -8
- package/dist/templates/sample/dynamic-module/locales/en.json +69 -69
- package/dist/templates/sample/dynamic-module/locales/index.ts +2 -2
- package/dist/templates/sample/dynamic-module/pages/details.ts +100 -100
- package/dist/templates/sample/dynamic-module/pages/index.ts +4 -4
- package/dist/templates/sample/dynamic-module/pages/list.ts +81 -81
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [v1.1.0-alpha.2](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.340...vv1.1.0-alpha.2) (2025-02-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* partial redesign ([846e215](https://github.com/VirtoCommerce/vc-shell/commit/846e2152c6e48753622ca7cf3a71300323c99d51))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Reverts
|
|
10
|
+
|
|
11
|
+
* Revert "release: v1.1.0-alpha.2" ([80b0dc9](https://github.com/VirtoCommerce/vc-shell/commit/80b0dc99fdd318205f26bde81e6a49ab79214cb3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# [1.1.0-alpha.1](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.327...v1.1.0-alpha.1) (2024-11-13)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## [1.0.340](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.339...v1.0.340) (2025-02-06)
|
|
2
20
|
|
|
3
21
|
|
|
@@ -50,6 +68,10 @@
|
|
|
50
68
|
|
|
51
69
|
|
|
52
70
|
|
|
71
|
+
# [1.1.0-alpha.1](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.326...v1.1.0-alpha.1) (2024-11-13)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
53
75
|
## [1.0.327](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.326...v1.0.327) (2024-11-12)
|
|
54
76
|
|
|
55
77
|
|
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# Creating your first application
|
|
2
|
-
|
|
3
|
-
Make sure you have executed `yarn` command and your current working directory is the one where you intend to create a project.
|
|
4
|
-
|
|
5
|
-
Run following command:
|
|
6
|
-
```bash
|
|
7
|
-
$ npx create-vc-app
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
This command will execute application scaffolding tool. You will be presented with prompts:
|
|
11
|
-
|
|
12
|
-
```text
|
|
13
|
-
✔ App name: … <your-app-name>
|
|
14
|
-
✔ Add Dashboard page? … No / Yes
|
|
15
|
-
✔ Add Login/Invite/Reset password pages? … No / Yes
|
|
16
|
-
✔ Add module starter? … No / Yes
|
|
17
|
-
✔ Module starter name: … <your-first-module-name>
|
|
18
|
-
|
|
19
|
-
Scaffolding app in ./<your-app-name>...
|
|
20
|
-
|
|
21
|
-
Done.
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Once app is created, follow the instructions to install dependencies and start dev server:
|
|
26
|
-
```bash
|
|
27
|
-
$ cd <your-app-name>
|
|
28
|
-
$ yarn
|
|
29
|
-
$ yarn serve
|
|
30
|
-
```
|
|
1
|
+
# Creating your first application
|
|
2
|
+
|
|
3
|
+
Make sure you have executed `yarn` command and your current working directory is the one where you intend to create a project.
|
|
4
|
+
|
|
5
|
+
Run following command:
|
|
6
|
+
```bash
|
|
7
|
+
$ npx create-vc-app
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
This command will execute application scaffolding tool. You will be presented with prompts:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
✔ App name: … <your-app-name>
|
|
14
|
+
✔ Add Dashboard page? … No / Yes
|
|
15
|
+
✔ Add Login/Invite/Reset password pages? … No / Yes
|
|
16
|
+
✔ Add module starter? … No / Yes
|
|
17
|
+
✔ Module starter name: … <your-first-module-name>
|
|
18
|
+
|
|
19
|
+
Scaffolding app in ./<your-app-name>...
|
|
20
|
+
|
|
21
|
+
Done.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Once app is created, follow the instructions to install dependencies and start dev server:
|
|
26
|
+
```bash
|
|
27
|
+
$ cd <your-app-name>
|
|
28
|
+
$ yarn
|
|
29
|
+
$ yarn serve
|
|
30
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -1,138 +1,106 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import Ce from "prompts";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import $e from "mri";
|
|
4
|
+
import u from "chalk";
|
|
5
5
|
import i from "node:path";
|
|
6
|
-
import
|
|
7
|
-
import { fileURLToPath as
|
|
8
|
-
import { cwd as je, argv as Ae, exit as
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
], Ee = {
|
|
12
|
-
build: "vite build && yarn postbuild",
|
|
13
|
-
postbuild: "shx cp -R src/templates dist/"
|
|
14
|
-
}, Le = {
|
|
15
|
-
"@types/prompts": "^2.4.4",
|
|
16
|
-
"@vc-shell/ts-config": "^1.0.340",
|
|
17
|
-
copyfiles: "^2.4.1",
|
|
18
|
-
"cross-env": "^7.0.3",
|
|
19
|
-
shx: "^0.3.4",
|
|
20
|
-
typescript: "~5.3.3"
|
|
21
|
-
}, _e = {
|
|
22
|
-
chalk: "^2.4.2",
|
|
23
|
-
mri: "^1.2.0",
|
|
24
|
-
prompts: "^2.4.2",
|
|
25
|
-
tslib: "^2.5.3",
|
|
26
|
-
vite: "5.3.6",
|
|
27
|
-
"vite-plugin-dts": "^3.6.4"
|
|
28
|
-
}, Pe = {
|
|
29
|
-
access: "public",
|
|
30
|
-
registry: "https://registry.npmjs.org/"
|
|
31
|
-
}, ze = "yarn@4.0.2", De = {
|
|
32
|
-
name: we,
|
|
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
|
|
6
|
+
import s 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 = "1.1.0-alpha.2", Oe = {
|
|
10
|
+
version: ke
|
|
43
11
|
};
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
var r =
|
|
12
|
+
var Ne = typeof global == "object" && global && global.Object === Object && global, Me = typeof self == "object" && self && self.Object === Object && self, Te = Ne || Me || Function("return this")(), p = Te.Symbol, H = Object.prototype, Ue = H.hasOwnProperty, Ee = H.toString, y = p ? p.toStringTag : void 0;
|
|
13
|
+
function Le(e) {
|
|
14
|
+
var r = Ue.call(e, y), n = e[y];
|
|
47
15
|
try {
|
|
48
16
|
e[y] = void 0;
|
|
49
|
-
var
|
|
17
|
+
var t = !0;
|
|
50
18
|
} catch {
|
|
51
19
|
}
|
|
52
|
-
var
|
|
53
|
-
return
|
|
20
|
+
var a = Ee.call(e);
|
|
21
|
+
return t && (r ? e[y] = n : delete e[y]), a;
|
|
54
22
|
}
|
|
55
|
-
var
|
|
56
|
-
function
|
|
57
|
-
return
|
|
23
|
+
var _e = Object.prototype, Pe = _e.toString;
|
|
24
|
+
function ze(e) {
|
|
25
|
+
return Pe.call(e);
|
|
58
26
|
}
|
|
59
|
-
var
|
|
60
|
-
function
|
|
61
|
-
return e == null ? e === void 0 ?
|
|
27
|
+
var De = "[object Null]", Ze = "[object Undefined]", _ = p ? p.toStringTag : void 0;
|
|
28
|
+
function Fe(e) {
|
|
29
|
+
return e == null ? e === void 0 ? Ze : De : _ && _ in Object(e) ? Le(e) : ze(e);
|
|
62
30
|
}
|
|
63
|
-
function
|
|
31
|
+
function Ie(e) {
|
|
64
32
|
return e != null && typeof e == "object";
|
|
65
33
|
}
|
|
66
|
-
var
|
|
67
|
-
function
|
|
68
|
-
return typeof e == "symbol" ||
|
|
34
|
+
var Ve = "[object Symbol]";
|
|
35
|
+
function We(e) {
|
|
36
|
+
return typeof e == "symbol" || Ie(e) && Fe(e) == Ve;
|
|
69
37
|
}
|
|
70
|
-
function
|
|
71
|
-
for (var n = -1,
|
|
72
|
-
|
|
73
|
-
return
|
|
38
|
+
function He(e, r) {
|
|
39
|
+
for (var n = -1, t = e == null ? 0 : e.length, a = Array(t); ++n < t; )
|
|
40
|
+
a[n] = r(e[n], n, e);
|
|
41
|
+
return a;
|
|
74
42
|
}
|
|
75
|
-
var
|
|
43
|
+
var Be = Array.isArray, P = p ? p.prototype : void 0, z = P ? P.toString : void 0;
|
|
76
44
|
function B(e) {
|
|
77
45
|
if (typeof e == "string")
|
|
78
46
|
return e;
|
|
79
|
-
if (
|
|
80
|
-
return
|
|
81
|
-
if (
|
|
47
|
+
if (Be(e))
|
|
48
|
+
return He(e, B) + "";
|
|
49
|
+
if (We(e))
|
|
82
50
|
return z ? z.call(e) : "";
|
|
83
51
|
var r = e + "";
|
|
84
|
-
return r == "0" && 1 / e == -
|
|
52
|
+
return r == "0" && 1 / e == -1 / 0 ? "-0" : r;
|
|
85
53
|
}
|
|
86
54
|
function C(e) {
|
|
87
55
|
return e == null ? "" : B(e);
|
|
88
56
|
}
|
|
89
|
-
function
|
|
90
|
-
var
|
|
91
|
-
r < 0 && (r = -r >
|
|
92
|
-
for (var c = Array(
|
|
93
|
-
c[
|
|
57
|
+
function Je(e, r, n) {
|
|
58
|
+
var t = -1, a = e.length;
|
|
59
|
+
r < 0 && (r = -r > a ? 0 : a + r), n = n > a ? a : n, n < 0 && (n += a), a = r > n ? 0 : n - r >>> 0, r >>>= 0;
|
|
60
|
+
for (var c = Array(a); ++t < a; )
|
|
61
|
+
c[t] = e[t + r];
|
|
94
62
|
return c;
|
|
95
63
|
}
|
|
96
|
-
function
|
|
97
|
-
var
|
|
98
|
-
return n = n === void 0 ?
|
|
64
|
+
function Ge(e, r, n) {
|
|
65
|
+
var t = e.length;
|
|
66
|
+
return n = n === void 0 ? t : n, Je(e, r, n);
|
|
99
67
|
}
|
|
100
|
-
var
|
|
68
|
+
var Ye = "\\ud800-\\udfff", qe = "\\u0300-\\u036f", Ke = "\\ufe20-\\ufe2f", Qe = "\\u20d0-\\u20ff", Xe = qe + Ke + Qe, er = "\\ufe0e\\ufe0f", rr = "\\u200d", nr = RegExp("[" + rr + Ye + Xe + er + "]");
|
|
101
69
|
function J(e) {
|
|
102
|
-
return
|
|
70
|
+
return nr.test(e);
|
|
103
71
|
}
|
|
104
|
-
function
|
|
72
|
+
function or(e) {
|
|
105
73
|
return e.split("");
|
|
106
74
|
}
|
|
107
|
-
var G = "\\ud800-\\udfff",
|
|
108
|
-
function
|
|
109
|
-
return e.match(
|
|
75
|
+
var G = "\\ud800-\\udfff", ar = "\\u0300-\\u036f", tr = "\\ufe20-\\ufe2f", ur = "\\u20d0-\\u20ff", sr = ar + tr + ur, ir = "\\ufe0e\\ufe0f", cr = "[" + G + "]", O = "[" + sr + "]", N = "\\ud83c[\\udffb-\\udfff]", fr = "(?:" + O + "|" + N + ")", Y = "[^" + G + "]", q = "(?:\\ud83c[\\udde6-\\uddff]){2}", K = "[\\ud800-\\udbff][\\udc00-\\udfff]", lr = "\\u200d", Q = fr + "?", X = "[" + ir + "]?", dr = "(?:" + lr + "(?:" + [Y, q, K].join("|") + ")" + X + Q + ")*", mr = X + Q + dr, pr = "(?:" + [Y + O + "?", O, q, K, cr].join("|") + ")", gr = RegExp(N + "(?=" + N + ")|" + pr + mr, "g");
|
|
76
|
+
function xr(e) {
|
|
77
|
+
return e.match(gr) || [];
|
|
110
78
|
}
|
|
111
|
-
function
|
|
112
|
-
return J(e) ?
|
|
79
|
+
function br(e) {
|
|
80
|
+
return J(e) ? xr(e) : or(e);
|
|
113
81
|
}
|
|
114
82
|
function ee(e) {
|
|
115
83
|
return function(r) {
|
|
116
84
|
r = C(r);
|
|
117
|
-
var n = J(r) ?
|
|
118
|
-
return
|
|
85
|
+
var n = J(r) ? br(r) : void 0, t = n ? n[0] : r.charAt(0), a = n ? Ge(n, 1).join("") : r.slice(1);
|
|
86
|
+
return t[e]() + a;
|
|
119
87
|
};
|
|
120
88
|
}
|
|
121
89
|
var M = ee("toUpperCase");
|
|
122
|
-
function
|
|
90
|
+
function yr(e) {
|
|
123
91
|
return M(C(e).toLowerCase());
|
|
124
92
|
}
|
|
125
|
-
function
|
|
126
|
-
for (var
|
|
127
|
-
n = r(n, e[
|
|
93
|
+
function vr(e, r, n, t) {
|
|
94
|
+
for (var a = -1, c = e == null ? 0 : e.length; ++a < c; )
|
|
95
|
+
n = r(n, e[a], a, e);
|
|
128
96
|
return n;
|
|
129
97
|
}
|
|
130
|
-
function
|
|
98
|
+
function Sr(e) {
|
|
131
99
|
return function(r) {
|
|
132
100
|
return e?.[r];
|
|
133
101
|
};
|
|
134
102
|
}
|
|
135
|
-
var
|
|
103
|
+
var hr = {
|
|
136
104
|
// Latin-1 Supplement block.
|
|
137
105
|
À: "A",
|
|
138
106
|
Á: "A",
|
|
@@ -325,48 +293,48 @@ var Tr = {
|
|
|
325
293
|
œ: "oe",
|
|
326
294
|
ʼn: "'n",
|
|
327
295
|
ſ: "s"
|
|
328
|
-
},
|
|
329
|
-
function
|
|
330
|
-
return e = C(e), e && e.replace(
|
|
296
|
+
}, Cr = Sr(hr), $r = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Rr = "\\u0300-\\u036f", jr = "\\ufe20-\\ufe2f", Ar = "\\u20d0-\\u20ff", wr = Rr + jr + Ar, kr = "[" + wr + "]", Or = RegExp(kr, "g");
|
|
297
|
+
function Nr(e) {
|
|
298
|
+
return e = C(e), e && e.replace($r, Cr).replace(Or, "");
|
|
331
299
|
}
|
|
332
|
-
var
|
|
333
|
-
function
|
|
334
|
-
return e.match(
|
|
300
|
+
var Mr = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
301
|
+
function Tr(e) {
|
|
302
|
+
return e.match(Mr) || [];
|
|
335
303
|
}
|
|
336
|
-
var
|
|
337
|
-
function
|
|
338
|
-
return
|
|
304
|
+
var Ur = /[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 Er(e) {
|
|
306
|
+
return Ur.test(e);
|
|
339
307
|
}
|
|
340
|
-
var re = "\\ud800-\\udfff",
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
308
|
+
var re = "\\ud800-\\udfff", Lr = "\\u0300-\\u036f", _r = "\\ufe20-\\ufe2f", Pr = "\\u20d0-\\u20ff", zr = Lr + _r + Pr, ne = "\\u2700-\\u27bf", oe = "a-z\\xdf-\\xf6\\xf8-\\xff", Dr = "\\xac\\xb1\\xd7\\xf7", Zr = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Fr = "\\u2000-\\u206f", Ir = " \\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", ae = "A-Z\\xc0-\\xd6\\xd8-\\xde", Vr = "\\ufe0e\\ufe0f", te = Dr + Zr + Fr + Ir, ue = "['’]", D = "[" + te + "]", Wr = "[" + zr + "]", se = "\\d+", Hr = "[" + ne + "]", ie = "[" + oe + "]", ce = "[^" + re + te + se + ne + oe + ae + "]", Br = "\\ud83c[\\udffb-\\udfff]", Jr = "(?:" + Wr + "|" + Br + ")", Gr = "[^" + re + "]", fe = "(?:\\ud83c[\\udde6-\\uddff]){2}", le = "[\\ud800-\\udbff][\\udc00-\\udfff]", m = "[" + ae + "]", Yr = "\\u200d", Z = "(?:" + ie + "|" + ce + ")", qr = "(?:" + m + "|" + ce + ")", F = "(?:" + ue + "(?:d|ll|m|re|s|t|ve))?", I = "(?:" + ue + "(?:D|LL|M|RE|S|T|VE))?", de = Jr + "?", me = "[" + Vr + "]?", Kr = "(?:" + Yr + "(?:" + [Gr, fe, le].join("|") + ")" + me + de + ")*", Qr = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", Xr = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", en = me + de + Kr, rn = "(?:" + [Hr, fe, le].join("|") + ")" + en, nn = RegExp([
|
|
309
|
+
m + "?" + ie + "+" + F + "(?=" + [D, m, "$"].join("|") + ")",
|
|
310
|
+
qr + "+" + I + "(?=" + [D, m + Z, "$"].join("|") + ")",
|
|
311
|
+
m + "?" + Z + "+" + F,
|
|
312
|
+
m + "+" + I,
|
|
313
|
+
Xr,
|
|
314
|
+
Qr,
|
|
315
|
+
se,
|
|
316
|
+
rn
|
|
349
317
|
].join("|"), "g");
|
|
350
|
-
function
|
|
351
|
-
return e.match(
|
|
318
|
+
function on(e) {
|
|
319
|
+
return e.match(nn) || [];
|
|
352
320
|
}
|
|
353
|
-
function
|
|
354
|
-
return e = C(e), r = r, r === void 0 ?
|
|
321
|
+
function an(e, r, n) {
|
|
322
|
+
return e = C(e), r = r, r === void 0 ? Er(e) ? on(e) : Tr(e) : e.match(r) || [];
|
|
355
323
|
}
|
|
356
|
-
var
|
|
324
|
+
var tn = "['’]", un = RegExp(tn, "g");
|
|
357
325
|
function T(e) {
|
|
358
326
|
return function(r) {
|
|
359
|
-
return
|
|
327
|
+
return vr(an(Nr(r).replace(un, "")), e, "");
|
|
360
328
|
};
|
|
361
329
|
}
|
|
362
330
|
var V = T(function(e, r, n) {
|
|
363
|
-
return r = r.toLowerCase(), e + (n ?
|
|
364
|
-
}),
|
|
331
|
+
return r = r.toLowerCase(), e + (n ? yr(r) : r);
|
|
332
|
+
}), sn = ee("toLowerCase"), cn = T(function(e, r, n) {
|
|
365
333
|
return e + (n ? "_" : "") + r.toLowerCase();
|
|
366
|
-
}),
|
|
334
|
+
}), w = T(function(e, r, n) {
|
|
367
335
|
return e + (n ? " " : "") + M(r);
|
|
368
336
|
});
|
|
369
|
-
const
|
|
337
|
+
const fn = {
|
|
370
338
|
_gitignore: ".gitignore",
|
|
371
339
|
"_yarnrc.yml": ".yarnrc.yml",
|
|
372
340
|
_browserslistrc: ".browserslistrc",
|
|
@@ -390,23 +358,23 @@ function W(e) {
|
|
|
390
358
|
function v(e) {
|
|
391
359
|
return e.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
|
|
392
360
|
}
|
|
393
|
-
function
|
|
361
|
+
function ln(e) {
|
|
394
362
|
return e.trim().toLowerCase().replace(/\/+/g, "/").replace(/[^a-z0-9/-]+/g, "/").replace(/\/?$/, "/");
|
|
395
363
|
}
|
|
396
|
-
function
|
|
397
|
-
if (
|
|
398
|
-
|
|
364
|
+
function pe(e) {
|
|
365
|
+
if (s.existsSync(e))
|
|
366
|
+
s.readdirSync(e).forEach((r) => {
|
|
399
367
|
const n = i.join(e, r);
|
|
400
|
-
|
|
368
|
+
s.lstatSync(n).isDirectory() ? pe(n) : s.unlinkSync(n);
|
|
401
369
|
});
|
|
402
370
|
else
|
|
403
371
|
return;
|
|
404
372
|
}
|
|
405
|
-
function
|
|
406
|
-
const r =
|
|
373
|
+
function dn(e) {
|
|
374
|
+
const r = s.readdirSync(e);
|
|
407
375
|
return r.length === 0 || r.length === 1 && r[0] === ".git";
|
|
408
376
|
}
|
|
409
|
-
const
|
|
377
|
+
const mn = [
|
|
410
378
|
{
|
|
411
379
|
name: "dynamic",
|
|
412
380
|
display: "Dynamic view modules boilerplate"
|
|
@@ -415,17 +383,17 @@ const $n = [
|
|
|
415
383
|
name: "classic",
|
|
416
384
|
display: "Classic view modules boilerplate"
|
|
417
385
|
}
|
|
418
|
-
],
|
|
386
|
+
], k = {
|
|
419
387
|
classic: ["classic-module"],
|
|
420
388
|
dynamic: ["dynamic-module"]
|
|
421
389
|
};
|
|
422
|
-
async function
|
|
423
|
-
console.log(` ${
|
|
424
|
-
create-vc-app version: ${
|
|
390
|
+
async function pn() {
|
|
391
|
+
console.log(` ${u.bold(u.green(`
|
|
392
|
+
create-vc-app version: ${Oe.version}
|
|
425
393
|
`))}`);
|
|
426
394
|
const e = je();
|
|
427
|
-
let n =
|
|
428
|
-
const
|
|
395
|
+
let n = $e(Ae.slice(2))._[0];
|
|
396
|
+
const t = n || "vc-app", a = () => n === "." ? i.basename(i.resolve()) : n;
|
|
429
397
|
let c;
|
|
430
398
|
try {
|
|
431
399
|
c = await Ce(
|
|
@@ -433,43 +401,43 @@ create-vc-app version: ${De.version}
|
|
|
433
401
|
{
|
|
434
402
|
name: "appName",
|
|
435
403
|
type: n ? null : "text",
|
|
436
|
-
message:
|
|
437
|
-
initial:
|
|
438
|
-
onState: (o) => n = v(String(o.value).trim()) ||
|
|
404
|
+
message: u.reset("Project name:"),
|
|
405
|
+
initial: t,
|
|
406
|
+
onState: (o) => n = v(String(o.value).trim()) || t,
|
|
439
407
|
format: (o) => v(String(o).trim())
|
|
440
408
|
},
|
|
441
409
|
{
|
|
442
|
-
type: () => !
|
|
410
|
+
type: () => !s.existsSync(n) || dn(n) ? null : "confirm",
|
|
443
411
|
name: "overwrite",
|
|
444
412
|
message: () => (n === "." ? "Current directory" : `Target directory "${n}"`) + " is not empty. Remove existing files and continue?"
|
|
445
413
|
},
|
|
446
414
|
{
|
|
447
|
-
type: (o, { overwrite:
|
|
448
|
-
if (
|
|
449
|
-
throw new Error(
|
|
415
|
+
type: (o, { overwrite: S }) => {
|
|
416
|
+
if (S === !1)
|
|
417
|
+
throw new Error(u.red("✖") + " Operation cancelled");
|
|
450
418
|
return null;
|
|
451
419
|
},
|
|
452
420
|
name: "overwriteChecker"
|
|
453
421
|
},
|
|
454
422
|
{
|
|
455
423
|
name: "packageName",
|
|
456
|
-
type: () => W(
|
|
457
|
-
message:
|
|
458
|
-
initial: () => v(
|
|
424
|
+
type: () => W(a()) ? null : "text",
|
|
425
|
+
message: u.reset("Package name:"),
|
|
426
|
+
initial: () => v(a()),
|
|
459
427
|
validate: (o) => W(o) || "Invalid package.json name"
|
|
460
428
|
},
|
|
461
429
|
{
|
|
462
430
|
name: "basePath",
|
|
463
431
|
type: "text",
|
|
464
|
-
message:
|
|
465
|
-
initial: () => "/apps/" + v(
|
|
466
|
-
format: (o) =>
|
|
432
|
+
message: u.reset("Base path:"),
|
|
433
|
+
initial: () => "/apps/" + v(a()) + "/",
|
|
434
|
+
format: (o) => ln(String(o).trim())
|
|
467
435
|
},
|
|
468
436
|
{
|
|
469
437
|
type: "select",
|
|
470
438
|
name: "variant",
|
|
471
|
-
message:
|
|
472
|
-
choices:
|
|
439
|
+
message: u.reset("Select module variant:"),
|
|
440
|
+
choices: mn.map((o) => ({
|
|
473
441
|
title: o.display,
|
|
474
442
|
value: o.name
|
|
475
443
|
}))
|
|
@@ -477,8 +445,8 @@ create-vc-app version: ${De.version}
|
|
|
477
445
|
{
|
|
478
446
|
name: "moduleName",
|
|
479
447
|
type: "text",
|
|
480
|
-
message:
|
|
481
|
-
initial: () =>
|
|
448
|
+
message: u.reset("Module name:"),
|
|
449
|
+
initial: () => w(a()),
|
|
482
450
|
format: (o) => String(o).trim()
|
|
483
451
|
},
|
|
484
452
|
{
|
|
@@ -490,70 +458,70 @@ create-vc-app version: ${De.version}
|
|
|
490
458
|
],
|
|
491
459
|
{
|
|
492
460
|
onCancel: () => {
|
|
493
|
-
throw new Error(
|
|
461
|
+
throw new Error(u.red("✖") + " Creation cancelled");
|
|
494
462
|
}
|
|
495
463
|
}
|
|
496
464
|
);
|
|
497
465
|
} catch (o) {
|
|
498
|
-
console.log(o.message),
|
|
466
|
+
console.log(o.message), we(1);
|
|
499
467
|
}
|
|
500
|
-
const { packageName: ge, variant: g, moduleName: d, appName: U, basePath: xe, mocks: be } = c,
|
|
468
|
+
const { packageName: ge, variant: g, moduleName: d, appName: U, basePath: xe, mocks: be } = c, $ = /* @__PURE__ */ new Map([
|
|
501
469
|
["{{ModuleName}}", v(d)],
|
|
502
470
|
["{{ModuleNamePascalCase}}", M(V(d))],
|
|
503
471
|
["{{ModuleNameUppercase}}", d.toUpperCase()],
|
|
504
|
-
["{{ModuleNameUppercaseSnakeCase}}",
|
|
505
|
-
["{{ModuleNameExports}}",
|
|
506
|
-
["{{ModuleNameSentenceCase}}",
|
|
472
|
+
["{{ModuleNameUppercaseSnakeCase}}", cn(d).toUpperCase()],
|
|
473
|
+
["{{ModuleNameExports}}", sn(V(d))],
|
|
474
|
+
["{{ModuleNameSentenceCase}}", w(d)],
|
|
507
475
|
["{{AppName}}", U],
|
|
508
|
-
["{{AppNameSentenceCase}}",
|
|
476
|
+
["{{AppNameSentenceCase}}", w(U)],
|
|
509
477
|
["{{BasePath}}", xe],
|
|
510
|
-
["{{PackageName}}", ge ||
|
|
511
|
-
]),
|
|
512
|
-
|
|
513
|
-
Scaffolding app in ${
|
|
514
|
-
const ye = i.resolve(
|
|
515
|
-
function
|
|
516
|
-
const E = i.resolve(ye, o), ve =
|
|
478
|
+
["{{PackageName}}", ge || a()]
|
|
479
|
+
]), f = i.join(e, n);
|
|
480
|
+
s.existsSync(f) ? pe(f) : s.existsSync(f) || s.mkdirSync(f), console.log(`
|
|
481
|
+
Scaffolding app in ${f}...`);
|
|
482
|
+
const ye = i.resolve(Re(import.meta.url), "..", "templates");
|
|
483
|
+
function l(o, S = "") {
|
|
484
|
+
const E = i.resolve(ye, o), ve = s.readdirSync(E);
|
|
517
485
|
for (const x of ve) {
|
|
518
|
-
const
|
|
519
|
-
let
|
|
520
|
-
for (const [L, b] of
|
|
486
|
+
const R = i.join(E, x);
|
|
487
|
+
let h = fn[x] ?? x;
|
|
488
|
+
for (const [L, b] of $.entries()) {
|
|
521
489
|
const A = new RegExp(L, "g");
|
|
522
|
-
|
|
490
|
+
h = h.replace(A, b);
|
|
523
491
|
}
|
|
524
|
-
const j = i.join(
|
|
525
|
-
if (
|
|
526
|
-
|
|
492
|
+
const j = i.join(f, S, h);
|
|
493
|
+
if (s.statSync(R).isDirectory())
|
|
494
|
+
s.mkdirSync(j, { recursive: !0 }), l(i.join(o, x), i.join(S, h));
|
|
527
495
|
else if ([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".pdf", ".zip"].includes(
|
|
528
496
|
i.extname(x).toLowerCase()
|
|
529
497
|
))
|
|
530
|
-
|
|
498
|
+
s.copyFileSync(R, j);
|
|
531
499
|
else {
|
|
532
|
-
let b =
|
|
533
|
-
for (const [A,
|
|
534
|
-
const
|
|
535
|
-
b = b.replace(
|
|
500
|
+
let b = s.readFileSync(R, "utf-8");
|
|
501
|
+
for (const [A, Se] of $.entries()) {
|
|
502
|
+
const he = new RegExp(A, "g");
|
|
503
|
+
b = b.replace(he, Se);
|
|
536
504
|
}
|
|
537
|
-
|
|
505
|
+
s.writeFileSync(j, b);
|
|
538
506
|
}
|
|
539
507
|
}
|
|
540
508
|
}
|
|
541
|
-
if (
|
|
542
|
-
|
|
543
|
-
}), be && (g === "dynamic" &&
|
|
544
|
-
|
|
545
|
-
}), g === "classic" &&
|
|
546
|
-
|
|
547
|
-
}),
|
|
509
|
+
if (l("base"), k[g].forEach((o) => {
|
|
510
|
+
l(`modules/${o}`, "src/modules/" + $.get("{{ModuleName}}"));
|
|
511
|
+
}), be && (g === "dynamic" && k[g].forEach((o) => {
|
|
512
|
+
l(`sample/${o}`, "src/modules/sample");
|
|
513
|
+
}), g === "classic" && k[g].forEach((o) => {
|
|
514
|
+
l(`sample/${o}`, "src/modules/sample");
|
|
515
|
+
}), l("mocks", "src/modules/sample"), l("sample/overrides", "src")), console.log(`
|
|
548
516
|
Done. You can now run application:
|
|
549
|
-
`),
|
|
550
|
-
const o = i.relative(e,
|
|
517
|
+
`), f !== e) {
|
|
518
|
+
const o = i.relative(e, f);
|
|
551
519
|
console.log(
|
|
552
|
-
` ${
|
|
520
|
+
` ${u.bold(u.green(`cd ${o.includes(" ") ? `"${o}"` : o}`))}`
|
|
553
521
|
);
|
|
554
522
|
}
|
|
555
|
-
console.log(` ${
|
|
523
|
+
console.log(` ${u.bold(u.green("yarn"))}`), console.log(` ${u.bold(u.green("yarn serve"))}`);
|
|
556
524
|
}
|
|
557
|
-
|
|
525
|
+
pn().catch((e) => {
|
|
558
526
|
console.error(e);
|
|
559
527
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
Copyright (c) Virto Solutions LTD. All rights reserved.
|
|
2
|
-
|
|
3
|
-
Licensed under the Virto Commerce Open Software License (the "License"); you
|
|
4
|
-
may not use this file except in compliance with the License. You may
|
|
5
|
-
obtain a copy of the License at
|
|
6
|
-
|
|
7
|
-
https://virtocommerce.com/open-source-license
|
|
8
|
-
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
12
|
-
implied.
|
|
1
|
+
Copyright (c) Virto Solutions LTD. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Licensed under the Virto Commerce Open Software License (the "License"); you
|
|
4
|
+
may not use this file except in compliance with the License. You may
|
|
5
|
+
obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
https://virtocommerce.com/open-source-license
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
12
|
+
implied.
|