@vc-shell/create-vc-app 2.0.0-alpha.3 → 2.0.0-alpha.31
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 +2816 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.test.d.ts +2 -0
- package/dist/commands/init.test.d.ts.map +1 -0
- package/dist/engine/codegen.d.ts.map +1 -1
- package/dist/engine/helpers.d.ts +1 -1
- package/dist/engine/helpers.d.ts.map +1 -1
- package/dist/engine/helpers.test.d.ts +2 -0
- package/dist/engine/helpers.test.d.ts.map +1 -0
- package/dist/engine/template.d.ts.map +1 -1
- package/dist/engine/template.test.d.ts +2 -0
- package/dist/engine/template.test.d.ts.map +1 -0
- package/dist/index.js +172 -170
- package/dist/output.d.ts.map +1 -1
- package/dist/templates/dynamic-module/_package.json.ejs +6 -6
- package/dist/templates/dynamic-module/src/modules/index.ts.ejs +8 -5
- package/dist/templates/dynamic-module/tsconfig.json +1 -1
- package/dist/templates/dynamic-module/vite.config.mts.ejs +1 -1
- package/dist/templates/host-app/_github/COMMIT_CONVENTION.md +1 -1
- package/dist/templates/host-app/_package.json.ejs +7 -10
- package/dist/templates/host-app/src/main.ts.ejs +17 -15
- package/dist/templates/host-app/src/router/routes.ts.ejs +0 -9
- package/dist/templates/host-app/tsconfig.json +1 -0
- package/dist/templates/host-app/vite.config.mts.ejs +3 -6
- package/dist/templates/module/composables/useDetails.ts.ejs +41 -38
- package/dist/templates/module/index.ts.ejs +11 -8
- package/dist/templates/module/locales/en.json.ejs +33 -22
- package/dist/templates/module/pages/details.vue.ejs +83 -111
- package/dist/templates/module/pages/list.vue.ejs +88 -117
- package/dist/templates/sample-module/index.ts +11 -8
- package/dist/templates/sample-module/pages/details.vue +20 -47
- package/dist/templates/sample-module/pages/list.vue +107 -154
- package/dist/templates/standalone/_github/COMMIT_CONVENTION.md +1 -1
- package/dist/templates/standalone/_package.json.ejs +15 -18
- package/dist/templates/standalone/eslint.config.mjs +31 -0
- package/dist/templates/standalone/src/bootstrap.ts.ejs +5 -5
- package/dist/templates/standalone/src/main.ts.ejs +29 -23
- package/dist/templates/standalone/src/router/routes.ts.ejs +0 -9
- package/dist/templates/standalone/tsconfig.json +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/LICENSE +0 -12
- package/dist/templates/host-app/public/assets/1.jpeg +0 -0
- package/dist/templates/host-app/public/assets/2.jpg +0 -0
- package/dist/templates/host-app/public/assets/3.jpg +0 -0
- package/dist/templates/host-app/public/assets/app-select.svg +0 -11
- package/dist/templates/host-app/public/assets/avatar.jpg +0 -0
- package/dist/templates/host-app/public/assets/empty.png +0 -0
- package/dist/templates/host-app/src/shims-vue.d.ts +0 -27
- package/dist/templates/host-app/src/vue-i18n.d.ts +0 -10
- package/dist/templates/standalone/_eslintignore +0 -3
- package/dist/templates/standalone/_eslintrc.js +0 -41
- package/dist/templates/standalone/public/assets/1.jpeg +0 -0
- package/dist/templates/standalone/public/assets/2.jpg +0 -0
- package/dist/templates/standalone/public/assets/3.jpg +0 -0
- package/dist/templates/standalone/public/assets/app-select.svg +0 -11
- package/dist/templates/standalone/public/assets/avatar.jpg +0 -0
- package/dist/templates/standalone/public/assets/empty.png +0 -0
- package/dist/templates/standalone/src/shims-vue.d.ts +0 -27
- package/dist/templates/standalone/src/vue-i18n.d.ts +0 -10
|
@@ -68,7 +68,7 @@ Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`
|
|
|
68
68
|
|
|
69
69
|
### Scope
|
|
70
70
|
|
|
71
|
-
The scope could be any valid
|
|
71
|
+
The scope could be any valid workspace package name. For example `shell`, `ui-kit`, `api-client`, etc...
|
|
72
72
|
|
|
73
73
|
### Subject
|
|
74
74
|
|
|
@@ -22,9 +22,8 @@
|
|
|
22
22
|
"@types/node": "^20.10.5",
|
|
23
23
|
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
24
24
|
"@typescript-eslint/parser": "^7.4.0",
|
|
25
|
-
"@vc-shell/api-client-generator": "^2.0.0-alpha.
|
|
26
|
-
"@vc-shell/
|
|
27
|
-
"@vc-shell/ts-config": "^2.0.0-alpha.3",
|
|
25
|
+
"@vc-shell/api-client-generator": "^2.0.0-alpha.31",
|
|
26
|
+
"@vc-shell/ts-config": "^2.0.0-alpha.31",
|
|
28
27
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
29
28
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
30
29
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
@@ -49,18 +48,16 @@
|
|
|
49
48
|
"vite-plugin-checker": "^0.9.1",
|
|
50
49
|
"vite-plugin-mkcert": "^1.17.1",
|
|
51
50
|
"vue-eslint-parser": "^9.3.2",
|
|
52
|
-
"vue-tsc": "^
|
|
51
|
+
"vue-tsc": "^3.2.5"
|
|
53
52
|
},
|
|
54
53
|
"dependencies": {
|
|
55
|
-
"@vc-shell/config-generator": "^2.0.0-alpha.
|
|
56
|
-
"@vc-shell/framework": "^2.0.0-alpha.
|
|
54
|
+
"@vc-shell/config-generator": "^2.0.0-alpha.31",
|
|
55
|
+
"@vc-shell/framework": "^2.0.0-alpha.31",
|
|
57
56
|
"@vueuse/core": "^10.7.1",
|
|
58
57
|
"@vueuse/integrations": "^10.7.1",
|
|
59
|
-
"cross-spawn": "^7.0.3",
|
|
60
|
-
"moment": "^2.30.1",
|
|
61
58
|
"vee-validate": "^4.12.4",
|
|
62
|
-
"vue": "^3.5.
|
|
63
|
-
"vue-router": "^
|
|
59
|
+
"vue": "^3.5.30",
|
|
60
|
+
"vue-router": "^5.0.3"
|
|
64
61
|
},
|
|
65
62
|
"lint-staged": {
|
|
66
63
|
"*.{js,ts,html,css}": "prettier --write '**/*.{ts,vue}'",
|
|
@@ -16,24 +16,26 @@ async function startApp() {
|
|
|
16
16
|
console.log(e);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const { currentLocale, setLocale } = useLanguages();
|
|
20
|
+
|
|
21
|
+
const app = createApp(RouterView);
|
|
22
|
+
|
|
23
|
+
app.use(VirtoShellFramework, {
|
|
24
|
+
router,
|
|
25
|
+
i18n: {
|
|
26
|
+
locale: import.meta.env.APP_I18N_LOCALE,
|
|
27
|
+
fallbackLocale: import.meta.env.APP_I18N_FALLBACK_LOCALE,
|
|
28
|
+
},
|
|
26
29
|
<% if (aiAgent) { %>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
30
|
+
aiAgent: {
|
|
31
|
+
config: {
|
|
32
|
+
url: import.meta.env.APP_AI_AGENT_URL,
|
|
31
33
|
},
|
|
34
|
+
},
|
|
32
35
|
<% } %>
|
|
33
|
-
|
|
34
|
-
.use(router);
|
|
36
|
+
});
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
app.use(router);
|
|
37
39
|
|
|
38
40
|
bootstrap(app);
|
|
39
41
|
|
|
@@ -43,7 +45,7 @@ async function startApp() {
|
|
|
43
45
|
|
|
44
46
|
setLocale(currentLocale.value);
|
|
45
47
|
|
|
46
|
-
app.config.errorHandler = (err) => {
|
|
48
|
+
app.config.errorHandler = (err: unknown) => {
|
|
47
49
|
notification.error((err as Error).toString(), {
|
|
48
50
|
timeout: 5000,
|
|
49
51
|
});
|
|
@@ -43,15 +43,6 @@ export const routes: RouteRecordRaw[] = [
|
|
|
43
43
|
}),
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
|
-
<% if (tenantRoutes) { %>
|
|
47
|
-
beforeEnter: (to) => {
|
|
48
|
-
const { tenantId } = to.params;
|
|
49
|
-
if (!tenantId || new RegExp(tenantIdRegex).test(tenantId as string)) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
return { path: "/" };
|
|
53
|
-
},
|
|
54
|
-
<% } %>
|
|
55
46
|
},
|
|
56
47
|
{
|
|
57
48
|
name: "Login",
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { getApplicationConfiguration
|
|
2
|
-
import {
|
|
1
|
+
import { getApplicationConfiguration } from "@vc-shell/config-generator";
|
|
2
|
+
import { mfHostConfig } from "@vc-shell/mf-host/vite";
|
|
3
3
|
|
|
4
|
-
export default
|
|
5
|
-
getApplicationConfiguration(),
|
|
6
|
-
getHostFederationConfig(),
|
|
7
|
-
);
|
|
4
|
+
export default getApplicationConfiguration(mfHostConfig());
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
3
|
-
|
|
4
|
-
export default function use<%- ModuleNamePascalCase %>Details() {
|
|
5
|
-
const item = ref<Record<string,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { useAsync, useLoading, useModificationTracker } from "@vc-shell/framework";
|
|
3
|
+
|
|
4
|
+
export default function use<%- ModuleNamePascalCase %>Details() {
|
|
5
|
+
const item = ref<Record<string, any>>({});
|
|
6
|
+
const { isModified, resetModificationState } = useModificationTracker(item);
|
|
7
|
+
|
|
8
|
+
const { loading: itemLoading, action: fetchItem } = useAsync(async (id?: string) => {
|
|
9
|
+
// TODO: Replace with real API call
|
|
10
|
+
// const result = await apiClient.getById(id);
|
|
11
|
+
// item.value = result;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const { loading: saveLoading, action: saveAction } = useAsync(async () => {
|
|
15
|
+
// TODO: Replace with real API call
|
|
16
|
+
// if (item.value.id) {
|
|
17
|
+
// await apiClient.update(item.value);
|
|
18
|
+
// } else {
|
|
19
|
+
// await apiClient.create(item.value);
|
|
20
|
+
// }
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const loading = useLoading(itemLoading, saveLoading);
|
|
24
|
+
|
|
25
|
+
async function getItem(id: string) {
|
|
26
|
+
await fetchItem(id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function saveItem() {
|
|
30
|
+
await saveAction();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
item,
|
|
35
|
+
loading,
|
|
36
|
+
getItem,
|
|
37
|
+
saveItem,
|
|
38
|
+
isModified,
|
|
39
|
+
resetModificationState,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as locales from "./locales";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export default
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
});
|
|
9
|
+
|
|
10
|
+
export * from "./pages";
|
|
11
|
+
export * from "./composables";
|
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"<%- ModuleNameScreamingSnake %>": {
|
|
3
|
-
"MENU": {
|
|
4
|
-
"TITLE": "<%- ModuleNameSentenceCase %>"
|
|
5
|
-
},
|
|
6
|
-
"PAGES": {
|
|
7
|
-
"LIST": {
|
|
8
|
-
"TITLE": "<%- ModuleNameSentenceCase %>",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
{
|
|
2
|
+
"<%- ModuleNameScreamingSnake %>": {
|
|
3
|
+
"MENU": {
|
|
4
|
+
"TITLE": "<%- ModuleNameSentenceCase %>"
|
|
5
|
+
},
|
|
6
|
+
"PAGES": {
|
|
7
|
+
"LIST": {
|
|
8
|
+
"TITLE": "<%- ModuleNameSentenceCase %>",
|
|
9
|
+
"COLUMNS": {
|
|
10
|
+
"NAME": "Name",
|
|
11
|
+
"CREATED_DATE": "Created"
|
|
12
|
+
},
|
|
13
|
+
"TOOLBAR": {
|
|
14
|
+
"REFRESH": "Refresh",
|
|
15
|
+
"ADD": "Add"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"DETAILS": {
|
|
19
|
+
"TITLE": "<%- ModuleNameSentenceCase %> Details",
|
|
20
|
+
"TITLE_NEW": "New <%- ModuleNameSentenceCase %>",
|
|
21
|
+
"FIELDS": {
|
|
22
|
+
"NAME": "Name"
|
|
23
|
+
},
|
|
24
|
+
"TOOLBAR": {
|
|
25
|
+
"SAVE": "Save"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"ALERTS": {
|
|
30
|
+
"CLOSE_CONFIRMATION": "You have unsaved changes. Are you sure you want to close?"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,111 +1,83 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<VcBlade
|
|
3
|
-
:title="title"
|
|
4
|
-
:toolbar-items="bladeToolbar"
|
|
5
|
-
:loading="loading"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
icon: "lucide-save",
|
|
85
|
-
disabled: computed(() => !isModified.value),
|
|
86
|
-
async clickHandler() {
|
|
87
|
-
await saveItem();
|
|
88
|
-
resetModificationState();
|
|
89
|
-
emit("parent:call", { method: "reload" });
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
]);
|
|
93
|
-
|
|
94
|
-
onMounted(async () => {
|
|
95
|
-
if (props.param) {
|
|
96
|
-
await getItem(props.param);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
onBeforeClose(async () => {
|
|
101
|
-
if (isModified.value) {
|
|
102
|
-
return await showConfirmation("You have unsaved changes. Are you sure you want to close?");
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
useBeforeUnload(computed(() => isModified.value));
|
|
107
|
-
|
|
108
|
-
defineExpose({
|
|
109
|
-
title,
|
|
110
|
-
});
|
|
111
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<VcBlade
|
|
3
|
+
:title="title"
|
|
4
|
+
:toolbar-items="bladeToolbar"
|
|
5
|
+
:loading="loading"
|
|
6
|
+
width="70%"
|
|
7
|
+
>
|
|
8
|
+
<VcContainer>
|
|
9
|
+
<VcForm>
|
|
10
|
+
<!-- Add your form fields here -->
|
|
11
|
+
<VcInput
|
|
12
|
+
v-model="item.name"
|
|
13
|
+
:label="$t('<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.FIELDS.NAME')"
|
|
14
|
+
required
|
|
15
|
+
/>
|
|
16
|
+
</VcForm>
|
|
17
|
+
</VcContainer>
|
|
18
|
+
</VcBlade>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import {
|
|
23
|
+
VcBlade,
|
|
24
|
+
VcContainer,
|
|
25
|
+
VcForm,
|
|
26
|
+
VcInput,
|
|
27
|
+
useBlade,
|
|
28
|
+
useModificationTracker,
|
|
29
|
+
usePopup,
|
|
30
|
+
useBeforeUnload,
|
|
31
|
+
type IBladeToolbar,
|
|
32
|
+
} from "@vc-shell/framework";
|
|
33
|
+
import { ref, computed, onMounted } from "vue";
|
|
34
|
+
import use<%- ModuleNamePascalCase %>Details from "../composables/useDetails";
|
|
35
|
+
import { useI18n } from "vue-i18n";
|
|
36
|
+
|
|
37
|
+
defineBlade({
|
|
38
|
+
url: "/<%- ModuleName %>-details",
|
|
39
|
+
name: "<%- ModuleNamePascalCase %>Details",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const { t } = useI18n({ useScope: "global" });
|
|
43
|
+
const { param, closeSelf, callParent, onBeforeClose } = useBlade();
|
|
44
|
+
|
|
45
|
+
const { showConfirmation } = usePopup();
|
|
46
|
+
|
|
47
|
+
const { item, loading, getItem, saveItem, isModified, resetModificationState } = use<%- ModuleNamePascalCase %>Details();
|
|
48
|
+
|
|
49
|
+
const title = computed(() => {
|
|
50
|
+
return param.value
|
|
51
|
+
? String(item.value?.name || t("<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.TITLE"))
|
|
52
|
+
: t("<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.TITLE_NEW");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
56
|
+
{
|
|
57
|
+
id: "save",
|
|
58
|
+
title: t("<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.TOOLBAR.SAVE"),
|
|
59
|
+
icon: "lucide-save",
|
|
60
|
+
disabled: computed(() => !isModified.value),
|
|
61
|
+
async clickHandler() {
|
|
62
|
+
await saveItem();
|
|
63
|
+
resetModificationState();
|
|
64
|
+
callParent("reload");
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
onMounted(async () => {
|
|
70
|
+
if (param.value) {
|
|
71
|
+
await getItem(param.value);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
onBeforeClose(async () => {
|
|
76
|
+
if (isModified.value) {
|
|
77
|
+
return !(await showConfirmation(t("<%- ModuleNameScreamingSnake %>.ALERTS.CLOSE_CONFIRMATION")));
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
useBeforeUnload(computed(() => isModified.value));
|
|
83
|
+
</script>
|