@vc-shell/create-vc-app 1.0.131 → 1.0.133

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 (22) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/templates/base/package.json +9 -7
  3. package/dist/templates/variants/both/src/main.ts +1 -1
  4. package/dist/templates/variants/both/src/modules/classic-module/composables/useDetails/index.ts +11 -9
  5. package/dist/templates/variants/both/src/modules/classic-module/composables/useList/index.ts +10 -3
  6. package/dist/templates/variants/both/src/modules/classic-module/locales/en.json +3 -0
  7. package/dist/templates/variants/both/src/modules/classic-module/pages/details.vue +3 -1
  8. package/dist/templates/variants/both/src/modules/classic-module/pages/list.vue +8 -6
  9. package/dist/templates/variants/both/src/modules/dynamic-module/composables/useDetails/index.ts +5 -15
  10. package/dist/templates/variants/both/src/modules/dynamic-module/composables/useList/index.ts +10 -3
  11. package/dist/templates/variants/both/src/modules/dynamic-module/locales/en.json +3 -0
  12. package/dist/templates/variants/classic/src/main.ts +1 -1
  13. package/dist/templates/variants/classic/src/modules/classic-module/composables/useDetails/index.ts +11 -9
  14. package/dist/templates/variants/classic/src/modules/classic-module/composables/useList/index.ts +10 -3
  15. package/dist/templates/variants/classic/src/modules/classic-module/locales/en.json +3 -0
  16. package/dist/templates/variants/classic/src/modules/classic-module/pages/details.vue +4 -1
  17. package/dist/templates/variants/classic/src/modules/classic-module/pages/list.vue +8 -6
  18. package/dist/templates/variants/dynamic/src/main.ts +1 -1
  19. package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/useDetails/index.ts +6 -9
  20. package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/useList/index.ts +11 -4
  21. package/dist/templates/variants/dynamic/src/modules/dynamic-module/locales/en.json +3 -0
  22. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## [1.0.133](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.132...v1.0.133) (2023-12-28)
2
+
3
+
4
+
5
+ ## [1.0.132](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.131...v1.0.132) (2023-12-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * **create-vc-app:** strict types ([f336f8d](https://github.com/VirtoCommerce/vc-shell/commit/f336f8daaddd5268f0c68a625bcb1dc7719f542f))
11
+
12
+
13
+
1
14
  ## [1.0.131](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.130...v1.0.131) (2023-12-28)
2
15
 
3
16
 
@@ -11,7 +11,8 @@
11
11
  "build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist/types",
12
12
  "type-check": "vue-tsc --noEmit",
13
13
  "lint-staged": "lint-staged",
14
- "generate:api-client": "cross-env api-client-generator --color -- APP_PLATFORM_MODULES='[]' APP_API_CLIENT_DIRECTORY=./src/api_client/",
14
+ "lint": "eslint --fix --cache '**/*.{ts,vue}'",
15
+ "generate:api-client": "cross-env api-client-generator --APP_PLATFORM_MODULES='[]' --APP_API_CLIENT_DIRECTORY=./src/api_client/",
15
16
  "release": "tsx scripts/release.ts --dry"
16
17
  },
17
18
  "devDependencies": {
@@ -22,9 +23,9 @@
22
23
  "@types/lodash-es": "^4.17.7",
23
24
  "@typescript-eslint/eslint-plugin": "^6.13.2",
24
25
  "@typescript-eslint/parser": "^6.13.2",
25
- "@vc-shell/api-client-generator": "^1.0.131",
26
- "@vc-shell/release-config": "^1.0.128",
27
- "@vc-shell/ts-config": "^1.0.131",
26
+ "@vc-shell/api-client-generator": "^1.0.133",
27
+ "@vc-shell/release-config": "^1.0.133",
28
+ "@vc-shell/ts-config": "^1.0.133",
28
29
  "@vitejs/plugin-vue": "^4.5.1",
29
30
  "@vue/eslint-config-prettier": "^8.0.0",
30
31
  "@vue/eslint-config-typescript": "^12.0.0",
@@ -55,8 +56,8 @@
55
56
  },
56
57
  "dependencies": {
57
58
  "@fortawesome/fontawesome-free": "^5.15.3",
58
- "@vc-shell/config-generator": "^1.0.131",
59
- "@vc-shell/framework": "^1.0.131",
59
+ "@vc-shell/config-generator": "^1.0.133",
60
+ "@vc-shell/framework": "^1.0.133",
60
61
  "@vueuse/core": "^10.7.0",
61
62
  "@vueuse/integrations": "^10.7.0",
62
63
  "moment": "^2.29.4",
@@ -66,7 +67,8 @@
66
67
  "vue-router": "^4.2.5"
67
68
  },
68
69
  "lint-staged": {
69
- "*.{js,ts,vue}": "eslint --fix"
70
+ "*.{js,ts,html,css}": "prettier --write '**/*.{ts,vue}'",
71
+ "*.{js,ts,vue}": "eslint --fix --cache '**/*.{ts,vue}'"
70
72
  },
71
73
  "packageManager": "yarn@3.6.4"
72
74
  }
@@ -33,7 +33,7 @@ async function startApp() {
33
33
  });
34
34
 
35
35
  app.config.errorHandler = (err) => {
36
- notification.error(err.toString(), {
36
+ notification.error((err as Error).toString(), {
37
37
  timeout: 5000,
38
38
  });
39
39
  };
@@ -1,17 +1,17 @@
1
1
  /* eslint-disable import/no-unresolved */
2
- import { computed, ref } from "vue";
2
+ import { Ref, computed, ref } from "vue";
3
3
  import img1 from "/assets/1.jpeg";
4
4
  import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
6
  import { useAsync, useLoading } from "@vc-shell/framework";
7
7
 
8
8
  export default () => {
9
- const item = ref({
10
- imgSrc: undefined,
11
- name: undefined,
12
- createdDate: undefined,
13
- id: undefined,
14
- });
9
+ const item = ref({}) as Ref<{
10
+ imgSrc: string;
11
+ name: string;
12
+ createdDate: Date;
13
+ id: string;
14
+ }>;
15
15
 
16
16
  // Example mocked method for 'fetching' list data
17
17
  const { loading: itemLoading, action: getItem } = useAsync<{ id: string }>(async (payload) => {
@@ -36,8 +36,10 @@ export default () => {
36
36
  createdDate: new Date(),
37
37
  id: "item-id-3",
38
38
  },
39
- ].find((x) => x.id === payload.id);
40
- resolve(findMockedItem);
39
+ ].find((x) => x.id === payload?.id);
40
+ if (findMockedItem) {
41
+ resolve(findMockedItem);
42
+ }
41
43
  }, 1000);
42
44
  });
43
45
  });
@@ -1,12 +1,19 @@
1
1
  /* eslint-disable import/no-unresolved */
2
- import { computed, ref } from "vue";
2
+ import { Ref, computed, ref } from "vue";
3
3
  import img1 from "/assets/1.jpeg";
4
4
  import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
6
  import { useAsync, useLoading } from "@vc-shell/framework";
7
7
 
8
8
  export default () => {
9
- const data = ref([]);
9
+ const data = ref([]) as Ref<
10
+ {
11
+ imgSrc: string;
12
+ name: string;
13
+ createdDate: Date;
14
+ id: string;
15
+ }[]
16
+ >;
10
17
 
11
18
  // Example mocked method for 'fetching' list data
12
19
  const { loading: itemLoading, action: getItems } = useAsync(async (payload) => {
@@ -33,7 +40,7 @@ export default () => {
33
40
  id: "item-id-3",
34
41
  },
35
42
  ]),
36
- 1000
43
+ 1000,
37
44
  );
38
45
  });
39
46
  });
@@ -37,6 +37,9 @@
37
37
  "MOBILE": {
38
38
  "CREATED": "Created"
39
39
  }
40
+ },
41
+ "ALERTS": {
42
+ "CLOSE_CONFIRMATION": "You have unsaved changes\nClose anyway?"
40
43
  }
41
44
  }
42
45
  }
@@ -69,7 +69,9 @@ const bladeToolbar = ref<IBladeToolbar[]>([
69
69
  title: computed(() => t("MODULE.PAGES.LIST.TOOLBAR.REFRESH")),
70
70
  icon: "fas fa-sync-alt",
71
71
  async clickHandler() {
72
- await getItem({ id: props.param });
72
+ if (props.param) {
73
+ await getItem({ id: props.param });
74
+ }
73
75
  },
74
76
  },
75
77
  ]);
@@ -87,7 +87,7 @@ export interface Emits {
87
87
  (event: "parent:call", args: IParentCallArgs): void;
88
88
  (event: "collapse:blade"): void;
89
89
  (event: "expand:blade"): void;
90
- (event: "open:blade", blade: IBladeEvent);
90
+ (event: "open:blade", blade: IBladeEvent): void;
91
91
  (event: "close:blade"): void;
92
92
  }
93
93
 
@@ -96,10 +96,10 @@ defineOptions({
96
96
  name: "ClassicModuleList",
97
97
  isWorkspace: true,
98
98
  menuItem: {
99
- title: 'MODULE.MENU.TITLE',
99
+ title: "MODULE.MENU.TITLE",
100
100
  icon: "fas fa-file-alt",
101
101
  priority: 1,
102
- }
102
+ },
103
103
  });
104
104
 
105
105
  const props = withDefaults(defineProps<Props>(), {
@@ -135,7 +135,7 @@ watch(
135
135
  });
136
136
  }
137
137
  },
138
- { immediate: true }
138
+ { immediate: true },
139
139
  );
140
140
 
141
141
  onMounted(async () => {
@@ -247,7 +247,7 @@ const onHeaderClick = (item: ITableColumns) => {
247
247
  }
248
248
  };
249
249
 
250
- const actionBuilder = (item: { status: string }): IActionBuilderResult[] => {
250
+ const actionBuilder = (item: (typeof data.value)[number]): IActionBuilderResult[] => {
251
251
  const result = [];
252
252
 
253
253
  result.push({
@@ -255,7 +255,9 @@ const actionBuilder = (item: { status: string }): IActionBuilderResult[] => {
255
255
  title: "Delete",
256
256
  variant: "danger",
257
257
  leftActions: true,
258
- // clickHandler() {},
258
+ clickHandler() {
259
+ throw new Error("Function is not implemented.");
260
+ },
259
261
  });
260
262
 
261
263
  return result;
@@ -3,12 +3,7 @@ import { computed, ref, Ref } from "vue";
3
3
  import img1 from "/assets/1.jpeg";
4
4
  import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
- import {
7
- DetailsBaseBladeScope,
8
- DynamicBladeForm,
9
- IBladeToolbar,
10
- useDetailsFactory,
11
- } from "@vc-shell/framework";
6
+ import { DetailsBaseBladeScope, DynamicBladeForm, IBladeToolbar, useDetailsFactory } from "@vc-shell/framework";
12
7
 
13
8
  export interface DynamicItemScope extends DetailsBaseBladeScope {
14
9
  toolbarOverrides: {
@@ -44,7 +39,7 @@ export default (args: {
44
39
  createdDate: new Date(),
45
40
  id: "item-id-3",
46
41
  },
47
- ].find((x) => x.id === payload.id);
42
+ ].find((x) => x.id === payload?.id);
48
43
  resolve(findMockedItem);
49
44
  }, 1000);
50
45
  });
@@ -59,18 +54,13 @@ export default (args: {
59
54
 
60
55
  const { load, saveChanges, remove, loading, item, validationState } = factory();
61
56
 
62
- // const item = ref({
63
- // imgSrc: undefined,
64
- // name: undefined,
65
- // createdDate: undefined,
66
- // id: undefined,
67
- // });
68
-
69
57
  const scope = ref<DynamicItemScope>({
70
58
  toolbarOverrides: {
71
59
  refresh: {
72
60
  async clickHandler() {
73
- await load({ id: args.props.param });
61
+ if (args.props.param) {
62
+ await load({ id: args.props.param });
63
+ }
74
64
  },
75
65
  },
76
66
  },
@@ -5,6 +5,13 @@ import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
6
  import { DynamicBladeList, ListBaseBladeScope, useBladeNavigation, useListFactory } from "@vc-shell/framework";
7
7
 
8
+ interface MockedItem {
9
+ imgSrc: string;
10
+ name: string;
11
+ createdDate: Date;
12
+ id: string;
13
+ }
14
+
8
15
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
9
16
  export interface DynamicItemsScope extends ListBaseBladeScope {}
10
17
 
@@ -15,7 +22,7 @@ export default (args: {
15
22
  }) => {
16
23
  const factory = useListFactory({
17
24
  load: async () => {
18
- return await new Promise((resolve) => {
25
+ return await new Promise((resolve: (value: MockedItem[]) => void) => {
19
26
  setTimeout(
20
27
  () =>
21
28
  resolve([
@@ -38,9 +45,9 @@ export default (args: {
38
45
  id: "item-id-3",
39
46
  },
40
47
  ]),
41
- 1000
48
+ 1000,
42
49
  );
43
- }).then((res: any[]) => {
50
+ }).then((res) => {
44
51
  return { results: res, totalCount: res.length };
45
52
  });
46
53
  },
@@ -40,6 +40,9 @@
40
40
  "EMPTY": {
41
41
  "NO_ITEMS": "There are no items yet"
42
42
  }
43
+ },
44
+ "ALERTS": {
45
+ "CLOSE_CONFIRMATION": "You have unsaved changes\nClose anyway?"
43
46
  }
44
47
  }
45
48
  }
@@ -30,7 +30,7 @@ async function startApp() {
30
30
  });
31
31
 
32
32
  app.config.errorHandler = (err) => {
33
- notification.error(err.toString(), {
33
+ notification.error((err as Error).toString(), {
34
34
  timeout: 5000,
35
35
  });
36
36
  };
@@ -1,17 +1,17 @@
1
1
  /* eslint-disable import/no-unresolved */
2
- import { computed, ref } from "vue";
2
+ import { Ref, computed, ref } from "vue";
3
3
  import img1 from "/assets/1.jpeg";
4
4
  import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
6
  import { useAsync, useLoading } from "@vc-shell/framework";
7
7
 
8
8
  export default () => {
9
- const item = ref({
10
- imgSrc: undefined,
11
- name: undefined,
12
- createdDate: undefined,
13
- id: undefined,
14
- });
9
+ const item = ref({}) as Ref<{
10
+ imgSrc: string;
11
+ name: string;
12
+ createdDate: Date;
13
+ id: string;
14
+ }>;
15
15
 
16
16
  // Example mocked method for 'fetching' list data
17
17
  const { loading: itemLoading, action: getItem } = useAsync<{ id: string }>(async (payload) => {
@@ -36,8 +36,10 @@ export default () => {
36
36
  createdDate: new Date(),
37
37
  id: "item-id-3",
38
38
  },
39
- ].find((x) => x.id === payload.id);
40
- resolve(findMockedItem);
39
+ ].find((x) => x.id === payload?.id);
40
+ if (findMockedItem) {
41
+ resolve(findMockedItem);
42
+ }
41
43
  }, 1000);
42
44
  });
43
45
  });
@@ -1,12 +1,19 @@
1
1
  /* eslint-disable import/no-unresolved */
2
- import { computed, ref } from "vue";
2
+ import { Ref, computed, ref } from "vue";
3
3
  import img1 from "/assets/1.jpeg";
4
4
  import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
6
  import { useAsync, useLoading } from "@vc-shell/framework";
7
7
 
8
8
  export default () => {
9
- const data = ref([]);
9
+ const data = ref([]) as Ref<
10
+ {
11
+ imgSrc: string;
12
+ name: string;
13
+ createdDate: Date;
14
+ id: string;
15
+ }[]
16
+ >;
10
17
 
11
18
  // Example mocked method for 'fetching' list data
12
19
  const { loading: itemLoading, action: getItems } = useAsync(async (payload) => {
@@ -33,7 +40,7 @@ export default () => {
33
40
  id: "item-id-3",
34
41
  },
35
42
  ]),
36
- 1000
43
+ 1000,
37
44
  );
38
45
  });
39
46
  });
@@ -37,6 +37,9 @@
37
37
  "MOBILE": {
38
38
  "CREATED": "Created"
39
39
  }
40
+ },
41
+ "ALERTS": {
42
+ "CLOSE_CONFIRMATION": "You have unsaved changes\nClose anyway?"
40
43
  }
41
44
  }
42
45
  }
@@ -48,6 +48,7 @@ export interface Emits {
48
48
 
49
49
  defineOptions({
50
50
  url: "/classic-module-details",
51
+ name: "ClassicModuleDetails",
51
52
  });
52
53
 
53
54
  const props = withDefaults(defineProps<Props>(), {
@@ -68,7 +69,9 @@ const bladeToolbar = ref<IBladeToolbar[]>([
68
69
  title: computed(() => t("MODULE.PAGES.LIST.TOOLBAR.REFRESH")),
69
70
  icon: "fas fa-sync-alt",
70
71
  async clickHandler() {
71
- await getItem({ id: props.param });
72
+ if (props.param) {
73
+ await getItem({ id: props.param });
74
+ }
72
75
  },
73
76
  },
74
77
  ]);
@@ -87,7 +87,7 @@ export interface Emits {
87
87
  (event: "parent:call", args: IParentCallArgs): void;
88
88
  (event: "collapse:blade"): void;
89
89
  (event: "expand:blade"): void;
90
- (event: "open:blade", blade: IBladeEvent);
90
+ (event: "open:blade", blade: IBladeEvent): void;
91
91
  (event: "close:blade"): void;
92
92
  }
93
93
 
@@ -96,10 +96,10 @@ defineOptions({
96
96
  name: "ClassicModuleList",
97
97
  isWorkspace: true,
98
98
  menuItem: {
99
- title: 'MODULE.MENU.TITLE',
99
+ title: "MODULE.MENU.TITLE",
100
100
  icon: "fas fa-file-alt",
101
101
  priority: 1,
102
- }
102
+ },
103
103
  });
104
104
 
105
105
  const props = withDefaults(defineProps<Props>(), {
@@ -135,7 +135,7 @@ watch(
135
135
  });
136
136
  }
137
137
  },
138
- { immediate: true }
138
+ { immediate: true },
139
139
  );
140
140
 
141
141
  onMounted(async () => {
@@ -247,7 +247,7 @@ const onHeaderClick = (item: ITableColumns) => {
247
247
  }
248
248
  };
249
249
 
250
- const actionBuilder = (item: { status: string }): IActionBuilderResult[] => {
250
+ const actionBuilder = (item: (typeof data.value)[number]): IActionBuilderResult[] => {
251
251
  const result = [];
252
252
 
253
253
  result.push({
@@ -255,7 +255,9 @@ const actionBuilder = (item: { status: string }): IActionBuilderResult[] => {
255
255
  title: "Delete",
256
256
  variant: "danger",
257
257
  leftActions: true,
258
- // clickHandler() {},
258
+ clickHandler() {
259
+ throw new Error("Function is not implemented.");
260
+ },
259
261
  });
260
262
 
261
263
  return result;
@@ -30,7 +30,7 @@ async function startApp() {
30
30
  });
31
31
 
32
32
  app.config.errorHandler = (err) => {
33
- notification.error(err.toString(), {
33
+ notification.error((err as Error).toString(), {
34
34
  timeout: 5000,
35
35
  });
36
36
  };
@@ -1,14 +1,9 @@
1
1
  /* eslint-disable import/no-unresolved */
2
- import { Ref, computed, ref } from "vue";
2
+ import { computed, ref, Ref } from "vue";
3
3
  import img1 from "/assets/1.jpeg";
4
4
  import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
- import {
7
- DetailsBaseBladeScope,
8
- DynamicBladeForm,
9
- IBladeToolbar,
10
- useDetailsFactory,
11
- } from "@vc-shell/framework";
6
+ import { DetailsBaseBladeScope, DynamicBladeForm, IBladeToolbar, useDetailsFactory } from "@vc-shell/framework";
12
7
 
13
8
  export interface DynamicItemScope extends DetailsBaseBladeScope {
14
9
  toolbarOverrides: {
@@ -44,7 +39,7 @@ export default (args: {
44
39
  createdDate: new Date(),
45
40
  id: "item-id-3",
46
41
  },
47
- ].find((x) => x.id === payload.id);
42
+ ].find((x) => x.id === payload?.id);
48
43
  resolve(findMockedItem);
49
44
  }, 1000);
50
45
  });
@@ -63,7 +58,9 @@ export default (args: {
63
58
  toolbarOverrides: {
64
59
  refresh: {
65
60
  async clickHandler() {
66
- await load({ id: args.props.param });
61
+ if (args.props.param) {
62
+ await load({ id: args.props.param });
63
+ }
67
64
  },
68
65
  },
69
66
  },
@@ -1,10 +1,17 @@
1
1
  /* eslint-disable import/no-unresolved */
2
- import { Ref, computed, ref } from "vue";
2
+ import { computed, ref, Ref } from "vue";
3
3
  import img1 from "/assets/1.jpeg";
4
4
  import img2 from "/assets/2.jpg";
5
5
  import img3 from "/assets/3.jpg";
6
6
  import { DynamicBladeList, ListBaseBladeScope, useBladeNavigation, useListFactory } from "@vc-shell/framework";
7
7
 
8
+ interface MockedItem {
9
+ imgSrc: string;
10
+ name: string;
11
+ createdDate: Date;
12
+ id: string;
13
+ }
14
+
8
15
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
9
16
  export interface DynamicItemsScope extends ListBaseBladeScope {}
10
17
 
@@ -15,7 +22,7 @@ export default (args: {
15
22
  }) => {
16
23
  const factory = useListFactory({
17
24
  load: async () => {
18
- return await new Promise((resolve) => {
25
+ return await new Promise((resolve: (value: MockedItem[]) => void) => {
19
26
  setTimeout(
20
27
  () =>
21
28
  resolve([
@@ -38,9 +45,9 @@ export default (args: {
38
45
  id: "item-id-3",
39
46
  },
40
47
  ]),
41
- 1000
48
+ 1000,
42
49
  );
43
- }).then((res: any[]) => {
50
+ }).then((res) => {
44
51
  return { results: res, totalCount: res.length };
45
52
  });
46
53
  },
@@ -40,6 +40,9 @@
40
40
  "EMPTY": {
41
41
  "NO_ITEMS": "There are no items yet"
42
42
  }
43
+ },
44
+ "ALERTS": {
45
+ "CLOSE_CONFIRMATION": "You have unsaved changes\nClose anyway?"
43
46
  }
44
47
  }
45
48
  }
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": "1.0.131",
4
+ "version": "1.0.133",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.js",
7
7
  "files": [
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/prompts": "^2.4.4",
16
- "@vc-shell/ts-config": "^1.0.131",
16
+ "@vc-shell/ts-config": "^1.0.133",
17
17
  "copyfiles": "^2.4.1",
18
18
  "cross-env": "^7.0.3",
19
19
  "shx": "^0.3.4",