@vc-shell/create-vc-app 2.5.0 → 2.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/engine/helpers.d.ts +1 -0
- package/dist/engine/helpers.d.ts.map +1 -1
- package/dist/index.js +27 -18
- package/dist/templates/dynamic-module/_gitignore +4 -4
- package/dist/templates/dynamic-module/_package.json.ejs +3 -3
- package/dist/templates/dynamic-module/tsconfig.json +10 -10
- package/dist/templates/dynamic-module/vite.config.mts.ejs +3 -3
- package/dist/templates/module/composables/index.ts.ejs +2 -2
- package/dist/templates/module/composables/useList.ts.ejs +16 -7
- package/dist/templates/module/locales/index.ts +2 -2
- package/dist/templates/module/pages/index.ts.ejs +2 -2
- package/dist/templates/sample-module/composables/index.ts +2 -2
- package/dist/templates/sample-module/locales/index.ts +2 -2
- package/dist/templates/sample-module/pages/index.ts +2 -2
- package/dist/templates/sample-module/sample-data/index.ts +2 -2
- package/dist/templates/sample-module/sample-data/methods.ts +65 -65
- package/dist/templates/standalone/LICENSE +12 -12
- package/dist/templates/standalone/README.md +54 -54
- package/dist/templates/standalone/_browserslistrc +3 -3
- package/dist/templates/standalone/_commitlintrc.json +3 -3
- package/dist/templates/standalone/_editorconfig +22 -22
- package/dist/templates/standalone/_env.ejs +3 -3
- package/dist/templates/standalone/_env.local.ejs +1 -1
- package/dist/templates/standalone/_github/COMMIT_CONVENTION.md +91 -91
- package/dist/templates/standalone/_github/PULL_REQUEST_TEMPLATE.md +11 -11
- package/dist/templates/standalone/_gitignore +71 -71
- package/dist/templates/standalone/_package.json.ejs +7 -4
- package/dist/templates/standalone/_prettierignore +4 -4
- package/dist/templates/standalone/_prettierrc +4 -4
- package/dist/templates/standalone/_vscode/extensions.json +12 -12
- package/dist/templates/standalone/_vscode/settings.json +9 -9
- package/dist/templates/standalone/index.html.ejs +27 -27
- package/dist/templates/standalone/postcss.config.cjs +6 -6
- package/dist/templates/standalone/public/assets/logo-white.svg +21 -21
- package/dist/templates/standalone/public/assets/logo.svg +8 -8
- package/dist/templates/standalone/public/img/icons/safari-pinned-tab.svg +32 -32
- package/dist/templates/standalone/src/composables/index.ts +1 -1
- package/dist/templates/standalone/src/env.d.ts +9 -9
- package/dist/templates/standalone/src/locales/index.ts +2 -2
- package/dist/templates/standalone/src/main.ts.ejs +10 -0
- package/dist/templates/standalone/src/router/index.ts +10 -10
- package/dist/templates/standalone/tailwind.config.ts +7 -7
- package/dist/templates/standalone/vite.config.mts.ejs +6 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ npx @vc-shell/create-vc-app my-module --type dynamic-module --module-name "Revie
|
|
|
39
39
|
| `--tenant-routes` | Include tenant routing (`/:tenantId` prefix) | `false` |
|
|
40
40
|
| `--ai-agent` | Include AI Agent configuration | `false` |
|
|
41
41
|
| `--dashboard` | Include Dashboard with widgets | `false` |
|
|
42
|
+
| `--module-federation` | Include Module Federation host runtime | `false` |
|
|
42
43
|
| `--mocks` | Include sample module with mock data | `false` |
|
|
43
44
|
| `--overwrite` | Overwrite existing files without confirmation | `false` |
|
|
44
45
|
| `--help`, `-h` | Show help | — |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAC;AAsBxE,wBAAsB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAC;AAsBxE,wBAAsB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoOpF"}
|
package/dist/engine/helpers.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/engine/helpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOvD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/engine/helpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOvD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CA8BnC"}
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { exit as J, argv as Y } from "node:process";
|
|
|
6
6
|
import { fileURLToPath as Z } from "node:url";
|
|
7
7
|
import P from "prompts";
|
|
8
8
|
import i from "node:fs";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const q = "2.
|
|
9
|
+
import R from "ejs";
|
|
10
|
+
import _ from "prettier";
|
|
11
|
+
const q = "2.6.0-rc.0", W = {
|
|
12
12
|
version: q
|
|
13
13
|
};
|
|
14
14
|
function v(e) {
|
|
@@ -46,7 +46,7 @@ function U(e) {
|
|
|
46
46
|
ModuleNameScreamingSnake: t ? O(t) : "",
|
|
47
47
|
ModuleNameSentenceCase: t ? x(t) : ""
|
|
48
48
|
};
|
|
49
|
-
return e.projectName && (o.AppName = v(e.projectName), o.AppNameSentenceCase = x(e.projectName)), e.packageName !== void 0 && (o.PackageName = e.packageName || "", o.BasePath = e.basePath || "", o.tenantRoutes = e.tenantRoutes || !1, o.aiAgent = e.aiAgent || !1, o.dashboard = e.dashboard || !1, o.mocks = e.mocks || !1), o;
|
|
49
|
+
return e.projectName && (o.AppName = v(e.projectName), o.AppNameSentenceCase = x(e.projectName)), e.packageName !== void 0 && (o.PackageName = e.packageName || "", o.BasePath = e.basePath || "", o.tenantRoutes = e.tenantRoutes || !1, o.aiAgent = e.aiAgent || !1, o.dashboard = e.dashboard || !1, o.moduleFederation = e.moduleFederation || !1, o.mocks = e.mocks || !1), o;
|
|
50
50
|
}
|
|
51
51
|
const H = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".pdf", ".zip"]), X = {
|
|
52
52
|
_gitignore: ".gitignore",
|
|
@@ -71,7 +71,7 @@ function Q(e, t, n) {
|
|
|
71
71
|
if (H.has(a))
|
|
72
72
|
i.copyFileSync(e, t);
|
|
73
73
|
else {
|
|
74
|
-
const l = i.readFileSync(e, "utf-8"), s =
|
|
74
|
+
const l = i.readFileSync(e, "utf-8"), s = R.render(l, n, { filename: e });
|
|
75
75
|
i.writeFileSync(t, s);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -82,7 +82,7 @@ function j(e, t, n) {
|
|
|
82
82
|
const l = m.join(e, a), s = a.endsWith(".ejs") ? a.slice(0, -4) : a;
|
|
83
83
|
let c = X[s] ?? s;
|
|
84
84
|
try {
|
|
85
|
-
c =
|
|
85
|
+
c = R.render(c, n);
|
|
86
86
|
} catch {
|
|
87
87
|
}
|
|
88
88
|
const d = m.join(t, c);
|
|
@@ -116,9 +116,9 @@ async function z(e) {
|
|
|
116
116
|
let n = 0;
|
|
117
117
|
for (const o of t)
|
|
118
118
|
try {
|
|
119
|
-
const a = await
|
|
119
|
+
const a = await _.getFileInfo(o, { resolveConfig: !0 });
|
|
120
120
|
if (!a.inferredParser || a.ignored) continue;
|
|
121
|
-
const l = i.readFileSync(o, "utf-8"), s = await
|
|
121
|
+
const l = i.readFileSync(o, "utf-8"), s = await _.resolveConfig(o, { editorconfig: !0 }), c = await _.format(l, { ...s, filepath: o });
|
|
122
122
|
c !== l && (i.writeFileSync(o, c), n++);
|
|
123
123
|
} catch {
|
|
124
124
|
}
|
|
@@ -156,12 +156,12 @@ ${n && e.moduleName ? `
|
|
|
156
156
|
function ae(e) {
|
|
157
157
|
return e.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase().replace(/[^a-z0-9-]/g, "");
|
|
158
158
|
}
|
|
159
|
-
const
|
|
159
|
+
const F = [
|
|
160
160
|
{ title: "Standalone App — full application with bundled modules", value: "standalone" },
|
|
161
161
|
{ title: "Dynamic Module — remote module loaded by host via Module Federation", value: "dynamic-module" }
|
|
162
162
|
];
|
|
163
163
|
function re(e) {
|
|
164
|
-
return typeof e == "string" &&
|
|
164
|
+
return typeof e == "string" && F.some((t) => t.value === e);
|
|
165
165
|
}
|
|
166
166
|
async function se(e, t) {
|
|
167
167
|
const n = process.cwd();
|
|
@@ -172,7 +172,7 @@ async function se(e, t) {
|
|
|
172
172
|
a = a || l;
|
|
173
173
|
const y = m.resolve(n, a);
|
|
174
174
|
if (!re(e.type)) {
|
|
175
|
-
const S =
|
|
175
|
+
const S = F.map(($) => $.value).join(", ");
|
|
176
176
|
console.error(r.red(`Unknown project type: "${e.type}". Valid types: ${S}`)), process.exit(1);
|
|
177
177
|
}
|
|
178
178
|
i.existsSync(y) && !T(y) && !e.overwrite && (console.error(r.red(`Target directory "${a}" is not empty. Use --overwrite to overwrite.`)), process.exit(1));
|
|
@@ -186,6 +186,7 @@ async function se(e, t) {
|
|
|
186
186
|
tenantRoutes: e["tenant-routes"] || !1,
|
|
187
187
|
aiAgent: e["ai-agent"] || !1,
|
|
188
188
|
dashboard: e.dashboard || !1,
|
|
189
|
+
moduleFederation: e["module-federation"] || !1,
|
|
189
190
|
mocks: e.mocks || !1
|
|
190
191
|
};
|
|
191
192
|
} else {
|
|
@@ -211,8 +212,8 @@ async function se(e, t) {
|
|
|
211
212
|
message: () => (a === "." ? "Current directory" : `Target directory "${a}"`) + " is not empty. Remove existing files and continue?"
|
|
212
213
|
},
|
|
213
214
|
{
|
|
214
|
-
type: (w, { overwrite:
|
|
215
|
-
if (
|
|
215
|
+
type: (w, { overwrite: I }) => {
|
|
216
|
+
if (I === !1)
|
|
216
217
|
throw new Error(r.red("✖") + " Operation cancelled");
|
|
217
218
|
return null;
|
|
218
219
|
},
|
|
@@ -229,7 +230,7 @@ async function se(e, t) {
|
|
|
229
230
|
type: "select",
|
|
230
231
|
name: "projectType",
|
|
231
232
|
message: r.reset("Project type:"),
|
|
232
|
-
choices:
|
|
233
|
+
choices: F
|
|
233
234
|
}
|
|
234
235
|
],
|
|
235
236
|
{ onCancel: y }
|
|
@@ -243,7 +244,7 @@ async function se(e, t) {
|
|
|
243
244
|
},
|
|
244
245
|
{
|
|
245
246
|
name: "moduleName",
|
|
246
|
-
type: (w,
|
|
247
|
+
type: (w, I) => g === "standalone" && !I.includeModule ? null : "text",
|
|
247
248
|
message: r.reset("Module name:"),
|
|
248
249
|
initial: b,
|
|
249
250
|
format: (w) => String(w).trim()
|
|
@@ -273,6 +274,12 @@ async function se(e, t) {
|
|
|
273
274
|
message: "Include Dashboard with widgets?",
|
|
274
275
|
initial: !0
|
|
275
276
|
},
|
|
277
|
+
{
|
|
278
|
+
type: g === "dynamic-module" ? null : "confirm",
|
|
279
|
+
name: "moduleFederation",
|
|
280
|
+
message: "Include Module Federation host (load remote modules)?",
|
|
281
|
+
initial: !1
|
|
282
|
+
},
|
|
276
283
|
{
|
|
277
284
|
name: "mocks",
|
|
278
285
|
type: "confirm",
|
|
@@ -291,6 +298,7 @@ async function se(e, t) {
|
|
|
291
298
|
tenantRoutes: $.tenantRoutes || !1,
|
|
292
299
|
aiAgent: $.aiAgent || !1,
|
|
293
300
|
dashboard: $.dashboard ?? !0,
|
|
301
|
+
moduleFederation: $.moduleFederation || !1,
|
|
294
302
|
mocks: $.mocks || !1
|
|
295
303
|
};
|
|
296
304
|
} catch (f) {
|
|
@@ -477,7 +485,7 @@ async function ue(e, t) {
|
|
|
477
485
|
Module "${d}" is ready! Run ${r.bold(r.green("yarn serve"))} to see it.
|
|
478
486
|
`);
|
|
479
487
|
}
|
|
480
|
-
const
|
|
488
|
+
const D = m.resolve(Z(import.meta.url), "..", "templates");
|
|
481
489
|
function pe() {
|
|
482
490
|
console.log(`
|
|
483
491
|
${r.bold(r.green("create-vc-app"))} — Create VC Shell applications and modules
|
|
@@ -495,6 +503,7 @@ ${r.bold("Options (create):")}
|
|
|
495
503
|
--tenant-routes Include tenant routing (/:tenantId prefix)
|
|
496
504
|
--ai-agent Include AI Agent configuration
|
|
497
505
|
--dashboard Include Dashboard with widgets
|
|
506
|
+
--module-federation Include Module Federation host runtime
|
|
498
507
|
--mocks Include sample module with mock data
|
|
499
508
|
--overwrite Overwrite existing files
|
|
500
509
|
--help, -h Show this help
|
|
@@ -512,7 +521,7 @@ ${r.bold("Docs:")} https://docs.virtocommerce.org/platform/developer-guide/lates
|
|
|
512
521
|
async function fe() {
|
|
513
522
|
const e = K(Y.slice(2), {
|
|
514
523
|
alias: { h: "help", v: "version" },
|
|
515
|
-
boolean: ["help", "version", "mocks", "overwrite", "tenant-routes", "ai-agent", "dashboard"],
|
|
524
|
+
boolean: ["help", "version", "mocks", "overwrite", "tenant-routes", "ai-agent", "dashboard", "module-federation"],
|
|
516
525
|
string: ["type", "name", "app-name", "package-name", "module-name", "base-path"]
|
|
517
526
|
});
|
|
518
527
|
if (e.help) {
|
|
@@ -523,7 +532,7 @@ async function fe() {
|
|
|
523
532
|
console.log(`create-vc-app v${W.version}`);
|
|
524
533
|
return;
|
|
525
534
|
}
|
|
526
|
-
e._[0] === "add-module" ? await ue(e,
|
|
535
|
+
e._[0] === "add-module" ? await ue(e, D) : await se(e, D);
|
|
527
536
|
}
|
|
528
537
|
fe().catch((e) => {
|
|
529
538
|
console.error(r.red(e.message || String(e))), J(1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
node_modules
|
|
2
|
-
dist
|
|
3
|
-
.DS_Store
|
|
4
|
-
*.local
|
|
1
|
+
node_modules
|
|
2
|
+
dist
|
|
3
|
+
.DS_Store
|
|
4
|
+
*.local
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/node": "^20.10.5",
|
|
13
|
-
"@vc-shell/ts-config": "^2.
|
|
13
|
+
"@vc-shell/ts-config": "^2.6.0-rc.0",
|
|
14
14
|
"cross-env": "^7.0.3",
|
|
15
15
|
"sass": "^1.87.0",
|
|
16
16
|
"typescript": "^5.8.3",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"vue-tsc": "^3.2.5"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@vc-shell/config-generator": "^2.
|
|
22
|
-
"@vc-shell/framework": "^2.
|
|
21
|
+
"@vc-shell/config-generator": "^2.6.0-rc.0",
|
|
22
|
+
"@vc-shell/framework": "^2.6.0-rc.0",
|
|
23
23
|
"vue": "^3.5.30",
|
|
24
24
|
"vue-router": "^5.0.3"
|
|
25
25
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@vc-shell/ts-config/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"types": ["vite/client", "@vc-shell/framework/globals"]
|
|
8
|
-
},
|
|
9
|
-
"include": ["./src/**/*.ts", "./src/**/*.vue", "./src/**/*.json"]
|
|
10
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vc-shell/ts-config/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"types": ["vite/client", "@vc-shell/framework/globals"]
|
|
8
|
+
},
|
|
9
|
+
"include": ["./src/**/*.ts", "./src/**/*.vue", "./src/**/*.json"]
|
|
10
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { getDynamicModuleConfiguration } from "@vc-shell/mf-module";
|
|
2
|
-
|
|
3
|
-
export default getDynamicModuleConfiguration();
|
|
1
|
+
import { getDynamicModuleConfiguration } from "@vc-shell/mf-module";
|
|
2
|
+
|
|
3
|
+
export default getDynamicModuleConfiguration();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as use<%- ModuleNamePascalCase %>List } from "./useList";
|
|
2
|
-
export { default as use<%- ModuleNamePascalCase %>Details } from "./useDetails";
|
|
1
|
+
export { default as use<%- ModuleNamePascalCase %>List } from "./useList";
|
|
2
|
+
export { default as use<%- ModuleNamePascalCase %>Details } from "./useDetails";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, type Ref } from "vue";
|
|
2
|
-
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
2
|
+
import { useAsync, useLatestRequest, useLoading } from "@vc-shell/framework";
|
|
3
3
|
|
|
4
4
|
export interface <%- ModuleNamePascalCase %>ListQuery {
|
|
5
5
|
keyword?: string;
|
|
@@ -12,15 +12,24 @@ export default function use<%- ModuleNamePascalCase %>List() {
|
|
|
12
12
|
const data: Ref<Record<string, any>[]> = ref([]);
|
|
13
13
|
const totalCount = ref(0);
|
|
14
14
|
|
|
15
|
+
// The list page searches as you type. A slow answer to an earlier keyword can
|
|
16
|
+
// arrive after a newer one, so route the call through `search.latest`: it
|
|
17
|
+
// hands back `undefined` once a newer search has started.
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- used by the TODO API call below
|
|
19
|
+
const search = useLatestRequest();
|
|
20
|
+
|
|
15
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- used by the TODO API call below
|
|
16
22
|
const { loading: itemsLoading, action: getItems } = useAsync<<%- ModuleNamePascalCase %>ListQuery>(async (query) => {
|
|
17
23
|
// TODO: Replace with real API call
|
|
18
|
-
// const result = await
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
+
// const result = await search.latest(
|
|
25
|
+
// apiClient.search({
|
|
26
|
+
// keyword: query?.keyword,
|
|
27
|
+
// sort: query?.sort,
|
|
28
|
+
// skip: query?.skip ?? 0,
|
|
29
|
+
// take: query?.take ?? 20,
|
|
30
|
+
// }),
|
|
31
|
+
// );
|
|
32
|
+
// if (!result) return; // a newer search superseded this one
|
|
24
33
|
// data.value = result.results ?? [];
|
|
25
34
|
// totalCount.value = result.totalCount ?? 0;
|
|
26
35
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as en from "./en.json";
|
|
2
|
-
export { en };
|
|
1
|
+
import * as en from "./en.json";
|
|
2
|
+
export { en };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as <%- ModuleNamePascalCase %>List } from "./list.vue";
|
|
2
|
-
export { default as <%- ModuleNamePascalCase %>Details } from "./details.vue";
|
|
1
|
+
export { default as <%- ModuleNamePascalCase %>List } from "./list.vue";
|
|
2
|
+
export { default as <%- ModuleNamePascalCase %>Details } from "./details.vue";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as useList } from "./useList";
|
|
2
|
-
export { default as useDetails } from "./useDetails";
|
|
1
|
+
export { default as useList } from "./useList";
|
|
2
|
+
export { default as useDetails } from "./useDetails";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as en from "./en.json";
|
|
2
|
-
export { en };
|
|
1
|
+
import * as en from "./en.json";
|
|
2
|
+
export { en };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as List } from "./list.vue";
|
|
2
|
-
export { default as Details } from "./details.vue";
|
|
1
|
+
export { default as List } from "./list.vue";
|
|
2
|
+
export { default as Details } from "./details.vue";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./constants";
|
|
2
|
-
export * from "./methods";
|
|
1
|
+
export * from "./constants";
|
|
2
|
+
export * from "./methods";
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { type MockedItem, type MockedQuery, mockedItems } from ".";
|
|
2
|
-
|
|
3
|
-
export function loadMockItemsList(query: MockedQuery) {
|
|
4
|
-
return new Promise((resolve: (value: MockedItem[]) => void) => {
|
|
5
|
-
setTimeout(() => resolve(mockedItems), 1000);
|
|
6
|
-
}).then((res) => {
|
|
7
|
-
res = res.filter((x) => {
|
|
8
|
-
if (query.keyword) {
|
|
9
|
-
return x.name.toLowerCase().includes(query.keyword.toLowerCase());
|
|
10
|
-
}
|
|
11
|
-
return true;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
return { results: res, totalCount: res.length };
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export async function loadMockItem(args?: { id: string }) {
|
|
19
|
-
return new Promise((resolve: (value: MockedItem) => void) => {
|
|
20
|
-
setTimeout(() => {
|
|
21
|
-
const findMockedItem = mockedItems.find((x) => x.id === args?.id);
|
|
22
|
-
|
|
23
|
-
if (findMockedItem) resolve({ ...findMockedItem });
|
|
24
|
-
}, 1000);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export async function removeMockItem(args: { id: string }) {
|
|
29
|
-
new Promise((resolve: (value: boolean) => void) => {
|
|
30
|
-
setTimeout(() => {
|
|
31
|
-
const index = mockedItems.findIndex((x) => x.id === args.id);
|
|
32
|
-
|
|
33
|
-
if (index > -1) {
|
|
34
|
-
mockedItems.splice(index, 1);
|
|
35
|
-
resolve(true);
|
|
36
|
-
} else {
|
|
37
|
-
resolve(false);
|
|
38
|
-
}
|
|
39
|
-
}, 1000);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export async function addNewMockItem(args: MockedItem) {
|
|
44
|
-
return new Promise((resolve: (value: MockedItem) => void) => {
|
|
45
|
-
setTimeout(() => {
|
|
46
|
-
mockedItems.push(args);
|
|
47
|
-
resolve(args);
|
|
48
|
-
}, 1000);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export async function updateMockItem(args: MockedItem) {
|
|
53
|
-
return new Promise((resolve: (value: MockedItem) => void) => {
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
const index = mockedItems.findIndex((x) => x.id === args.id);
|
|
56
|
-
|
|
57
|
-
if (index > -1) {
|
|
58
|
-
mockedItems[index] = args;
|
|
59
|
-
resolve(args);
|
|
60
|
-
} else {
|
|
61
|
-
resolve(args);
|
|
62
|
-
}
|
|
63
|
-
}, 1000);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
1
|
+
import { type MockedItem, type MockedQuery, mockedItems } from ".";
|
|
2
|
+
|
|
3
|
+
export function loadMockItemsList(query: MockedQuery) {
|
|
4
|
+
return new Promise((resolve: (value: MockedItem[]) => void) => {
|
|
5
|
+
setTimeout(() => resolve(mockedItems), 1000);
|
|
6
|
+
}).then((res) => {
|
|
7
|
+
res = res.filter((x) => {
|
|
8
|
+
if (query.keyword) {
|
|
9
|
+
return x.name.toLowerCase().includes(query.keyword.toLowerCase());
|
|
10
|
+
}
|
|
11
|
+
return true;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return { results: res, totalCount: res.length };
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function loadMockItem(args?: { id: string }) {
|
|
19
|
+
return new Promise((resolve: (value: MockedItem) => void) => {
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
const findMockedItem = mockedItems.find((x) => x.id === args?.id);
|
|
22
|
+
|
|
23
|
+
if (findMockedItem) resolve({ ...findMockedItem });
|
|
24
|
+
}, 1000);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function removeMockItem(args: { id: string }) {
|
|
29
|
+
new Promise((resolve: (value: boolean) => void) => {
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
const index = mockedItems.findIndex((x) => x.id === args.id);
|
|
32
|
+
|
|
33
|
+
if (index > -1) {
|
|
34
|
+
mockedItems.splice(index, 1);
|
|
35
|
+
resolve(true);
|
|
36
|
+
} else {
|
|
37
|
+
resolve(false);
|
|
38
|
+
}
|
|
39
|
+
}, 1000);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function addNewMockItem(args: MockedItem) {
|
|
44
|
+
return new Promise((resolve: (value: MockedItem) => void) => {
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
mockedItems.push(args);
|
|
47
|
+
resolve(args);
|
|
48
|
+
}, 1000);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function updateMockItem(args: MockedItem) {
|
|
53
|
+
return new Promise((resolve: (value: MockedItem) => void) => {
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
const index = mockedItems.findIndex((x) => x.id === args.id);
|
|
56
|
+
|
|
57
|
+
if (index > -1) {
|
|
58
|
+
mockedItems[index] = args;
|
|
59
|
+
resolve(args);
|
|
60
|
+
} else {
|
|
61
|
+
resolve(args);
|
|
62
|
+
}
|
|
63
|
+
}, 1000);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -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.
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# VirtoCommerce Vue3 Frontend for specialized back-office applications
|
|
2
|
-
|
|
3
|
-
## Technologies used
|
|
4
|
-
|
|
5
|
-
- **Vue3.** Progressive frontend framework with its key features allows to build fast applications.
|
|
6
|
-
- **Typescript.** All components and composables have type definitions, so IDE can help you to build clean and working code.
|
|
7
|
-
- **TailwindCSS.** The most popular and growing CSS framework providing wonderful flexible structure to speed up styling.
|
|
8
|
-
- **Husky + ESLint + Prettier.** Autoformat, check and fix your code and prevent ugly codestyle within repository.
|
|
9
|
-
- **Vite.** It is faster than Webpack. Really FASTER. Use it to develop with HMR benefits and to build for production.
|
|
10
|
-
|
|
11
|
-
## Architecture
|
|
12
|
-
|
|
13
|
-
```text
|
|
14
|
-
├─ public // Static assets
|
|
15
|
-
│ ├─ assets // Static images used inside the application.
|
|
16
|
-
│ └─ img
|
|
17
|
-
│ └─ icons // Icons used for favicons, PWA, etc.
|
|
18
|
-
├─ src
|
|
19
|
-
│ ├─ api_client // Generated API clients folder
|
|
20
|
-
│ │ └─...
|
|
21
|
-
│ ├─ components // Universal Vue components
|
|
22
|
-
│ │ └─...
|
|
23
|
-
│ ├─ config // Application extras config files
|
|
24
|
-
│ │ └─ push-hub.ts // SignalR config file
|
|
25
|
-
│ ├─ locales // Locale files used to provide translated content
|
|
26
|
-
│ │ └─ en.json
|
|
27
|
-
│ ├─ modules // The collection of custom modules
|
|
28
|
-
│ │ └─ ... // Module folder
|
|
29
|
-
│ │ ├─ components // The collection of components specific for this module
|
|
30
|
-
│ │ ├─ composables // The collection of shared logic written using Composable API pattern.
|
|
31
|
-
│ │ ├─ locales // Locale files used to provide translated content specific for this module
|
|
32
|
-
│ │ ├─ pages // Set of module pages used within Application router
|
|
33
|
-
│ │ └─ index.ts // Module entry point
|
|
34
|
-
│ ├─ pages // Set of application pages used within Application router.
|
|
35
|
-
│ │ └─...
|
|
36
|
-
│ ├─ router // SPA routing configuration
|
|
37
|
-
│ │ └─...
|
|
38
|
-
│ ├─ styles // Extras application style files
|
|
39
|
-
│ │ └─ index.scss // Tailwind initialization file
|
|
40
|
-
│ └─ types // Typescript .d.ts files
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Getting started
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# install and configure package dependencies and git hooks
|
|
47
|
-
$ yarn
|
|
48
|
-
|
|
49
|
-
# build application
|
|
50
|
-
$ yarn build
|
|
51
|
-
|
|
52
|
-
# start application with hot reload at localhost:8080
|
|
53
|
-
$ yarn serve
|
|
54
|
-
```
|
|
1
|
+
# VirtoCommerce Vue3 Frontend for specialized back-office applications
|
|
2
|
+
|
|
3
|
+
## Technologies used
|
|
4
|
+
|
|
5
|
+
- **Vue3.** Progressive frontend framework with its key features allows to build fast applications.
|
|
6
|
+
- **Typescript.** All components and composables have type definitions, so IDE can help you to build clean and working code.
|
|
7
|
+
- **TailwindCSS.** The most popular and growing CSS framework providing wonderful flexible structure to speed up styling.
|
|
8
|
+
- **Husky + ESLint + Prettier.** Autoformat, check and fix your code and prevent ugly codestyle within repository.
|
|
9
|
+
- **Vite.** It is faster than Webpack. Really FASTER. Use it to develop with HMR benefits and to build for production.
|
|
10
|
+
|
|
11
|
+
## Architecture
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
├─ public // Static assets
|
|
15
|
+
│ ├─ assets // Static images used inside the application.
|
|
16
|
+
│ └─ img
|
|
17
|
+
│ └─ icons // Icons used for favicons, PWA, etc.
|
|
18
|
+
├─ src
|
|
19
|
+
│ ├─ api_client // Generated API clients folder
|
|
20
|
+
│ │ └─...
|
|
21
|
+
│ ├─ components // Universal Vue components
|
|
22
|
+
│ │ └─...
|
|
23
|
+
│ ├─ config // Application extras config files
|
|
24
|
+
│ │ └─ push-hub.ts // SignalR config file
|
|
25
|
+
│ ├─ locales // Locale files used to provide translated content
|
|
26
|
+
│ │ └─ en.json
|
|
27
|
+
│ ├─ modules // The collection of custom modules
|
|
28
|
+
│ │ └─ ... // Module folder
|
|
29
|
+
│ │ ├─ components // The collection of components specific for this module
|
|
30
|
+
│ │ ├─ composables // The collection of shared logic written using Composable API pattern.
|
|
31
|
+
│ │ ├─ locales // Locale files used to provide translated content specific for this module
|
|
32
|
+
│ │ ├─ pages // Set of module pages used within Application router
|
|
33
|
+
│ │ └─ index.ts // Module entry point
|
|
34
|
+
│ ├─ pages // Set of application pages used within Application router.
|
|
35
|
+
│ │ └─...
|
|
36
|
+
│ ├─ router // SPA routing configuration
|
|
37
|
+
│ │ └─...
|
|
38
|
+
│ ├─ styles // Extras application style files
|
|
39
|
+
│ │ └─ index.scss // Tailwind initialization file
|
|
40
|
+
│ └─ types // Typescript .d.ts files
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Getting started
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# install and configure package dependencies and git hooks
|
|
47
|
+
$ yarn
|
|
48
|
+
|
|
49
|
+
# build application
|
|
50
|
+
$ yarn build
|
|
51
|
+
|
|
52
|
+
# start application with hot reload at localhost:8080
|
|
53
|
+
$ yarn serve
|
|
54
|
+
```
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
> 1%
|
|
2
|
-
last 2 versions
|
|
3
|
-
not dead
|
|
1
|
+
> 1%
|
|
2
|
+
last 2 versions
|
|
3
|
+
not dead
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["@commitlint/config-conventional"]
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@commitlint/config-conventional"]
|
|
3
|
+
}
|