cc-core-cli 1.0.130 → 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 (154) hide show
  1. package/bin/index.js +6 -6
  2. package/package.json +1 -1
  3. package/template/admin_v3/Dockerfile +15 -0
  4. package/template/admin_v3/README.md +1 -0
  5. package/template/admin_v3/_env +10 -0
  6. package/template/admin_v3/_gitignore +5 -0
  7. package/template/admin_v3/_npmrc +1 -0
  8. package/template/admin_v3/docker-compose.yml +11 -0
  9. package/template/admin_v3/next-env.d.ts +5 -0
  10. package/template/admin_v3/package.json +37 -0
  11. package/template/admin_v3/postcss.config.js +6 -0
  12. package/template/admin_v3/public/images/component/barchart.svg +20 -0
  13. package/template/admin_v3/public/images/component/bubble_chart.svg +17 -0
  14. package/template/admin_v3/public/images/component/button.svg +17 -0
  15. package/template/admin_v3/public/images/component/calendar.svg +63 -0
  16. package/template/admin_v3/public/images/component/checkbox.svg +25 -0
  17. package/template/admin_v3/public/images/component/color_picker.svg +25 -0
  18. package/template/admin_v3/public/images/component/cron_tab.svg +33 -0
  19. package/template/admin_v3/public/images/component/currency.svg +34 -0
  20. package/template/admin_v3/public/images/component/custom_fields.svg +34 -0
  21. package/template/admin_v3/public/images/component/data_table.svg +101 -0
  22. package/template/admin_v3/public/images/component/date_picker.svg +47 -0
  23. package/template/admin_v3/public/images/component/donut.svg +23 -0
  24. package/template/admin_v3/public/images/component/edit_table.svg +96 -0
  25. package/template/admin_v3/public/images/component/entity_field.svg +36 -0
  26. package/template/admin_v3/public/images/component/entity_layout.svg +40 -0
  27. package/template/admin_v3/public/images/component/entity_list.svg +88 -0
  28. package/template/admin_v3/public/images/component/file.svg +36 -0
  29. package/template/admin_v3/public/images/component/hidden_field.svg +34 -0
  30. package/template/admin_v3/public/images/component/image.svg +38 -0
  31. package/template/admin_v3/public/images/component/input.svg +34 -0
  32. package/template/admin_v3/public/images/component/input_icon.svg +13 -0
  33. package/template/admin_v3/public/images/component/input_number.svg +34 -0
  34. package/template/admin_v3/public/images/component/input_translate.svg +47 -0
  35. package/template/admin_v3/public/images/component/json.svg +31 -0
  36. package/template/admin_v3/public/images/component/label.svg +11 -0
  37. package/template/admin_v3/public/images/component/line_chart.svg +19 -0
  38. package/template/admin_v3/public/images/component/matrix_table.svg +34 -0
  39. package/template/admin_v3/public/images/component/mixed_chart.svg +25 -0
  40. package/template/admin_v3/public/images/component/polar_chart.svg +33 -0
  41. package/template/admin_v3/public/images/component/radio.svg +24 -0
  42. package/template/admin_v3/public/images/component/redar_chart.svg +17 -0
  43. package/template/admin_v3/public/images/component/scatter_chart.svg +25 -0
  44. package/template/admin_v3/public/images/component/select.svg +34 -0
  45. package/template/admin_v3/public/images/component/summary_box.svg +31 -0
  46. package/template/admin_v3/public/images/component/switch.svg +12 -0
  47. package/template/admin_v3/public/images/component/translate.svg +35 -0
  48. package/template/admin_v3/public/images/component/tree.svg +78 -0
  49. package/template/admin_v3/public/images/default-profile.png +0 -0
  50. package/template/admin_v3/public/images/empty-data.png +0 -0
  51. package/template/admin_v3/public/images/file.png +0 -0
  52. package/template/admin_v3/public/images/forgot-step-1.png +0 -0
  53. package/template/admin_v3/public/images/forgot-step-2.png +0 -0
  54. package/template/admin_v3/public/images/forgot-step-3.png +0 -0
  55. package/template/admin_v3/public/images/form.png +0 -0
  56. package/template/admin_v3/public/images/info-panel.png +0 -0
  57. package/template/admin_v3/public/images/panel.png +0 -0
  58. package/template/admin_v3/public/images/split.svg +1 -0
  59. package/template/admin_v3/public/images/stack.png +0 -0
  60. package/template/admin_v3/public/images/type-all.png +0 -0
  61. package/template/admin_v3/public/images/type-boolean.png +0 -0
  62. package/template/admin_v3/public/images/type-date.png +0 -0
  63. package/template/admin_v3/public/images/type-file.png +0 -0
  64. package/template/admin_v3/public/images/type-image.png +0 -0
  65. package/template/admin_v3/public/images/type-json.png +0 -0
  66. package/template/admin_v3/public/images/type-number.png +0 -0
  67. package/template/admin_v3/public/images/type-options.png +0 -0
  68. package/template/admin_v3/public/images/type-password.png +0 -0
  69. package/template/admin_v3/public/images/type-related.png +0 -0
  70. package/template/admin_v3/public/images/type-string.png +0 -0
  71. package/template/admin_v3/public/images/type-trash.png +0 -0
  72. package/template/admin_v3/public/images/type-unknown.png +0 -0
  73. package/template/admin_v3/public/images/upload.png +0 -0
  74. package/template/admin_v3/public/private-image-worker.js +24 -0
  75. package/template/admin_v3/src/pages/[...url_key].tsx +9 -0
  76. package/template/admin_v3/src/pages/_app.tsx +22 -0
  77. package/template/admin_v3/src/pages/activate.tsx +9 -0
  78. package/template/admin_v3/src/pages/api/auth/activate_account/confirm.ts +13 -0
  79. package/template/admin_v3/src/pages/api/auth/activate_account/index.ts +13 -0
  80. package/template/admin_v3/src/pages/api/auth/activate_account/resend.ts +13 -0
  81. package/template/admin_v3/src/pages/api/auth/activate_account/set_password.ts +17 -0
  82. package/template/admin_v3/src/pages/api/auth/authen/confirm.ts +24 -0
  83. package/template/admin_v3/src/pages/api/auth/authen/resend.ts +13 -0
  84. package/template/admin_v3/src/pages/api/auth/callback/index.ts +24 -0
  85. package/template/admin_v3/src/pages/api/auth/forgot_password/confirm.ts +13 -0
  86. package/template/admin_v3/src/pages/api/auth/forgot_password/index.ts +13 -0
  87. package/template/admin_v3/src/pages/api/auth/forgot_password/resend.ts +13 -0
  88. package/template/admin_v3/src/pages/api/auth/forgot_password/reset.ts +17 -0
  89. package/template/admin_v3/src/pages/api/auth/login.ts +24 -0
  90. package/template/admin_v3/src/pages/api/auth/logout.ts +30 -0
  91. package/template/admin_v3/src/pages/api/custom/[...path].ts +16 -0
  92. package/template/admin_v3/src/pages/api/download.ts +79 -0
  93. package/template/admin_v3/src/pages/api/entity/[entity]/[id].ts +46 -0
  94. package/template/admin_v3/src/pages/api/entity/[entity]/delete.ts +18 -0
  95. package/template/admin_v3/src/pages/api/entity/[entity]/find.ts +17 -0
  96. package/template/admin_v3/src/pages/api/entity/[entity]/index.ts +30 -0
  97. package/template/admin_v3/src/pages/api/entity/[entity]/update.ts +18 -0
  98. package/template/admin_v3/src/pages/api/entity/approve/[entity]/[id].ts +19 -0
  99. package/template/admin_v3/src/pages/api/entity/schema/[entity]/index.ts +27 -0
  100. package/template/admin_v3/src/pages/api/entity/schema/[entity]/relate.ts +16 -0
  101. package/template/admin_v3/src/pages/api/entity/schema/index.ts +27 -0
  102. package/template/admin_v3/src/pages/api/import_export/example/index.ts +13 -0
  103. package/template/admin_v3/src/pages/api/import_export/execute/index.ts +13 -0
  104. package/template/admin_v3/src/pages/api/import_export/export/index.ts +13 -0
  105. package/template/admin_v3/src/pages/api/import_export/import/index.ts +13 -0
  106. package/template/admin_v3/src/pages/api/import_export/progresses/index.ts +13 -0
  107. package/template/admin_v3/src/pages/api/import_export/verify_progress/index.ts +13 -0
  108. package/template/admin_v3/src/pages/api/language/set.ts +15 -0
  109. package/template/admin_v3/src/pages/api/media/private.ts +49 -0
  110. package/template/admin_v3/src/pages/api/queue/[queue]/count.ts +17 -0
  111. package/template/admin_v3/src/pages/api/queue/[queue]/flush.ts +17 -0
  112. package/template/admin_v3/src/pages/api/queue/[queue]/flushall.ts +16 -0
  113. package/template/admin_v3/src/pages/api/queue/[queue]/index.ts +20 -0
  114. package/template/admin_v3/src/pages/api/queue/index.ts +13 -0
  115. package/template/admin_v3/src/pages/api/redis/[connect]/index.ts +0 -0
  116. package/template/admin_v3/src/pages/api/redis/index.ts +0 -0
  117. package/template/admin_v3/src/pages/api/setting/[code].ts +21 -0
  118. package/template/admin_v3/src/pages/api/system/config.ts +13 -0
  119. package/template/admin_v3/src/pages/api/system/data_source/[code].ts +17 -0
  120. package/template/admin_v3/src/pages/api/system/endpoint/[method].ts +17 -0
  121. package/template/admin_v3/src/pages/api/system/queue.ts +13 -0
  122. package/template/admin_v3/src/pages/api/system/role.ts +13 -0
  123. package/template/admin_v3/src/pages/api/user/change_password.ts +13 -0
  124. package/template/admin_v3/src/pages/api/user/filter/index.ts +13 -0
  125. package/template/admin_v3/src/pages/api/user/me.ts +24 -0
  126. package/template/admin_v3/src/pages/api/user/register.ts +13 -0
  127. package/template/admin_v3/src/pages/callback/[channel].tsx +9 -0
  128. package/template/admin_v3/src/pages/entity/[entity]/[layout]/[id].tsx +17 -0
  129. package/template/admin_v3/src/pages/entity/[entity]/[layout]/index.tsx +19 -0
  130. package/template/admin_v3/src/pages/forgot_password.tsx +9 -0
  131. package/template/admin_v3/src/pages/index.tsx +7 -0
  132. package/template/admin_v3/src/pages/login.tsx +9 -0
  133. package/template/admin_v3/src/pages/profile.tsx +9 -0
  134. package/template/admin_v3/src/pages/register.tsx +9 -0
  135. package/template/admin_v3/src/pages/setting/entities/[key].tsx +10 -0
  136. package/template/admin_v3/src/pages/setting/entities/index.tsx +10 -0
  137. package/template/admin_v3/src/pages/setting/module/[module]/[layout].tsx +16 -0
  138. package/template/admin_v3/src/pages/setting/modules.tsx +10 -0
  139. package/template/admin_v3/src/styles/global.css +101 -0
  140. package/template/admin_v3/src/styles/workflow.css +40 -0
  141. package/template/admin_v3/src/utils/color.ts +88 -0
  142. package/template/admin_v3/tailwind.config.js +57 -0
  143. package/template/admin_v3/tsconfig.json +36 -0
  144. package/template/core/_gitignore +4 -0
  145. package/template/core/buildspec.yml +29 -0
  146. package/template/core/jest.config.js +43 -0
  147. package/template/core/package.json +14 -2
  148. package/template/core/sonar-project.properties +27 -0
  149. package/template/core/test/__mocks__/cc-core-lib.d.ts +161 -0
  150. package/template/core/test/__mocks__/cc-core-lib.js +311 -0
  151. package/template/core/test/__mocks__/pdf-img-convert.js +5 -0
  152. package/template/core/test/jest.setup.ts +25 -0
  153. package/template/core/tsconfig.json +13 -13
  154. package/template/core/tsconfig.test.json +17 -0
@@ -0,0 +1,9 @@
1
+ import { RegisterForm } from '@shopstack/cs-admin-lib';
2
+
3
+ const RegisterPage = () => {
4
+ return (
5
+ <RegisterForm />
6
+ )
7
+ }
8
+
9
+ export default RegisterPage
@@ -0,0 +1,10 @@
1
+ import { EntityDetailPageComponent } from '@shopstack/cs-admin-lib';
2
+
3
+ const EntityDetailPage = () => {
4
+
5
+ return (
6
+ <EntityDetailPageComponent />
7
+ )
8
+ }
9
+
10
+ export default EntityDetailPage
@@ -0,0 +1,10 @@
1
+ import { EntitiesPageComponent } from '@shopstack/cs-admin-lib';
2
+
3
+ const EntitiesPage = () => {
4
+
5
+ return (
6
+ <EntitiesPageComponent />
7
+ )
8
+ }
9
+
10
+ export default EntitiesPage
@@ -0,0 +1,16 @@
1
+ import { SettingPage } from '@shopstack/cs-admin-lib';
2
+ import { useRouter } from "next/router"
3
+
4
+ const ModuleSettingPage = () => {
5
+
6
+ const router = useRouter()
7
+
8
+ return (
9
+ <SettingPage
10
+ layout={router.query.layout as string}
11
+ module={router.query.module as string}
12
+ />
13
+ )
14
+ }
15
+
16
+ export default ModuleSettingPage
@@ -0,0 +1,10 @@
1
+ import { ModulePageComponent } from '@shopstack/cs-admin-lib';
2
+
3
+ const ModulePage = () => {
4
+
5
+ return (
6
+ <ModulePageComponent />
7
+ )
8
+ }
9
+
10
+ export default ModulePage
@@ -0,0 +1,101 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+ @import "./workflow.css";
5
+
6
+ @layer utilities {
7
+ .no-scrollbar::-webkit-scrollbar {
8
+ display: none;
9
+ }
10
+
11
+ .no-scrollbar {
12
+ -ms-overflow-style: none;
13
+ scrollbar-width: none;
14
+ }
15
+
16
+ .title-hero {
17
+ @apply text-[48px] font-medium text-font-dark font-['Prompt'];
18
+ }
19
+
20
+ .title-bold {
21
+ @apply text-[32px] font-medium text-font-dark font-['Prompt'];
22
+ }
23
+
24
+ .header-bold {
25
+ @apply text-[21px] font-normal text-font-dark font-['Prompt'];
26
+ }
27
+
28
+ .header-base {
29
+ @apply text-[16px] font-normal text-font-dark font-['Prompt'];
30
+ }
31
+
32
+ .header-subtitle-strong {
33
+ @apply text-[14px] font-normal text-font-dark font-['Prompt'] tracking-spacing-030;
34
+ }
35
+
36
+ .header-subtitle-light {
37
+ @apply text-[14px] font-light text-font-dark font-['Prompt'];
38
+ }
39
+
40
+ .header-field-title {
41
+ @apply text-[12px] font-normal text-font-dark font-['Prompt'] tracking-spacing-040;
42
+ }
43
+
44
+ .body-emphasis {
45
+ @apply text-[16px] font-semibold text-font-dark font-['Sarabun'] tracking-spacing-034;
46
+ }
47
+
48
+ .body-strong {
49
+ @apply text-[14px] font-medium text-font-dark font-['Sarabun'] tracking-spacing-030;
50
+ }
51
+
52
+ .body-base {
53
+ @apply text-[14px] font-extralight text-font font-['Sarabun'] tracking-spacing-030;
54
+ }
55
+
56
+ .paragraph-base {
57
+ @apply !text-[14px] font-light text-font font-['Sarabun'] tracking-spacing-030;
58
+ }
59
+
60
+ .paragraph-small {
61
+ @apply text-[12px] font-light text-font font-['Sarabun'] tracking-spacing-026;
62
+ }
63
+
64
+ .tagline-medium {
65
+ @apply text-[12px] font-medium text-font font-['Sarabun'] tracking-spacing-026;
66
+ }
67
+
68
+ .tagline-base {
69
+ @apply text-[12px] font-light text-font font-['Sarabun'] tracking-spacing-026;
70
+ }
71
+
72
+ .tagline-small-bold {
73
+ @apply text-[12px] font-bold text-font font-['Sarabun'] tracking-spacing-026;
74
+ }
75
+
76
+ .tagline-small {
77
+ @apply text-[12px] font-light text-font font-['Sarabun'] tracking-spacing-026;
78
+ }
79
+ }
80
+
81
+ .rmdp-week-day {
82
+ color: rgb(var(--color-primary)) !important;
83
+ }
84
+
85
+ .rmdp-arrow {
86
+ border-color: rgb(var(--color-primary)) !important;
87
+ }
88
+
89
+ .rmdp-arrow-container:hover {
90
+ background-color: rgba(var(--color-primary), 0.3) !important;
91
+ }
92
+
93
+ .rmdp-day.rmdp-selected span:not(.highlight) {
94
+ background-color: rgb(var(--color-primary)) !important;
95
+ }
96
+
97
+ @media (hover: hover) {
98
+ .rmdp-day:not(.rmdp-disabled, .rmdp-day-hidden) span:hover {
99
+ background-color: rgba(var(--color-primary), 0.3) !important;
100
+ }
101
+ }
@@ -0,0 +1,40 @@
1
+ /* Custom Node Classes */
2
+ .react-flow__node {
3
+ @apply !border-none;
4
+ }
5
+
6
+ .customHandle.react-flow__handle {
7
+ @apply opacity-0;
8
+ }
9
+
10
+ .customNode-start-flow {
11
+ @apply flex justify-center w-[200px];
12
+ }
13
+
14
+ .customNode-start-flow-radius {
15
+ @apply p-1 border border-dashed rounded-full bg-white h-[50px] w-[50px] flex justify-center items-center relative border-[#999];
16
+ }
17
+
18
+ .customNode-flow {
19
+ @apply p-1 border border-solid rounded bg-white h-16 w-52 flex flex-col items-center justify-center cursor-pointer;
20
+ }
21
+
22
+ .customHandle {
23
+ @apply opacity-0;
24
+ }
25
+
26
+ .customNode-add-flow {
27
+ @apply flex justify-center;
28
+ }
29
+
30
+ .custom-node-distribution-btn {
31
+ @apply p-1 border border-solid border-[#999] rounded-full bg-white h-8 w-8 flex items-center justify-center cursor-pointer mt-[-15px] z-10 absolute;
32
+ }
33
+
34
+ .custom-node-add-radius-flow {
35
+ @apply p-1 border border-dashed border-[#999] rounded-full bg-white h-8 w-8 flex items-center justify-center cursor-pointer relative;
36
+ }
37
+
38
+ .line-between-node {
39
+ @apply left-1/2 h-6 w-[1px] bg-[#999] relative ml-[-1px];
40
+ }
@@ -0,0 +1,88 @@
1
+ import _get from 'lodash/get'
2
+ import _reduce from 'lodash/reduce'
3
+
4
+ const COLOR_SETTINGS = {
5
+ action: 'list_detail.action_color',
6
+ plane: 'list_detail.background_color',
7
+ 'page-header': 'list_detail.page_header',
8
+ input: 'list_detail.input',
9
+ card: 'list_detail.frame_bg_color',
10
+ font: 'list_detail.font_color',
11
+ 'font-dark': 'list_detail.font_dark_color',
12
+ 'table-header-bg': 'list_detail.table_header_bg',
13
+ 'table-header-txt': 'list_detail.table_header_color',
14
+ 'table-row-hover': 'list_detail.table_row_hover_bg',
15
+ 'table-sort-header-bg': 'list_detail.table_header_sort_bg',
16
+ 'table-sort-body-bg': 'list_detail.table_body_sort_bg',
17
+ 'table-row-select-color': 'list_detail.table_row_select_color',
18
+ 'group-table-headers-bg': 'list_detail.group_table_headers_bg',
19
+ 'select-selected': 'list_detail.select_color',
20
+ 'select-hover': 'list_detail.hover_color',
21
+ 'boolean-false': 'list_detail.boolean_value_false',
22
+ 'boolean-true': 'list_detail.boolean_value_true',
23
+ 'menu-bg': 'menu_setting.menu_background_color',
24
+ 'menu-line': 'menu_setting.menu_line_color',
25
+ 'menu-text': 'menu_setting.menu_text_color',
26
+ 'menu-text-active': 'menu_setting.menu_text_active_color',
27
+ 'menu-bg-active': 'menu_setting.menu_background_active_color',
28
+ 'submenu-text': 'menu_setting.submenu_text_color',
29
+ 'submenu-text-active': 'menu_setting.submenu_text_active_color',
30
+ 'submenu-line-active': 'menu_setting.submenu_line_active_color',
31
+ 'submenu-bg-hover': 'menu_setting.submenu_background_hover_color'
32
+ }
33
+
34
+ export const withOpacity = (variableName, alpha?) => ({ opacityValue }) => {
35
+ if (alpha) {
36
+ return `rgba(var(${variableName}), ${alpha})`;
37
+ }
38
+ if (opacityValue !== undefined) {
39
+ return `rgba(var(${variableName}), ${opacityValue})`;
40
+ }
41
+ return `rgb(var(${variableName}))`;
42
+ };
43
+
44
+ export const getRGBColor = (hex, type) => {
45
+ const color = hex.replace(/#/g, "");
46
+ const r = parseInt(color.substr(0, 2), 16);
47
+ const g = parseInt(color.substr(2, 2), 16);
48
+ const b = parseInt(color.substr(4, 2), 16);
49
+ return `--color-${type}: ${r}, ${g}, ${b};`;
50
+ };
51
+
52
+ export const getStyleColor = (data: any, setting: any): string => {
53
+ const res = []
54
+ for (const key in COLOR_SETTINGS) {
55
+ const settingKey = COLOR_SETTINGS[key]
56
+ const value = _get(data, settingKey) || _get(setting, settingKey)
57
+ res.push(getRGBColor(value, key))
58
+ }
59
+ return res.join('\n')
60
+ }
61
+
62
+ export const getTailwindColor = (): object => {
63
+ const res = _reduce(COLOR_SETTINGS, (r, i, k) => {
64
+ r[k] = withOpacity(`--color-${k}`)
65
+ return r
66
+ }, {})
67
+
68
+ return res
69
+ }
70
+
71
+ export const getRandomColor = () => {
72
+ let letters = '0123456789ABCDEF';
73
+ let color = '#';
74
+ for (let i = 0; i < 6; i++) {
75
+ color += letters[Math.floor(Math.random() * 16)];
76
+ }
77
+ return color;
78
+ }
79
+
80
+ export const removeAlpha = (color: string): string => {
81
+ if (!color) return color
82
+
83
+ if (color.length == 9) {
84
+ return color.slice(0, 7)
85
+ }
86
+
87
+ return color
88
+ }
@@ -0,0 +1,57 @@
1
+ const { withOpacity, getTailwindColor } = require('./src/utils/color.ts')
2
+ /** @type {import("tailwindcss").Config} */
3
+
4
+ const colors = getTailwindColor()
5
+
6
+ module.exports = {
7
+ content: [
8
+ "./src/components/**/*.{js,ts,jsx,tsx}",
9
+ "./src/pages/**/*.{js,ts,jsx,tsx}",
10
+ "./src/hooks/**/*.{js,ts,jsx,tsx}",
11
+ "./node_modules/@shopstack/cs-admin-lib/dist/client/module/index.js"
12
+ ],
13
+ theme: {
14
+ extend: {
15
+ letterSpacing: {
16
+ 'spacing-026': '0.26px',
17
+ 'spacing-030': '0.3px',
18
+ 'spacing-034': '0.34px',
19
+ 'spacing-040': '0.40px',
20
+ },
21
+ colors: {
22
+ primary: withOpacity("--color-primary"),
23
+ "primary-50": withOpacity("--color-primary", 0.05),
24
+ "primary-100": withOpacity("--color-primary", 0.1),
25
+ "primary-200": withOpacity("--color-primary", 0.2),
26
+ "primary-300": withOpacity("--color-primary", 0.3),
27
+ "primary-400": withOpacity("--color-primary", 0.4),
28
+ "primary-500": withOpacity("--color-primary", 0.5),
29
+ "primary-600": withOpacity("--color-primary", 0.6),
30
+ "primary-700": withOpacity("--color-primary", 0.7),
31
+ "primary-800": withOpacity("--color-primary", 0.8),
32
+ "primary-900": withOpacity("--color-primary", 0.9),
33
+ secondary: withOpacity("--color-secondary"),
34
+ "secondary-50": withOpacity("--color-secondary", 0.05),
35
+ "secondary-100": withOpacity("--color-secondary", 0.1),
36
+ "secondary-200": withOpacity("--color-secondary", 0.2),
37
+ "secondary-300": withOpacity("--color-secondary", 0.3),
38
+ "secondary-400": withOpacity("--color-secondary", 0.4),
39
+ "secondary-500": withOpacity("--color-secondary", 0.5),
40
+ "secondary-600": withOpacity("--color-secondary", 0.6),
41
+ "secondary-700": withOpacity("--color-secondary", 0.7),
42
+ "secondary-800": withOpacity("--color-secondary", 0.8),
43
+ "secondary-900": withOpacity("--color-secondary", 0.9),
44
+ "gray": "#F5F5F7",
45
+ "line": "#DAE1EB",
46
+ "label": "#222222",
47
+ "icon": "#C3C3C3",
48
+ "dark-plane": "#343434",
49
+ "disabled": "#c3c3c3",
50
+ "error": "#F44336",
51
+ "table-row-bg": '#FFFFFF',
52
+ ...colors,
53
+ }
54
+ }
55
+ },
56
+ plugins: [],
57
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": [
5
+ "dom",
6
+ "dom.iterable",
7
+ "esnext"
8
+ ],
9
+ "allowJs": true,
10
+ "skipLibCheck": true,
11
+ "strict": false,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "noEmit": true,
14
+ "esModuleInterop": true,
15
+ "module": "esnext",
16
+ "moduleResolution": "node",
17
+ "resolveJsonModule": true,
18
+ "isolatedModules": true,
19
+ "jsx": "preserve",
20
+ "incremental": true,
21
+ "baseUrl": ".",
22
+ "paths": {
23
+ "@/*": [
24
+ "src/*"
25
+ ]
26
+ },
27
+ },
28
+ "include": [
29
+ "next-env.d.ts",
30
+ "**/*.ts",
31
+ "**/*.tsx"
32
+ ],
33
+ "exclude": [
34
+ "node_modules"
35
+ ]
36
+ }
@@ -46,3 +46,7 @@ Thumbs.db
46
46
 
47
47
  # Package lock file
48
48
  package-lock.json
49
+
50
+ # Test files
51
+ .scannerwork/
52
+ coverage/
@@ -0,0 +1,29 @@
1
+ version: 0.2
2
+
3
+ phases:
4
+ pre_build:
5
+ commands:
6
+ - echo Logging in to Amazon ECR...
7
+ - $(aws ecr get-login --no-include-email --region ap-southeast-1)
8
+ - REPOSITORY_URI=$ECR_URI
9
+ - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
10
+ - IMAGE_TAG=${COMMIT_HASH:=latest}
11
+ build:
12
+ commands:
13
+ - echo logging in dockerhub...
14
+ - docker login -u $dockeruser -p $dockerpassword
15
+ - echo Build started on `date`
16
+ - echo Building the Docker image...
17
+ - sed -i "s|{{SHOPSTACK_TOKEN}}|$SHOPSATCK_TOKEN|g" .npmrc
18
+ - cat .npmrc
19
+ - docker build --no-cache -t $REPOSITORY_URI:latest --build-arg commit_hash=$COMMIT_HASH .
20
+ - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
21
+ post_build:
22
+ commands:
23
+ - echo Build completed on `date`
24
+ - echo Pushing the Docker image...
25
+ - docker push $REPOSITORY_URI:$IMAGE_TAG
26
+ - echo Writing image definitions file...
27
+ - printf '[{"name":"%s","imageUri":"%s"}]' $IMAGE_CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
28
+ artifacts:
29
+ files: imagedefinitions.json
@@ -0,0 +1,43 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'node',
4
+ roots: ['<rootDir>/src/modules'],
5
+ testRegex: '.*\\.spec\\.ts$',
6
+ transform: {
7
+ '^.+\\.(t|j)s$': 'ts-jest'
8
+ },
9
+ transformIgnorePatterns: [
10
+ 'node_modules/(?!(@shopstack/cc-core-lib)/.*)',
11
+ ],
12
+ moduleNameMapper: {
13
+ '^@/(.*)$': '<rootDir>/src/$1',
14
+ '^(\\.{1,2}/.*)\\.js$': '$1',
15
+ 'pdf-img-convert': '<rootDir>/test/__mocks__/pdf-img-convert.js',
16
+ '@shopstack/cc-core-lib/core': '<rootDir>/test/__mocks__/cc-core-lib.js'
17
+ },
18
+ setupFilesAfterEnv: ['<rootDir>/test/jest.setup.ts'],
19
+ collectCoverageFrom: [
20
+ 'src/**/*.ts',
21
+ '!src/**/*.spec.ts',
22
+ '!src/**/*.module.ts',
23
+ '!src/main.ts',
24
+ '!src/**/index.ts',
25
+ '!src/modules/aws-s3/**/*',
26
+ '!src/**/*.enum.ts',
27
+ '!src/**/*.layout.ts',
28
+ '!src/**/*.workflow.ts',
29
+ '!src/**/*.custom_action.ts',
30
+ '!src/modules/modules.ts'
31
+ ],
32
+ coverageDirectory: './coverage',
33
+ coverageReporters: ['lcov', 'text', 'text-summary'],
34
+ moduleFileExtensions: ['js', 'json', 'ts'],
35
+ globals: {
36
+ 'ts-jest': {
37
+ tsconfig: 'tsconfig.test.json'
38
+ }
39
+ },
40
+ verbose: true,
41
+ testTimeout: 30000,
42
+ moduleDirectories: ['node_modules', 'src/__tests__/mocks', 'test/__mocks__']
43
+ };
@@ -14,16 +14,25 @@
14
14
  "start:dev": "source ./newrelic.sh && nest start --watch",
15
15
  "start:debug": "nest start --debug --watch",
16
16
  "start:prod": "source ./newrelic.sh && node dist/src/main",
17
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
17
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
18
+ "test": "jest",
19
+ "test:watch": "jest --watch",
20
+ "test:cov": "jest --coverage",
21
+ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
22
+ "sonar": "node -r dotenv/config ./node_modules/.bin/jest --coverage && node -r dotenv/config ./node_modules/.bin/sonar-scanner",
23
+ "sonar:coverage": "jest --coverage --coverageReporters=lcov --coverageDirectory=coverage"
18
24
  },
19
25
  "dependencies": {
20
- "@shopstack/cc-core-lib": "^2.5.272"
26
+ "@shopstack/cc-core-lib": "^2.5.274",
27
+ "reflect-metadata": "^0.1.14"
21
28
  },
22
29
  "devDependencies": {
30
+ "@nestjs/testing": "^10.3.5",
23
31
  "@types/bcrypt": "^5.0.2",
24
32
  "@types/bull": "^3.14.4",
25
33
  "@types/chroma-js": "^2.4.0",
26
34
  "@types/express": "^4.17.8",
35
+ "@types/jest": "^29.5.14",
27
36
  "@types/node": "^13.13.27",
28
37
  "@types/numeral": "^2.0.2",
29
38
  "@types/supertest": "^2.0.10",
@@ -32,8 +41,11 @@
32
41
  "eslint": "^8.44.0",
33
42
  "eslint-config-prettier": "^6.13.0",
34
43
  "eslint-plugin-import": "^2.22.1",
44
+ "jest": "^29.7.0",
35
45
  "prettier": "^1.19.1",
46
+ "sonarqube-scanner": "^4.3.0",
36
47
  "supertest": "^4.0.2",
48
+ "ts-jest": "^29.3.4",
37
49
  "ts-loader": "^6.2.1",
38
50
  "ts-node": "^10.9.1",
39
51
  "tsconfig-paths": "^3.9.0",
@@ -0,0 +1,27 @@
1
+ # Project identification
2
+ sonar.projectKey=demo-points-core
3
+ sonar.projectName=Demo Points Core
4
+ sonar.projectVersion=1.0.0
5
+
6
+ # Source code location
7
+ sonar.sources=src
8
+ sonar.tests=src
9
+ sonar.test.inclusions=**/*.spec.ts
10
+ sonar.exclusions=**/*.layout.ts,**/*.workflow.ts,**/*.custom_action.ts,**/*.module.ts,**/main.ts,**/index.ts,**/aws-s3/**,**/*.enum.ts
11
+
12
+ # Language
13
+ sonar.language=ts
14
+ sonar.typescript.lcov.reportPaths=coverage/lcov.info
15
+
16
+ # Encoding of the source files
17
+ sonar.sourceEncoding=UTF-8
18
+
19
+ # Coverage report path
20
+ sonar.javascript.lcov.reportPaths=coverage/lcov.info
21
+
22
+ # SonarCloud configuration
23
+ sonar.host.url=https://sonarcloud.io
24
+ sonar.organization=your-organization-key # You need to replace this with your organization key
25
+
26
+ # Authentication token should be provided via environment variable SONAR_TOKEN
27
+ # DO NOT add the token directly in this file for security reasons