@nathapp/na-cli 1.0.7 → 1.0.9
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/dist/templates/db-schema/.gitlab-ci.yml +139 -0
- package/dist/templates/db-schema/Makefile +885 -0
- package/dist/templates/k8s-deployment/.gitlab-ci.yml +158 -0
- package/dist/templates/k8s-deployment/Makefile +233 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/script/Makefile +12 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/script/Makefile +8 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/script/Makefile +56 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/Makefile +9 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/script/Makefile +14 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/_t-0100-readiness-liveness.ts +84 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/hub.ts +372 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contact.ts +158 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contract.ts +328 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-kyc.ts +304 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-app.ts +823 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-web.ts +493 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-profile.ts +277 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-whitelist.ts +133 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/t-0200-start.ts +172 -0
- package/dist/templates/nestjs-api/.dockerignore +9 -0
- package/dist/templates/nestjs-api/.env +31 -0
- package/dist/templates/nestjs-api/.gitignore-rename +1 -0
- package/dist/templates/nestjs-api/.gitlab-ci.yml +180 -0
- package/dist/templates/nestjs-api/.nvmrc +1 -0
- package/dist/templates/nestjs-api/.oxlintrc.json +18 -0
- package/dist/templates/nestjs-api/.prettierrc +4 -0
- package/dist/templates/nestjs-api/Dockerfile +15 -21
- package/dist/templates/nestjs-api/Makefile +95 -0
- package/dist/templates/nestjs-api/README.md +22 -30
- package/dist/templates/nestjs-api/nest-cli.json +10 -0
- package/dist/templates/nestjs-api/ormconfig.ts +18 -0
- package/dist/templates/nestjs-api/package.json +58 -72
- package/dist/templates/nestjs-api/src/app.controller.spec.ts +24 -0
- package/dist/templates/nestjs-api/src/app.controller.ts +27 -0
- package/dist/templates/nestjs-api/src/app.module.ts +31 -0
- package/dist/templates/nestjs-api/src/app.service.ts +27 -0
- package/dist/templates/nestjs-api/src/main.ts +31 -0
- package/dist/templates/nestjs-api/test/app.e2e-spec.ts +47 -0
- package/dist/templates/nestjs-api/tsconfig.build.json +5 -0
- package/dist/templates/nestjs-api/tsconfig.json +28 -0
- package/dist/templates/nestjs-api/tsconfig.spec.json +9 -0
- package/dist/templates/nestjs-api/vitest.config.mts +33 -0
- package/dist/templates/nestjs-library/.gitignore-rename +1 -0
- package/dist/templates/nestjs-library/.gitlab-ci.yml +134 -0
- package/dist/templates/nestjs-library/.npmignore-rename +5 -2
- package/dist/templates/nestjs-library/.nvmrc +1 -0
- package/dist/templates/nestjs-library/.oxlintrc.json +18 -0
- package/dist/templates/nestjs-library/.prettierrc +6 -0
- package/dist/templates/nestjs-library/Makefile +60 -0
- package/dist/templates/nestjs-library/README.md +24 -0
- package/dist/templates/nestjs-library/lib/index.ts +2 -0
- package/dist/templates/nestjs-library/package.json +43 -33
- package/dist/templates/nestjs-library/test/app/controller/hello.controller.spec.ts +20 -0
- package/dist/templates/nestjs-library/test/app/controller/hello.controller.ts +7 -0
- package/dist/templates/nestjs-library/tsconfig.build.json +8 -0
- package/dist/templates/nestjs-library/tsconfig.json +21 -0
- package/dist/templates/nestjs-library/tsconfig.spec.json +9 -0
- package/dist/templates/nestjs-library/vitest.config.mts +29 -0
- package/dist/templates/ts-library/.dockerignore +2 -0
- package/dist/templates/ts-library/.eslintrc.js +24 -0
- package/dist/templates/ts-library/.gitlab-ci.yml +136 -0
- package/dist/templates/ts-library/.prettierrc +6 -0
- package/dist/templates/ts-library/Makefile +58 -0
- package/dist/templates/ts-library/index.ts +1 -0
- package/dist/templates/ts-library/lib/index.ts +1 -0
- package/dist/templates/ts-library/lib/samples/index.ts +5 -0
- package/dist/templates/ts-library/lib/samples/samples-function.ts +3 -0
- package/dist/templates/ts-library/test/sample.e2e-spec.ts +10 -0
- package/dist/templates/ts-library/tsconfig.build.json +4 -0
- package/dist/templates/ts-library/tsconfig.json +18 -0
- package/dist/templates/turbo-nestjs-vuexy/.dockerignore +2 -0
- package/dist/templates/turbo-nestjs-vuexy/.gitignore-rename +40 -0
- package/dist/templates/turbo-nestjs-vuexy/.npmrc-rename +0 -0
- package/dist/templates/turbo-nestjs-vuexy/Makefile +48 -0
- package/dist/templates/vuexy-portal/.dockerignore +2 -0
- package/dist/templates/vuexy-portal/.env +1 -0
- package/dist/templates/vuexy-portal/.gitlab-ci.yml +233 -0
- package/dist/templates/vuexy-portal/.npmrc-rename +2 -0
- package/dist/templates/vuexy-portal/.nvmrc +1 -0
- package/dist/templates/vuexy-portal/Makefile +55 -0
- package/dist/templates/vuexy-portal/src/@core/composable/createUrl.ts +20 -0
- package/dist/templates/vuexy-portal/src/@core/composable/useCookie.ts +43 -0
- package/dist/templates/vuexy-portal/src/@core/composable/useGenerateImageVariant.ts +25 -0
- package/dist/templates/vuexy-portal/src/@core/composable/useResponsiveSidebar.ts +29 -0
- package/dist/templates/vuexy-portal/src/@core/composable/useSkins.ts +42 -0
- package/dist/templates/vuexy-portal/src/@core/enums.ts +21 -0
- package/dist/templates/vuexy-portal/src/@core/index.ts +43 -0
- package/dist/templates/vuexy-portal/src/@core/initCore.ts +93 -0
- package/dist/templates/vuexy-portal/src/@core/libs/apex-chart/apexCharConfig.ts +701 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/chartjsConfig.ts +372 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/components/BarChart.ts +58 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/components/BubbleChart.ts +58 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/components/DoughnutChart.ts +58 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/components/LineChart.ts +58 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/components/PolarAreaChart.ts +58 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/components/RadarChart.ts +58 -0
- package/dist/templates/vuexy-portal/src/@core/libs/chartjs/components/ScatterChart.ts +58 -0
- package/dist/templates/vuexy-portal/src/@core/stores/config.ts +80 -0
- package/dist/templates/vuexy-portal/src/@core/types.ts +49 -0
- package/dist/templates/vuexy-portal/src/@core/utils/formatters.ts +48 -0
- package/dist/templates/vuexy-portal/src/@core/utils/helpers.ts +32 -0
- package/dist/templates/vuexy-portal/src/@core/utils/plugins.ts +53 -0
- package/dist/templates/vuexy-portal/src/@core/utils/validators.ts +105 -0
- package/dist/templates/vuexy-portal/src/@core/utils/vuetify.ts +13 -0
- package/dist/templates/vuexy-portal/src/@custom/composables/toasts.ts +45 -0
- package/dist/templates/vuexy-portal/src/@custom/composables/validator.ts +160 -0
- package/dist/templates/vuexy-portal/src/@custom/enums/index.ts +0 -0
- package/dist/templates/vuexy-portal/src/@custom/types/common.ts +17 -0
- package/dist/templates/vuexy-portal/src/@custom/types/index.ts +0 -0
- package/dist/templates/vuexy-portal/src/@custom/types/pagination.ts +19 -0
- package/dist/templates/vuexy-portal/src/@custom/types/user.ts +5 -0
- package/dist/templates/vuexy-portal/src/@custom/utils/formatters.ts +83 -0
- package/dist/templates/vuexy-portal/src/@custom/utils/index.ts +0 -0
- package/dist/templates/vuexy-portal/src/@custom/utils/validators.ts +51 -0
- package/dist/templates/vuexy-portal/src/@layouts/components.ts +11 -0
- package/dist/templates/vuexy-portal/src/@layouts/config.ts +43 -0
- package/dist/templates/vuexy-portal/src/@layouts/enums.ts +27 -0
- package/dist/templates/vuexy-portal/src/@layouts/index.ts +49 -0
- package/dist/templates/vuexy-portal/src/@layouts/plugins/casl.ts +48 -0
- package/dist/templates/vuexy-portal/src/@layouts/stores/config.ts +115 -0
- package/dist/templates/vuexy-portal/src/@layouts/symbols.ts +1 -0
- package/dist/templates/vuexy-portal/src/@layouts/types.ts +126 -0
- package/dist/templates/vuexy-portal/src/@layouts/utils.ts +180 -0
- package/dist/templates/vuexy-portal/src/api/api.ts +1 -0
- package/dist/templates/vuexy-portal/src/api/commonApi.ts +25 -0
- package/dist/templates/vuexy-portal/src/api/index.ts +58 -0
- package/dist/templates/vuexy-portal/src/api/requestInterceptor.ts +21 -0
- package/dist/templates/vuexy-portal/src/api/responseInterceptor.ts +52 -0
- package/dist/templates/vuexy-portal/src/api/types.ts +14 -0
- package/dist/templates/vuexy-portal/src/api/useApi.ts +68 -0
- package/dist/templates/vuexy-portal/src/api/useFetchApi.ts +41 -0
- package/dist/templates/vuexy-portal/src/api/userApi.ts +11 -0
- package/dist/templates/vuexy-portal/src/composables/useApiFetch.ts +48 -0
- package/dist/templates/vuexy-portal/src/composables/useJwt.ts +108 -0
- package/dist/templates/vuexy-portal/src/main.ts +17 -0
- package/dist/templates/vuexy-portal/src/navigation/horizontal/index.ts +5 -0
- package/dist/templates/vuexy-portal/src/navigation/index.ts +7 -0
- package/dist/templates/vuexy-portal/src/navigation/vertical/index.ts +5 -0
- package/dist/templates/vuexy-portal/src/plugins/1.router/additional-routes.ts +23 -0
- package/dist/templates/vuexy-portal/src/plugins/1.router/guards.ts +50 -0
- package/dist/templates/vuexy-portal/src/plugins/1.router/index.ts +45 -0
- package/dist/templates/vuexy-portal/src/plugins/2.pinia.ts +8 -0
- package/dist/templates/vuexy-portal/src/plugins/casl/ability.ts +10 -0
- package/dist/templates/vuexy-portal/src/plugins/casl/composables/useAbility.ts +4 -0
- package/dist/templates/vuexy-portal/src/plugins/casl/index.ts +14 -0
- package/dist/templates/vuexy-portal/src/plugins/i18n/index.ts +29 -0
- package/dist/templates/vuexy-portal/src/plugins/iconify/build-icons.ts +299 -0
- package/dist/templates/vuexy-portal/src/plugins/iconify/index.ts +5 -0
- package/dist/templates/vuexy-portal/src/plugins/layouts.ts +13 -0
- package/dist/templates/vuexy-portal/src/plugins/toast/index.ts +9 -0
- package/dist/templates/vuexy-portal/src/plugins/vuetify/defaults.ts +192 -0
- package/dist/templates/vuexy-portal/src/plugins/vuetify/icons.ts +84 -0
- package/dist/templates/vuexy-portal/src/plugins/vuetify/index.ts +47 -0
- package/dist/templates/vuexy-portal/src/plugins/vuetify/theme.ts +155 -0
- package/dist/templates/vuexy-portal/src/plugins/webfontloader.ts +19 -0
- package/dist/templates/vuexy-portal/src/stores/auth.ts +22 -0
- package/dist/templates/vuexy-portal/src/stores/common.ts +41 -0
- package/dist/templates/vuexy-portal/src/stores/index.ts +0 -0
- package/dist/templates/vuexy-portal/src/utils/constants.ts +3 -0
- package/dist/templates/vuexy-portal/src/utils/paginationMeta.ts +10 -0
- package/dist/templates/vuexy-portal/themeConfig.ts +66 -0
- package/dist/templates/vuexy-portal/tsconfig.json +86 -0
- package/dist/templates/vuexy-portal/vite.config.ts +111 -0
- package/dist/utils/template.js +2 -0
- package/dist/utils/template.js.map +1 -1
- package/package.json +4 -1
- package/alias-script.sh +0 -30
- package/bunfig.toml +0 -3
- package/dist/templates/nestjs-api/test/jest-e2e.json +0 -12
- package/dist/templates/nestjs-api/test/jest-test.json +0 -26
- package/dist/templates/nestjs-library/test/jest-test.json +0 -23
- package/nax/config.json +0 -23
- package/nax/features/enhancements/prd.json +0 -61
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# Project must implement Makefile for commands (test, version-prerelease, version-patch, name, version, image)
|
|
2
|
+
# command:
|
|
3
|
+
# - test: run project test cases
|
|
4
|
+
# - version-prerelease: bump prerelease version
|
|
5
|
+
# - version-patch: bump release version
|
|
6
|
+
# - name: display project name
|
|
7
|
+
# - version: display project version
|
|
8
|
+
# - image: display project name and version (e.g. hello-world:1.0.0)
|
|
9
|
+
#
|
|
10
|
+
stages:
|
|
11
|
+
- test
|
|
12
|
+
# run test cases
|
|
13
|
+
- build-init
|
|
14
|
+
- build
|
|
15
|
+
- build-commit
|
|
16
|
+
# build docker image and push to registry
|
|
17
|
+
- release
|
|
18
|
+
- notify
|
|
19
|
+
# mark release commit as verified
|
|
20
|
+
|
|
21
|
+
run-test:
|
|
22
|
+
stage: test
|
|
23
|
+
image: node:10.13.0-jessie
|
|
24
|
+
script:
|
|
25
|
+
- make test
|
|
26
|
+
rules:
|
|
27
|
+
- if: '$CI_COMMIT_MESSAGE =~ /release-rc-by-devbot/ || $CI_COMMIT_MESSAGE =~ /release-by-devbot/'
|
|
28
|
+
when: never
|
|
29
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
30
|
+
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
|
|
31
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-test/'
|
|
32
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
|
33
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-release/ && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
34
|
+
# NOT triggerred by bot
|
|
35
|
+
# merge request
|
|
36
|
+
# commit to protected branch
|
|
37
|
+
# commit message contains `run-test` keyword
|
|
38
|
+
# commit message contains `run-prerelease` keyword and commit branch is nott default branch (master)
|
|
39
|
+
# commit message contains `run-release` keyword and commit branch is default branch (master)
|
|
40
|
+
|
|
41
|
+
run-pre-build-init:
|
|
42
|
+
stage: build-init
|
|
43
|
+
image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
|
|
44
|
+
artifacts:
|
|
45
|
+
paths:
|
|
46
|
+
- package.json
|
|
47
|
+
- package-lock.json
|
|
48
|
+
- image-tag.txt
|
|
49
|
+
script:
|
|
50
|
+
- make version-prerelease
|
|
51
|
+
- make image | awk '{ printf("%s/%s/%s", ENVIRON["CONTAINER_REGISTRY_URL"], ENVIRON["CONTAINER_REGISTRY_NAMESPACE"], $0)}' > image-tag.txt
|
|
52
|
+
rules:
|
|
53
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
54
|
+
when: never
|
|
55
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/'
|
|
56
|
+
# NOT commit branch is default branch (master)
|
|
57
|
+
# NOT merge request
|
|
58
|
+
# commit message contains `run-prerelease` keyword
|
|
59
|
+
|
|
60
|
+
run-pre-build-warmer:
|
|
61
|
+
stage: build-init
|
|
62
|
+
image:
|
|
63
|
+
name: registry-intl.cn-hongkong.aliyuncs.com/gkci/kaniko-warmer:debug
|
|
64
|
+
entrypoint: [""]
|
|
65
|
+
before_script:
|
|
66
|
+
- echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
|
|
67
|
+
script:
|
|
68
|
+
- warmer `cat $CI_PROJECT_DIR/Dockerfile | grep FROM | awk -F" " '{ printf("--image=%s ", $2) }'`
|
|
69
|
+
rules:
|
|
70
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
71
|
+
when: never
|
|
72
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/'
|
|
73
|
+
# NOT commit branch is default branch (master)
|
|
74
|
+
# NOT merge request
|
|
75
|
+
# commit message contains `run-prerelease` keyword
|
|
76
|
+
|
|
77
|
+
run-pre-build:
|
|
78
|
+
stage: build
|
|
79
|
+
image:
|
|
80
|
+
name: registry-intl.cn-hongkong.aliyuncs.com/gkci/kaniko-executor:debug
|
|
81
|
+
entrypoint: [""]
|
|
82
|
+
artifacts:
|
|
83
|
+
paths:
|
|
84
|
+
- image-digest.txt
|
|
85
|
+
before_script:
|
|
86
|
+
- echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
|
|
87
|
+
script:
|
|
88
|
+
- echo "BUILDING... `cat $CI_PROJECT_DIR/image-tag.txt`"
|
|
89
|
+
- executor --cache=true --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --digest-file $CI_PROJECT_DIR/image-digest.txt --destination "`cat $CI_PROJECT_DIR/image-tag.txt`"
|
|
90
|
+
- echo "PUSHED `cat $CI_PROJECT_DIR/image-tag.txt` (`cat $CI_PROJECT_DIR/image-digest.txt`)"
|
|
91
|
+
rules:
|
|
92
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
93
|
+
when: never
|
|
94
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/'
|
|
95
|
+
# NOT commit branch is default branch (master)
|
|
96
|
+
# NOT merge request
|
|
97
|
+
# commit message contains `run-prerelease` keyword
|
|
98
|
+
|
|
99
|
+
run-pre-build-commit:
|
|
100
|
+
stage: build-commit
|
|
101
|
+
image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
|
|
102
|
+
before_script:
|
|
103
|
+
- git config --global user.name "$GITLAB_USER_NAME"
|
|
104
|
+
- git config --global user.email "$GITLAB_USER_EMAIL"
|
|
105
|
+
script:
|
|
106
|
+
- git add -A
|
|
107
|
+
- git commit -m "$(make version)" -m "== release-rc-by-devbot ($CI_COMMIT_SHA) =="
|
|
108
|
+
- git tag -a "$(make version)" -m "$(cat image-tag.txt) ($(cat image-digest.txt))"
|
|
109
|
+
- git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL#*@}" "HEAD:${CI_COMMIT_BRANCH}"
|
|
110
|
+
- git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL#*@}" --tags
|
|
111
|
+
rules:
|
|
112
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
113
|
+
when: never
|
|
114
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/'
|
|
115
|
+
# NOT commit branch is default branch (master)
|
|
116
|
+
# NOT merge request
|
|
117
|
+
# commit message contains `run-prerelease` keyword
|
|
118
|
+
|
|
119
|
+
run-pre-release:
|
|
120
|
+
stage: release
|
|
121
|
+
image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
|
|
122
|
+
script:
|
|
123
|
+
- echo "Prerelease version $(make version)"
|
|
124
|
+
rules:
|
|
125
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
126
|
+
when: never
|
|
127
|
+
- if: '$CI_COMMIT_TAG != null'
|
|
128
|
+
# NOT commit branch is default branch (master)
|
|
129
|
+
# tag was created
|
|
130
|
+
|
|
131
|
+
run-build-init:
|
|
132
|
+
stage: build-init
|
|
133
|
+
image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
|
|
134
|
+
artifacts:
|
|
135
|
+
paths:
|
|
136
|
+
- package.json
|
|
137
|
+
- package-lock.json
|
|
138
|
+
- image-tag.txt
|
|
139
|
+
script:
|
|
140
|
+
- make version-patch
|
|
141
|
+
- make image | awk '{ printf("%s/%s/%s", ENVIRON["CONTAINER_REGISTRY_URL"], ENVIRON["CONTAINER_REGISTRY_NAMESPACE"], $0)}' > image-tag.txt
|
|
142
|
+
rules:
|
|
143
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_MESSAGE =~ /== release-by-devbot/'
|
|
144
|
+
when: never
|
|
145
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
146
|
+
# NOT merge requests and not triggerred by bot
|
|
147
|
+
# commit into default branch (master)
|
|
148
|
+
|
|
149
|
+
run-build-warmer:
|
|
150
|
+
stage: build-init
|
|
151
|
+
image:
|
|
152
|
+
name: registry-intl.cn-hongkong.aliyuncs.com/gkci/kaniko-warmer:debug
|
|
153
|
+
entrypoint: [""]
|
|
154
|
+
before_script:
|
|
155
|
+
- echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
|
|
156
|
+
script:
|
|
157
|
+
- warmer `cat $CI_PROJECT_DIR/Dockerfile | grep FROM | awk -F" " '{ printf("--image=%s ", $2) }'`
|
|
158
|
+
rules:
|
|
159
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_MESSAGE =~ /== release-by-devbot/'
|
|
160
|
+
when: never
|
|
161
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
162
|
+
# NOT merge requests and not triggerred by bot
|
|
163
|
+
# commit into default branch (master)
|
|
164
|
+
|
|
165
|
+
run-build:
|
|
166
|
+
stage: build
|
|
167
|
+
image:
|
|
168
|
+
name: registry-intl.cn-hongkong.aliyuncs.com/gkci/kaniko-executor:debug
|
|
169
|
+
entrypoint: [""]
|
|
170
|
+
artifacts:
|
|
171
|
+
paths:
|
|
172
|
+
- image-digest.txt
|
|
173
|
+
before_script:
|
|
174
|
+
- echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
|
|
175
|
+
script:
|
|
176
|
+
- echo "BUILDING... `cat $CI_PROJECT_DIR/image-tag.txt`"
|
|
177
|
+
- executor --cache=true --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --digest-file $CI_PROJECT_DIR/image-digest.txt --destination "`cat $CI_PROJECT_DIR/image-tag.txt`"
|
|
178
|
+
- echo "PUSHED `cat $CI_PROJECT_DIR/image-tag.txt` (`cat $CI_PROJECT_DIR/image-digest.txt`)"
|
|
179
|
+
rules:
|
|
180
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_MESSAGE =~ /== release-by-devbot/'
|
|
181
|
+
when: never
|
|
182
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
183
|
+
# NOT merge requests and not triggerred by bot
|
|
184
|
+
# commit into default branch (master)
|
|
185
|
+
|
|
186
|
+
run-build-commit:
|
|
187
|
+
stage: build-commit
|
|
188
|
+
image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
|
|
189
|
+
before_script:
|
|
190
|
+
- git config --global user.name "$GITLAB_USER_NAME"
|
|
191
|
+
- git config --global user.email "$GITLAB_USER_EMAIL"
|
|
192
|
+
script:
|
|
193
|
+
- git add -A
|
|
194
|
+
- git commit -m "$(make version)" -m "== release-by-devbot ($CI_COMMIT_SHA) =="
|
|
195
|
+
- git tag -a "$(make version)" -m "$(cat image-tag.txt) ($(cat image-digest.txt))"
|
|
196
|
+
- git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL#*@}" "HEAD:${CI_COMMIT_BRANCH}"
|
|
197
|
+
- git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL#*@}" --tags
|
|
198
|
+
rules:
|
|
199
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_MESSAGE =~ /== release-by-devbot/'
|
|
200
|
+
when: never
|
|
201
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
202
|
+
# NOT merge requests and not triggerred by bot
|
|
203
|
+
# commit into default branch (master)
|
|
204
|
+
|
|
205
|
+
run-release:
|
|
206
|
+
stage: release
|
|
207
|
+
image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
|
|
208
|
+
script:
|
|
209
|
+
- echo "Release version $(make version)"
|
|
210
|
+
rules:
|
|
211
|
+
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
|
212
|
+
when: never
|
|
213
|
+
- if: '$CI_COMMIT_TAG != null'
|
|
214
|
+
# NOT commit branch is NON default branch (master)
|
|
215
|
+
# tag was created
|
|
216
|
+
|
|
217
|
+
run-notify:
|
|
218
|
+
stage: notify
|
|
219
|
+
image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
|
|
220
|
+
before_script:
|
|
221
|
+
- apk --no-cache add curl
|
|
222
|
+
script:
|
|
223
|
+
- 'curl -X POST -H "Content-Type: application/json" -d "{\"chat_id\": \"$TELEGRAM_CHAT_ID\", \"text\": \"CI: $CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME version:$(make version) has been released \"}" https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage'
|
|
224
|
+
rules:
|
|
225
|
+
# NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT merge request and NOT tag was created
|
|
226
|
+
- if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG != null'
|
|
227
|
+
when: never
|
|
228
|
+
- if: '$TELEGRAM_BOT_TOKEN == null || $TELEGRAM_BOT_TOKEN == "" || $TELEGRAM_CHAT_ID == null || $TELEGRAM_CHAT_ID == ""'
|
|
229
|
+
when: never
|
|
230
|
+
# Commit message contains `run-prerelease` keyword and commit branch is not default branch (master)
|
|
231
|
+
- if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
|
|
232
|
+
# Commit into default branch (master)
|
|
233
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v18.19.0
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
2
|
+
ROOT_PATH := $(shell pwd)
|
|
3
|
+
SERVICE_NAME := <%= projectName %>
|
|
4
|
+
|
|
5
|
+
.PHONY: version name image
|
|
6
|
+
all: build
|
|
7
|
+
|
|
8
|
+
version-major: version-sync
|
|
9
|
+
@npm -s version major --no-git-tag-version
|
|
10
|
+
|
|
11
|
+
version-minor: version-sync
|
|
12
|
+
@npm -s version minor --no-git-tag-version
|
|
13
|
+
|
|
14
|
+
version-patch: version-sync
|
|
15
|
+
@npm -s version patch --no-git-tag-version
|
|
16
|
+
|
|
17
|
+
version-prerelease: version-sync
|
|
18
|
+
@npm -s version prerelease --preid=rc --no-git-tag-version
|
|
19
|
+
|
|
20
|
+
version-latest:
|
|
21
|
+
@(git tag --sort=-creatordate || echo) | awk 'NR==1 { \
|
|
22
|
+
split($$0, n, "-"); \
|
|
23
|
+
if (n[1] != "") { \
|
|
24
|
+
split(n[1], v, "."); \
|
|
25
|
+
if (v[1] ~ /^[0-9]+$$/ && v[2] ~ /^[0-9]+$$/ && v[3] ~ /^[0-9]+$$/) { \
|
|
26
|
+
print $$0; \
|
|
27
|
+
exit 0; \
|
|
28
|
+
} \
|
|
29
|
+
} \
|
|
30
|
+
print "1.0.0-rc.0"; \
|
|
31
|
+
} \
|
|
32
|
+
END { \
|
|
33
|
+
if (NR == 0) { \
|
|
34
|
+
print "1.0.0-rc.0"; \
|
|
35
|
+
} \
|
|
36
|
+
}'
|
|
37
|
+
|
|
38
|
+
version-sync:
|
|
39
|
+
@git checkout $(CI_COMMIT_BRANCH)
|
|
40
|
+
@git pull --tags 2&>/dev/null || true
|
|
41
|
+
@git tag --sort=-creatordate | head -10
|
|
42
|
+
@cat package.json | jq -r --arg PKG_VERSION `make --no-print-directory -f$(MAKEFILE) version-latest` '.version=$$PKG_VERSION' > package.json;
|
|
43
|
+
@echo -n "Current Git tag: "; cat package.json | jq -r '.version'
|
|
44
|
+
|
|
45
|
+
version:
|
|
46
|
+
@echo $(shell node -p "require('$(ROOT_PATH)/package.json').version")
|
|
47
|
+
|
|
48
|
+
name:
|
|
49
|
+
@echo $(SERVICE_NAME)
|
|
50
|
+
|
|
51
|
+
image:
|
|
52
|
+
@echo $(SERVICE_NAME):$(shell node -p "require('$(ROOT_PATH)/package.json').version")
|
|
53
|
+
|
|
54
|
+
test:
|
|
55
|
+
@echo SKIPPED
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { stringifyQuery } from 'ufo'
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue'
|
|
3
|
+
|
|
4
|
+
interface Options {
|
|
5
|
+
query: MaybeRefOrGetter<Record<string, any>>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const createUrl = (url: MaybeRefOrGetter<string>, options?: Options) => computed(() => {
|
|
9
|
+
if (!options?.query)
|
|
10
|
+
return toValue(url)
|
|
11
|
+
|
|
12
|
+
const _url = toValue(url)
|
|
13
|
+
const _query = toValue(options?.query)
|
|
14
|
+
|
|
15
|
+
const queryObj = Object.fromEntries(
|
|
16
|
+
Object.entries(_query).map(([key, val]) => [key, toValue(val)]),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return `${_url}${queryObj ? `?${stringifyQuery(queryObj)}` : ''}`
|
|
20
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Ported from [Nuxt](https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/cookie.ts)
|
|
2
|
+
|
|
3
|
+
import type { CookieParseOptions, CookieSerializeOptions } from 'cookie-es'
|
|
4
|
+
import { parse, serialize } from 'cookie-es'
|
|
5
|
+
import { destr } from 'destr'
|
|
6
|
+
|
|
7
|
+
type _CookieOptions = Omit<CookieSerializeOptions & CookieParseOptions, 'decode' | 'encode'>
|
|
8
|
+
|
|
9
|
+
export interface CookieOptions<T = any> extends _CookieOptions {
|
|
10
|
+
decode?(value: string): T
|
|
11
|
+
encode?(value: T): string
|
|
12
|
+
default?: () => T | Ref<T>
|
|
13
|
+
watch?: boolean | 'shallow'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type CookieRef<T> = Ref<T>
|
|
17
|
+
|
|
18
|
+
const CookieDefaults: CookieOptions<any> = {
|
|
19
|
+
path: '/',
|
|
20
|
+
watch: true,
|
|
21
|
+
decode: val => destr(decodeURIComponent(val)),
|
|
22
|
+
encode: val => encodeURIComponent(typeof val === 'string' ? val : JSON.stringify(val)),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const useCookie = <T = string | null | undefined>(name: string, _opts?: CookieOptions<T>): CookieRef<T> => {
|
|
26
|
+
const opts = { ...CookieDefaults, ..._opts || {} }
|
|
27
|
+
const cookies = parse(document.cookie, opts)
|
|
28
|
+
|
|
29
|
+
const cookie = ref<T | undefined>(cookies[name] as any ?? opts.default?.())
|
|
30
|
+
|
|
31
|
+
watch(cookie, () => {
|
|
32
|
+
document.cookie = serializeCookie(name, cookie.value, opts)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
return cookie as CookieRef<T>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function serializeCookie(name: string, value: any, opts: CookieSerializeOptions = {}) {
|
|
39
|
+
if (value === null || value === undefined)
|
|
40
|
+
return serialize(name, value, { ...opts, maxAge: -1 })
|
|
41
|
+
|
|
42
|
+
return serialize(name, value, opts)
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useTheme } from 'vuetify'
|
|
2
|
+
import { useConfigStore } from '@core/stores/config'
|
|
3
|
+
|
|
4
|
+
// composable function to return the image variant as per the current theme and skin
|
|
5
|
+
export const useGenerateImageVariant = (imgLight: string, imgDark: string, imgLightBordered?: string, imgDarkBordered?: string, bordered = false) => {
|
|
6
|
+
const configStore = useConfigStore()
|
|
7
|
+
const { global } = useTheme()
|
|
8
|
+
|
|
9
|
+
return computed(() => {
|
|
10
|
+
if (global.name.value === 'light') {
|
|
11
|
+
if (configStore.skin === 'bordered' && bordered)
|
|
12
|
+
return imgLightBordered
|
|
13
|
+
|
|
14
|
+
else
|
|
15
|
+
return imgLight
|
|
16
|
+
}
|
|
17
|
+
if (global.name.value === 'dark') {
|
|
18
|
+
if (configStore.skin === 'bordered' && bordered)
|
|
19
|
+
return imgDarkBordered
|
|
20
|
+
|
|
21
|
+
else
|
|
22
|
+
return imgDark
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Ref } from 'vue'
|
|
2
|
+
import { useDisplay } from 'vuetify'
|
|
3
|
+
|
|
4
|
+
export const useResponsiveLeftSidebar = (mobileBreakpoint: Ref<boolean> | undefined = undefined) => {
|
|
5
|
+
const { mdAndDown, name: currentBreakpoint } = useDisplay()
|
|
6
|
+
|
|
7
|
+
const _mobileBreakpoint = mobileBreakpoint || mdAndDown
|
|
8
|
+
|
|
9
|
+
const isLeftSidebarOpen = ref(true)
|
|
10
|
+
|
|
11
|
+
const setInitialValue = () => {
|
|
12
|
+
isLeftSidebarOpen.value = !_mobileBreakpoint.value
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Set the initial value of sidebar
|
|
16
|
+
setInitialValue()
|
|
17
|
+
|
|
18
|
+
watch(
|
|
19
|
+
currentBreakpoint,
|
|
20
|
+
() => {
|
|
21
|
+
// Reset left sidebar
|
|
22
|
+
isLeftSidebarOpen.value = !_mobileBreakpoint.value
|
|
23
|
+
},
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
isLeftSidebarOpen,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { VThemeProvider } from 'vuetify/components/VThemeProvider'
|
|
2
|
+
import { useConfigStore } from '@core/stores/config'
|
|
3
|
+
import { AppContentLayoutNav } from '@layouts/enums'
|
|
4
|
+
|
|
5
|
+
// TODO: Use `VThemeProvider` from dist instead of lib (Using this component from dist causes navbar to loose sticky positioning)
|
|
6
|
+
|
|
7
|
+
export const useSkins = () => {
|
|
8
|
+
const configStore = useConfigStore()
|
|
9
|
+
|
|
10
|
+
const layoutAttrs = computed(() => ({
|
|
11
|
+
verticalNavAttrs: {
|
|
12
|
+
wrapper: h(VThemeProvider, { tag: 'aside' }),
|
|
13
|
+
wrapperProps: {
|
|
14
|
+
withBackground: true,
|
|
15
|
+
theme: (configStore.isVerticalNavSemiDark && configStore.appContentLayoutNav === AppContentLayoutNav.Vertical)
|
|
16
|
+
? 'dark'
|
|
17
|
+
: undefined,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}))
|
|
21
|
+
|
|
22
|
+
const injectSkinClasses = () => {
|
|
23
|
+
if (typeof document !== 'undefined') {
|
|
24
|
+
const bodyClasses = document.body.classList
|
|
25
|
+
const genSkinClass = (_skin?: string) => `skin--${_skin}`
|
|
26
|
+
|
|
27
|
+
watch(
|
|
28
|
+
() => configStore.skin,
|
|
29
|
+
(val, oldVal) => {
|
|
30
|
+
bodyClasses.remove(genSkinClass(oldVal))
|
|
31
|
+
bodyClasses.add(genSkinClass(val))
|
|
32
|
+
},
|
|
33
|
+
{ immediate: true },
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
injectSkinClasses,
|
|
40
|
+
layoutAttrs,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const Skins = {
|
|
2
|
+
Default: 'default',
|
|
3
|
+
Bordered: 'bordered',
|
|
4
|
+
} as const
|
|
5
|
+
|
|
6
|
+
export const Theme = {
|
|
7
|
+
Light: 'light',
|
|
8
|
+
Dark: 'dark',
|
|
9
|
+
System: 'system',
|
|
10
|
+
} as const
|
|
11
|
+
|
|
12
|
+
export const Layout = {
|
|
13
|
+
Vertical: 'vertical',
|
|
14
|
+
Horizontal: 'horizontal',
|
|
15
|
+
Collapsed: 'collapsed',
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
export const Direction = {
|
|
19
|
+
Ltr: 'ltr',
|
|
20
|
+
Rtl: 'rtl',
|
|
21
|
+
} as const
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { UserThemeConfig } from './types'
|
|
2
|
+
import type { LayoutConfig } from '@layouts/types'
|
|
3
|
+
|
|
4
|
+
export const defineThemeConfig = (userConfig: UserThemeConfig): { themeConfig: UserThemeConfig; layoutConfig: LayoutConfig } => {
|
|
5
|
+
return {
|
|
6
|
+
themeConfig: userConfig,
|
|
7
|
+
layoutConfig: {
|
|
8
|
+
app: {
|
|
9
|
+
title: userConfig.app.title,
|
|
10
|
+
logo: userConfig.app.logo,
|
|
11
|
+
contentWidth: userConfig.app.contentWidth,
|
|
12
|
+
contentLayoutNav: userConfig.app.contentLayoutNav,
|
|
13
|
+
overlayNavFromBreakpoint: userConfig.app.overlayNavFromBreakpoint,
|
|
14
|
+
i18n: {
|
|
15
|
+
enable: userConfig.app.i18n.enable,
|
|
16
|
+
},
|
|
17
|
+
iconRenderer: userConfig.app.iconRenderer,
|
|
18
|
+
},
|
|
19
|
+
navbar: {
|
|
20
|
+
type: userConfig.navbar.type,
|
|
21
|
+
navbarBlur: userConfig.navbar.navbarBlur,
|
|
22
|
+
},
|
|
23
|
+
footer: { type: userConfig.footer.type },
|
|
24
|
+
verticalNav: {
|
|
25
|
+
isVerticalNavCollapsed: userConfig.verticalNav.isVerticalNavCollapsed,
|
|
26
|
+
defaultNavItemIconProps: userConfig.verticalNav.defaultNavItemIconProps,
|
|
27
|
+
},
|
|
28
|
+
horizontalNav: {
|
|
29
|
+
type: userConfig.horizontalNav.type,
|
|
30
|
+
transition: userConfig.horizontalNav.transition,
|
|
31
|
+
popoverOffset: userConfig.horizontalNav.popoverOffset,
|
|
32
|
+
},
|
|
33
|
+
icons: {
|
|
34
|
+
chevronDown: userConfig.icons.chevronDown,
|
|
35
|
+
chevronRight: userConfig.icons.chevronRight,
|
|
36
|
+
close: userConfig.icons.close,
|
|
37
|
+
verticalNavPinned: userConfig.icons.verticalNavPinned,
|
|
38
|
+
verticalNavUnPinned: userConfig.icons.verticalNavUnPinned,
|
|
39
|
+
sectionTitlePlaceholder: userConfig.icons.sectionTitlePlaceholder,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useStorage } from '@vueuse/core'
|
|
2
|
+
import { useTheme } from 'vuetify'
|
|
3
|
+
import { useConfigStore } from '@core/stores/config'
|
|
4
|
+
import { cookieRef, namespaceConfig } from '@layouts/stores/config'
|
|
5
|
+
import { themeConfig } from '@themeConfig'
|
|
6
|
+
|
|
7
|
+
const _syncAppRtl = () => {
|
|
8
|
+
const configStore = useConfigStore()
|
|
9
|
+
const storedLang = cookieRef<string | null>('language', null)
|
|
10
|
+
|
|
11
|
+
const { locale } = useI18n({ useScope: 'global' })
|
|
12
|
+
|
|
13
|
+
// TODO: Handle case where i18n can't read persisted value
|
|
14
|
+
if (locale.value !== storedLang.value && storedLang.value)
|
|
15
|
+
locale.value = storedLang.value
|
|
16
|
+
|
|
17
|
+
// watch and change lang attribute of html on language change
|
|
18
|
+
watch(
|
|
19
|
+
locale,
|
|
20
|
+
val => {
|
|
21
|
+
// Update lang attribute of html tag
|
|
22
|
+
if (typeof document !== 'undefined')
|
|
23
|
+
document.documentElement.setAttribute('lang', val as string)
|
|
24
|
+
|
|
25
|
+
// Store selected language in cookie
|
|
26
|
+
storedLang.value = val as string
|
|
27
|
+
|
|
28
|
+
// set isAppRtl value based on selected language
|
|
29
|
+
if (themeConfig.app.i18n.langConfig && themeConfig.app.i18n.langConfig.length) {
|
|
30
|
+
themeConfig.app.i18n.langConfig.forEach(lang => {
|
|
31
|
+
if (lang.i18nLang === storedLang.value)
|
|
32
|
+
configStore.isAppRTL = lang.isRTL
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{ immediate: true },
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const _handleSkinChanges = () => {
|
|
41
|
+
const { themes } = useTheme()
|
|
42
|
+
const configStore = useConfigStore()
|
|
43
|
+
|
|
44
|
+
// Create skin default color so that we can revert back to original (default skin) color when switch to default skin from bordered skin
|
|
45
|
+
Object.values(themes.value).forEach(t => {
|
|
46
|
+
t.colors['skin-default-background'] = t.colors.background
|
|
47
|
+
t.colors['skin-default-surface'] = t.colors.surface
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
watch(
|
|
51
|
+
() => configStore.skin,
|
|
52
|
+
val => {
|
|
53
|
+
Object.values(themes.value).forEach(t => {
|
|
54
|
+
t.colors.background = t.colors[`skin-${val}-background`]
|
|
55
|
+
t.colors.surface = t.colors[`skin-${val}-surface`]
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
{ immediate: true },
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
ℹ️ Set current theme's surface color in localStorage
|
|
64
|
+
|
|
65
|
+
Why? Because when initial loader is shown (before vue is ready) we need to what's the current theme's surface color.
|
|
66
|
+
We will use color stored in localStorage to set the initial loader's background color.
|
|
67
|
+
|
|
68
|
+
With this we will be able to show correct background color for the initial loader even before vue identify the current theme.
|
|
69
|
+
*/
|
|
70
|
+
const _syncInitialLoaderTheme = () => {
|
|
71
|
+
const vuetifyTheme = useTheme()
|
|
72
|
+
|
|
73
|
+
watch(
|
|
74
|
+
() => useConfigStore().theme,
|
|
75
|
+
() => {
|
|
76
|
+
// ℹ️ We are not using theme.current.colors.surface because watcher is independent and when this watcher is ran `theme` computed is not updated
|
|
77
|
+
useStorage<string | null>(namespaceConfig('initial-loader-bg'), null).value = vuetifyTheme.current.value.colors.surface
|
|
78
|
+
useStorage<string | null>(namespaceConfig('initial-loader-color'), null).value = vuetifyTheme.current.value.colors.primary
|
|
79
|
+
},
|
|
80
|
+
{ immediate: true },
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const initCore = () => {
|
|
85
|
+
_syncInitialLoaderTheme()
|
|
86
|
+
_handleSkinChanges()
|
|
87
|
+
|
|
88
|
+
// ℹ️ We don't want to trigger i18n in SK
|
|
89
|
+
if (themeConfig.app.i18n.enable)
|
|
90
|
+
_syncAppRtl()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default initCore
|