@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.
Files changed (61) hide show
  1. package/CHANGELOG.md +2816 -0
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.test.d.ts +2 -0
  4. package/dist/commands/init.test.d.ts.map +1 -0
  5. package/dist/engine/codegen.d.ts.map +1 -1
  6. package/dist/engine/helpers.d.ts +1 -1
  7. package/dist/engine/helpers.d.ts.map +1 -1
  8. package/dist/engine/helpers.test.d.ts +2 -0
  9. package/dist/engine/helpers.test.d.ts.map +1 -0
  10. package/dist/engine/template.d.ts.map +1 -1
  11. package/dist/engine/template.test.d.ts +2 -0
  12. package/dist/engine/template.test.d.ts.map +1 -0
  13. package/dist/index.js +172 -170
  14. package/dist/output.d.ts.map +1 -1
  15. package/dist/templates/dynamic-module/_package.json.ejs +6 -6
  16. package/dist/templates/dynamic-module/src/modules/index.ts.ejs +8 -5
  17. package/dist/templates/dynamic-module/tsconfig.json +1 -1
  18. package/dist/templates/dynamic-module/vite.config.mts.ejs +1 -1
  19. package/dist/templates/host-app/_github/COMMIT_CONVENTION.md +1 -1
  20. package/dist/templates/host-app/_package.json.ejs +7 -10
  21. package/dist/templates/host-app/src/main.ts.ejs +17 -15
  22. package/dist/templates/host-app/src/router/routes.ts.ejs +0 -9
  23. package/dist/templates/host-app/tsconfig.json +1 -0
  24. package/dist/templates/host-app/vite.config.mts.ejs +3 -6
  25. package/dist/templates/module/composables/useDetails.ts.ejs +41 -38
  26. package/dist/templates/module/index.ts.ejs +11 -8
  27. package/dist/templates/module/locales/en.json.ejs +33 -22
  28. package/dist/templates/module/pages/details.vue.ejs +83 -111
  29. package/dist/templates/module/pages/list.vue.ejs +88 -117
  30. package/dist/templates/sample-module/index.ts +11 -8
  31. package/dist/templates/sample-module/pages/details.vue +20 -47
  32. package/dist/templates/sample-module/pages/list.vue +107 -154
  33. package/dist/templates/standalone/_github/COMMIT_CONVENTION.md +1 -1
  34. package/dist/templates/standalone/_package.json.ejs +15 -18
  35. package/dist/templates/standalone/eslint.config.mjs +31 -0
  36. package/dist/templates/standalone/src/bootstrap.ts.ejs +5 -5
  37. package/dist/templates/standalone/src/main.ts.ejs +29 -23
  38. package/dist/templates/standalone/src/router/routes.ts.ejs +0 -9
  39. package/dist/templates/standalone/tsconfig.json +1 -0
  40. package/dist/types.d.ts +2 -2
  41. package/dist/types.d.ts.map +1 -1
  42. package/package.json +5 -5
  43. package/LICENSE +0 -12
  44. package/dist/templates/host-app/public/assets/1.jpeg +0 -0
  45. package/dist/templates/host-app/public/assets/2.jpg +0 -0
  46. package/dist/templates/host-app/public/assets/3.jpg +0 -0
  47. package/dist/templates/host-app/public/assets/app-select.svg +0 -11
  48. package/dist/templates/host-app/public/assets/avatar.jpg +0 -0
  49. package/dist/templates/host-app/public/assets/empty.png +0 -0
  50. package/dist/templates/host-app/src/shims-vue.d.ts +0 -27
  51. package/dist/templates/host-app/src/vue-i18n.d.ts +0 -10
  52. package/dist/templates/standalone/_eslintignore +0 -3
  53. package/dist/templates/standalone/_eslintrc.js +0 -41
  54. package/dist/templates/standalone/public/assets/1.jpeg +0 -0
  55. package/dist/templates/standalone/public/assets/2.jpg +0 -0
  56. package/dist/templates/standalone/public/assets/3.jpg +0 -0
  57. package/dist/templates/standalone/public/assets/app-select.svg +0 -11
  58. package/dist/templates/standalone/public/assets/avatar.jpg +0 -0
  59. package/dist/templates/standalone/public/assets/empty.png +0 -0
  60. package/dist/templates/standalone/src/shims-vue.d.ts +0 -27
  61. package/dist/templates/standalone/src/vue-i18n.d.ts +0 -10
@@ -2,79 +2,96 @@
2
2
  <VcBlade
3
3
  :title="title"
4
4
  width="50%"
5
- :expanded="expanded"
6
- :closable="closable"
7
5
  :toolbar-items="bladeToolbar"
8
- @close="$emit('close:blade')"
9
- @expand="$emit('expand:blade')"
10
- @collapse="$emit('collapse:blade')"
11
6
  >
12
7
  <!-- Blade contents -->
13
8
  <!-- @vue-generic {MockedItem} -->
14
- <VcTable
15
- :expanded="expanded"
16
- class="tw-grow tw-basis-0"
17
- multiselect
9
+ <VcDataTable
10
+ v-model:search-value="searchValue"
11
+ v-model:active-item-id="selectedItemId"
12
+ v-model:selection="selectedItems"
18
13
  :loading="loading"
19
- :columns="columns"
20
- :sort="sortExpression"
21
- :pages="pages"
22
- :total-count="totalCount"
23
- :search-value="searchValue"
24
- :current-page="currentPage"
25
- enable-item-actions
26
- :item-action-builder="actionBuilder"
27
- :empty="empty"
28
- :notfound="notfound"
14
+ class="tw-grow tw-basis-0"
15
+ selection-mode="multiple"
16
+ :items="data ?? []"
17
+ :row-actions="actionBuilder"
18
+ :pagination="{ currentPage, pages }"
19
+ :searchable="true"
29
20
  :search-placeholder="$t('SAMPLE_APP.PAGES.LIST.SEARCH.PLACEHOLDER')"
21
+ :empty-state="{
22
+ icon: 'lucide-file',
23
+ title: $t('SAMPLE_APP.PAGES.LIST.EMPTY.NO_ITEMS'),
24
+ actionLabel: $t('SAMPLE_APP.PAGES.LIST.EMPTY.ADD'),
25
+ actionHandler: addItem,
26
+ }"
27
+ :not-found-state="{
28
+ icon: 'lucide-file',
29
+ title: $t('SAMPLE_APP.PAGES.LIST.NOT_FOUND.EMPTY'),
30
+ actionLabel: $t('SAMPLE_APP.PAGES.LIST.NOT_FOUND.RESET'),
31
+ actionHandler: clearSearch,
32
+ }"
30
33
  :total-label="$t('SAMPLE_APP.PAGES.LIST.TABLE.TOTALS')"
31
- :selected-item-id="selectedItemId"
34
+ :total-count="totalCount"
32
35
  state-key="SAMPLE_APP"
33
- :items="data ?? []"
34
- @item-click="onItemClick"
35
- @header-click="onHeaderClick"
36
- @selection-changed="onSelectionChanged"
37
- @search:change="onSearchList"
36
+ @search="onSearchList"
37
+ @row-click="onItemClick"
38
38
  @pagination-click="onPaginationClick"
39
39
  >
40
- </VcTable>
40
+ <VcColumn
41
+ id="imgSrc"
42
+ :title="$t('SAMPLE_APP.PAGES.LIST.TABLE.HEADER.IMAGE')"
43
+ type="image"
44
+ width="70px"
45
+ />
46
+ <VcColumn
47
+ id="name"
48
+ :title="$t('SAMPLE_APP.PAGES.LIST.TABLE.HEADER.PRODUCT_NAME')"
49
+ :sortable="true"
50
+ :always-visible="true"
51
+ />
52
+ <VcColumn
53
+ id="description"
54
+ :title="$t('SAMPLE_APP.PAGES.LIST.TABLE.HEADER.DESCRIPTION')"
55
+ />
56
+ <VcColumn
57
+ id="price"
58
+ :title="$t('SAMPLE_APP.PAGES.LIST.TABLE.HEADER.PRICE')"
59
+ type="money"
60
+ :sortable="true"
61
+ :always-visible="true"
62
+ />
63
+ <VcColumn
64
+ id="salePrice"
65
+ :title="$t('SAMPLE_APP.PAGES.LIST.TABLE.HEADER.SALE_PRICE')"
66
+ type="money"
67
+ />
68
+ <VcColumn
69
+ id="currency.name"
70
+ :title="$t('SAMPLE_APP.PAGES.LIST.TABLE.HEADER.CURRENCY')"
71
+ />
72
+ </VcDataTable>
41
73
  </VcBlade>
42
74
  </template>
43
75
 
44
76
  <script lang="ts" setup>
45
- import { computed, ref, markRaw, onMounted, watch } from "vue";
77
+ import { computed, ref, onMounted, watch } from "vue";
46
78
  import {
47
- IActionBuilderResult,
48
79
  IBladeToolbar,
49
- IParentCallArgs,
50
- ITableColumns,
51
- useBladeNavigation,
80
+ useBlade,
52
81
  usePopup,
53
82
  useTableSort,
54
83
  useFunctions,
84
+ VcColumn,
85
+ VcDataTable,
55
86
  } from "@vc-shell/framework";
87
+ import type { TableAction } from "@vc-shell/framework";
56
88
  import { useI18n } from "vue-i18n";
57
89
  import { useList } from "./../composables";
58
- import Details from "./details.vue";
59
90
  import { MockedItem } from "./../composables/useList";
60
91
 
61
- export interface Props {
62
- expanded?: boolean;
63
- closable?: boolean;
64
- param?: string;
65
- options?: Record<string, unknown>;
66
- }
67
-
68
- export interface Emits {
69
- (event: "parent:call", args: IParentCallArgs): void;
70
- (event: "collapse:blade"): void;
71
- (event: "expand:blade"): void;
72
- (event: "close:blade"): void;
73
- }
74
-
75
- defineOptions({
76
- url: "/sample-list",
92
+ defineBlade({
77
93
  name: "SampleList",
94
+ url: "/sample-list",
78
95
  isWorkspace: true,
79
96
  menuItem: {
80
97
  title: "SAMPLE_APP.MENU.TITLE",
@@ -83,21 +100,14 @@ defineOptions({
83
100
  },
84
101
  });
85
102
 
86
- const props = withDefaults(defineProps<Props>(), {
87
- expanded: true,
88
- closable: true,
89
- });
90
-
91
- defineEmits<Emits>();
92
-
93
103
  const { t } = useI18n({ useScope: "global" });
94
- const { openBlade } = useBladeNavigation();
104
+ const { param, openBlade, exposeToChildren } = useBlade();
95
105
  const { showConfirmation } = usePopup();
96
106
  const { debounce } = useFunctions();
97
107
 
98
- const { sortExpression, handleSortChange: tableSortHandler } = useTableSort({
99
- initialDirection: "DESC",
108
+ const { sortExpression } = useTableSort({
100
109
  initialProperty: "createdDate",
110
+ initialDirection: "DESC",
101
111
  });
102
112
 
103
113
  const { getItems, removeItems, data, loading, totalCount, pages, currentPage, searchQuery } = useList({
@@ -107,32 +117,12 @@ const { getItems, removeItems, data, loading, totalCount, pages, currentPage, se
107
117
 
108
118
  const searchValue = ref();
109
119
  const selectedItemId = ref<string>();
110
- const selectedIds = ref<string[]>([]);
120
+ const selectedItems = ref<MockedItem[]>([]);
111
121
 
112
- const empty = {
113
- icon: "lucide-file",
114
- text: computed(() => t("SAMPLE_APP.PAGES.LIST.EMPTY.NO_ITEMS")),
115
- action: computed(() => t("SAMPLE_APP.PAGES.LIST.EMPTY.ADD")),
116
- clickHandler: () => {
117
- addItem();
118
- },
119
- };
120
-
121
- const notfound = {
122
- icon: "lucide-file",
123
- text: computed(() => t("SAMPLE_APP.PAGES.LIST.NOT_FOUND.EMPTY")),
124
- action: computed(() => t("SAMPLE_APP.PAGES.LIST.NOT_FOUND.RESET")),
125
- clickHandler: async () => {
126
- searchValue.value = "";
127
- await getItems({
128
- ...searchQuery.value,
129
- keyword: "",
130
- });
131
- },
132
- };
122
+ const selectedIds = computed(() => selectedItems.value.map((item) => item.id).filter(Boolean) as string[]);
133
123
 
134
124
  watch(
135
- () => props.param,
125
+ param,
136
126
  (newVal) => {
137
127
  selectedItemId.value = newVal;
138
128
  },
@@ -146,6 +136,13 @@ onMounted(async () => {
146
136
  });
147
137
  });
148
138
 
139
+ watch(sortExpression, async (value) => {
140
+ await getItems({
141
+ ...searchQuery.value,
142
+ sort: value,
143
+ });
144
+ });
145
+
149
146
  const onSearchList = debounce(async (keyword: string) => {
150
147
  searchValue.value = keyword;
151
148
  await getItems({
@@ -154,9 +151,17 @@ const onSearchList = debounce(async (keyword: string) => {
154
151
  });
155
152
  }, 1000);
156
153
 
154
+ const clearSearch = async () => {
155
+ searchValue.value = "";
156
+ await getItems({
157
+ ...searchQuery.value,
158
+ keyword: "",
159
+ });
160
+ };
161
+
157
162
  const addItem = () => {
158
163
  openBlade({
159
- blade: markRaw(Details),
164
+ name: "SampleDetails",
160
165
  });
161
166
  };
162
167
 
@@ -187,42 +192,10 @@ const bladeToolbar = ref<IBladeToolbar[]>([
187
192
  },
188
193
  ]);
189
194
 
190
- const columns = ref<ITableColumns[]>([
191
- {
192
- id: "imgSrc",
193
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.IMAGE")),
194
- type: "image",
195
- width: "70px",
196
- },
197
- {
198
- id: "name",
199
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.PRODUCT_NAME")),
200
- alwaysVisible: true,
201
- },
202
- {
203
- id: "description",
204
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.DESCRIPTION")),
205
- },
206
- {
207
- id: "price",
208
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.PRICE")),
209
- type: "money",
210
- alwaysVisible: true,
211
- },
212
- {
213
- id: "salePrice",
214
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.SALE_PRICE")),
215
- type: "money",
216
- },
217
- {
218
- id: "currency.name",
219
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.CURRENCY")),
220
- },
221
- ]);
222
-
223
195
  const title = computed(() => t("SAMPLE_APP.PAGES.LIST.TITLE"));
224
196
 
225
197
  const reload = async () => {
198
+ selectedItems.value = [];
226
199
  await getItems({
227
200
  ...searchQuery.value,
228
201
  skip: (currentPage.value - 1) * (searchQuery.value.take ?? 10),
@@ -230,9 +203,10 @@ const reload = async () => {
230
203
  });
231
204
  };
232
205
 
233
- const onItemClick = (item: { id: string }) => {
206
+ const onItemClick = (event: { data: MockedItem; index: number; originalEvent: Event }) => {
207
+ const item = event.data;
234
208
  openBlade({
235
- blade: markRaw(Details),
209
+ name: "SampleDetails",
236
210
  param: item.id,
237
211
  onOpen() {
238
212
  selectedItemId.value = item.id;
@@ -243,32 +217,23 @@ const onItemClick = (item: { id: string }) => {
243
217
  });
244
218
  };
245
219
 
246
- const onHeaderClick = (item: ITableColumns) => {
247
- tableSortHandler(item.id);
248
- };
249
-
250
- const onSelectionChanged = (items: MockedItem[]) => {
251
- selectedIds.value = items.map((item) => item.id!);
252
- };
253
-
254
- const actionBuilder = (): IActionBuilderResult[] => {
255
- const result: IActionBuilderResult[] = [];
256
- result.push({
257
- icon: "lucide-trash-2",
258
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.ACTIONS.DELETE")),
259
- type: "danger",
260
- async clickHandler(_item: MockedItem) {
261
- if (_item.id) {
262
- if (!selectedIds.value.includes(_item.id)) {
263
- selectedIds.value.push(_item.id);
220
+ const actionBuilder = (item: MockedItem): TableAction[] => {
221
+ return [
222
+ {
223
+ icon: "lucide-trash-2",
224
+ title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.ACTIONS.DELETE")),
225
+ type: "danger",
226
+ async clickHandler() {
227
+ if (item.id) {
228
+ if (!selectedIds.value.includes(item.id)) {
229
+ selectedItems.value = [...selectedItems.value, item];
230
+ }
231
+ await remove(selectedIds.value);
232
+ selectedItems.value = [];
264
233
  }
265
- await remove(selectedIds.value);
266
- selectedIds.value = [];
267
- }
234
+ },
268
235
  },
269
- });
270
-
271
- return result;
236
+ ];
272
237
  };
273
238
 
274
239
  async function remove(ids: string[]) {
@@ -284,17 +249,5 @@ async function remove(ids: string[]) {
284
249
  }
285
250
  }
286
251
 
287
- watch(
288
- () => sortExpression.value,
289
- async (newVal) => {
290
- await getItems({
291
- sort: newVal,
292
- });
293
- },
294
- );
295
-
296
- defineExpose({
297
- title,
298
- reload,
299
- });
252
+ exposeToChildren({ reload });
300
253
  </script>
@@ -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 lerna package name (located inside `packages` folder). For example `shell`, `ui-kit`, `api-client`, etc...
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
 
@@ -20,22 +20,21 @@
20
20
  "@rollup/plugin-typescript": "^11.1.5",
21
21
  "@types/lodash-es": "^4.17.12",
22
22
  "@types/node": "^20.10.5",
23
- "@typescript-eslint/eslint-plugin": "^7.4.0",
24
- "@typescript-eslint/parser": "^7.4.0",
25
- "@vc-shell/api-client-generator": "^2.0.0-alpha.3",
26
- "@vc-shell/release-config": "^2.0.0-alpha.3",
27
- "@vc-shell/ts-config": "^2.0.0-alpha.3",
23
+ "@typescript-eslint/eslint-plugin": "^8.43.0",
24
+ "@typescript-eslint/parser": "^8.43.0",
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
- "@vue/eslint-config-prettier": "^9.0.0",
30
- "@vue/eslint-config-typescript": "^13.0.0",
28
+ "@vue/eslint-config-prettier": "^10.2.0",
29
+ "@vue/eslint-config-typescript": "^14.6.0",
31
30
  "autoprefixer": "^10.4.16",
32
31
  "conventional-changelog-cli": "^5.0.0",
33
32
  "cross-env": "^7.0.3",
34
- "eslint": "^8.57.0",
35
- "eslint-import-resolver-typescript": "^3.6.1",
33
+ "eslint": "^9.35.0",
34
+ "eslint-import-resolver-typescript": "^4.4.4",
36
35
  "eslint-plugin-import": "^2.29.1",
37
36
  "eslint-plugin-prettier": "^5.1.3",
38
- "eslint-plugin-vue": "^9.19.2",
37
+ "eslint-plugin-vue": "^10.4.0",
39
38
  "husky": "^8.0.3",
40
39
  "lint-staged": "^15.2.0",
41
40
  "lodash-es": "^4.17.21",
@@ -48,19 +47,17 @@
48
47
  "vite": "^6.3.3",
49
48
  "vite-plugin-checker": "^0.9.1",
50
49
  "vite-plugin-mkcert": "^1.17.1",
51
- "vue-eslint-parser": "^9.3.2",
52
- "vue-tsc": "^2.2.10"
50
+ "vue-eslint-parser": "^10.2.0",
51
+ "vue-tsc": "^3.2.5"
53
52
  },
54
53
  "dependencies": {
55
- "@vc-shell/config-generator": "^2.0.0-alpha.3",
56
- "@vc-shell/framework": "^2.0.0-alpha.3",
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.13",
63
- "vue-router": "^4.2.5"
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}'",
@@ -0,0 +1,31 @@
1
+ import pluginVue from "eslint-plugin-vue";
2
+ import vueTsEslintConfig from "@vue/eslint-config-typescript";
3
+ import vuePrettierConfig from "@vue/eslint-config-prettier";
4
+
5
+ export default [
6
+ {
7
+ ignores: ["**/node_modules/**", "**/dist/**", "api-client.ts"],
8
+ },
9
+
10
+ ...pluginVue.configs["flat/recommended"],
11
+
12
+ ...vueTsEslintConfig(),
13
+
14
+ vuePrettierConfig,
15
+
16
+ {
17
+ rules: {
18
+ "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
19
+ "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
20
+ "@typescript-eslint/ban-ts-comment": "warn",
21
+ "@typescript-eslint/no-explicit-any": "off",
22
+ "@typescript-eslint/no-empty-object-type": "off",
23
+ "@typescript-eslint/no-require-imports": "off",
24
+ "@typescript-eslint/no-unused-vars": "warn",
25
+ "vue/multi-word-component-names": "off",
26
+ "vue/require-default-prop": "off",
27
+ "vue/no-v-html": "off",
28
+ "vue/no-template-shadow": "off",
29
+ },
30
+ },
31
+ ];
@@ -1,13 +1,13 @@
1
1
  import { App } from "vue";
2
- import { addMenuItem<% if (dashboard) { %>, registerDashboardWidget<% } %> } from "@vc-shell/framework";
3
- <% if (dashboard) { %>
2
+ <% if (dashboard) { -%>
3
+ import { addMenuItem, registerDashboardWidget } from "@vc-shell/framework";
4
4
  import { markRaw } from "vue";
5
5
  import Welcome from "./components/dashboard-widgets/Welcome.vue";
6
- <% } %>
6
+ <% } -%>
7
7
 
8
8
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
9
  export function bootstrap(app: App) {
10
- <% if (dashboard) { %>
10
+ <% if (dashboard) { -%>
11
11
  addMenuItem({
12
12
  title: "SHELL.MENU.DASHBOARD",
13
13
  icon: "lucide-home",
@@ -22,5 +22,5 @@ export function bootstrap(app: App) {
22
22
  size: { width: 6, height: 6 },
23
23
  position: { x: 0, y: 0 },
24
24
  });
25
- <% } %>
25
+ <% } -%>
26
26
  }
@@ -3,10 +3,12 @@ import { createApp } from "vue";
3
3
  import { router } from "./router";
4
4
  import * as locales from "./locales";
5
5
  import { RouterView } from "vue-router";
6
+ <% if (hasModule) { -%>
6
7
  import <%- ModuleNamePascalCase %> from "./modules/<%- ModuleName %>";
7
- <% if (mocks) { %>
8
+ <% } -%>
9
+ <% if (mocks) { -%>
8
10
  import Sample from "./modules/sample";
9
- <% } %>
11
+ <% } -%>
10
12
  import { bootstrap } from "./bootstrap";
11
13
 
12
14
  import "@vc-shell/framework/dist/index.css";
@@ -20,28 +22,32 @@ async function startApp() {
20
22
  console.log(e);
21
23
  }
22
24
 
23
- const app = createApp(RouterView)
24
- .use(VirtoShellFramework, {
25
- router,
26
- i18n: {
27
- locale: import.meta.env.APP_I18N_LOCALE,
28
- fallbackLocale: import.meta.env.APP_I18N_FALLBACK_LOCALE,
29
- },
30
- <% if (aiAgent) { %>
31
- aiAgent: {
32
- config: {
33
- url: import.meta.env.APP_AI_AGENT_URL,
34
- },
25
+ const { currentLocale, setLocale } = useLanguages();
26
+
27
+ const app = createApp(RouterView);
28
+
29
+ app.use(VirtoShellFramework, {
30
+ router,
31
+ i18n: {
32
+ locale: import.meta.env.APP_I18N_LOCALE,
33
+ fallbackLocale: import.meta.env.APP_I18N_FALLBACK_LOCALE,
34
+ },
35
+ <% if (aiAgent) { -%>
36
+ aiAgent: {
37
+ config: {
38
+ url: import.meta.env.APP_AI_AGENT_URL,
35
39
  },
36
- <% } %>
37
- })
38
- .use(<%- ModuleNamePascalCase %>, { router })
39
- <% if (mocks) { %>
40
- .use(Sample, { router })
41
- <% } %>
42
- .use(router);
40
+ },
41
+ <% } -%>
42
+ });
43
43
 
44
- const { currentLocale, setLocale } = app.runWithContext(() => useLanguages());
44
+ <% if (hasModule) { -%>
45
+ app.use(<%- ModuleNamePascalCase %>);
46
+ <% } -%>
47
+ <% if (mocks) { -%>
48
+ app.use(Sample);
49
+ <% } -%>
50
+ app.use(router);
45
51
 
46
52
  bootstrap(app);
47
53
 
@@ -51,7 +57,7 @@ async function startApp() {
51
57
 
52
58
  setLocale(currentLocale.value);
53
59
 
54
- app.config.errorHandler = (err) => {
60
+ app.config.errorHandler = (err: unknown) => {
55
61
  notification.error((err as Error).toString(), {
56
62
  timeout: 5000,
57
63
  });
@@ -39,15 +39,6 @@ export const routes: RouteRecordRaw[] = [
39
39
  },
40
40
  <% } %>
41
41
  ],
42
- <% if (tenantRoutes) { %>
43
- beforeEnter: (to) => {
44
- const { tenantId } = to.params;
45
- if (!tenantId || new RegExp(tenantIdRegex).test(tenantId as string)) {
46
- return true;
47
- }
48
- return { path: "/" };
49
- },
50
- <% } %>
51
42
  },
52
43
  {
53
44
  name: "Login",
@@ -6,6 +6,7 @@
6
6
  "rootDir": "src",
7
7
  "types": [
8
8
  "vite/client",
9
+ "@vc-shell/framework/globals"
9
10
  ]
10
11
  },
11
12
  "include": [
package/dist/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export type ProjectType = "standalone" | "dynamic-module" | "host-app";
1
+ export type ProjectType = "standalone" | "dynamic-module";
2
2
  export interface ProjectOptions {
3
3
  projectName: string;
4
4
  packageName: string;
5
5
  projectType: ProjectType;
6
- moduleName: string;
6
+ moduleName?: string;
7
7
  basePath: string;
8
8
  tenantRoutes: boolean;
9
9
  aiAgent: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,cAAc,CAAC;IACxB,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnG,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CAC7F"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,cAAc,CAAC;IACxB,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnG,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CAC7F"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vc-shell/create-vc-app",
3
3
  "description": "Application scaffolding",
4
- "version": "2.0.0-alpha.3",
4
+ "version": "2.0.0-alpha.31",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.js",
7
7
  "files": [
@@ -9,13 +9,14 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "build": "vite build && yarn postbuild",
12
+ "test": "vitest run --config vitest.config.ts",
12
13
  "type-check": "vue-tsc --noEmit",
13
14
  "postbuild": "shx cp -R src/templates dist/"
14
15
  },
15
16
  "devDependencies": {
16
17
  "@types/ejs": "^3.1.5",
17
18
  "@types/prompts": "^2.4.4",
18
- "@vc-shell/ts-config": "2.0.0-alpha.3",
19
+ "@vc-shell/ts-config": "2.0.0-alpha.31",
19
20
  "copyfiles": "^2.4.1",
20
21
  "cross-env": "^7.0.3",
21
22
  "shx": "^0.3.4",
@@ -34,6 +35,5 @@
34
35
  "publishConfig": {
35
36
  "access": "public",
36
37
  "registry": "https://registry.npmjs.org/"
37
- },
38
- "gitHead": "23e82c2423efb5cddf8ea891ea5d5e84832a6acd"
39
- }
38
+ }
39
+ }
package/LICENSE DELETED
@@ -1,12 +0,0 @@
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.