@nathapp/na-cli 1.0.0-rc.4 → 1.0.0-rc.40

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 (252) hide show
  1. package/.gitlab-ci.yml +135 -0
  2. package/Makefile +16 -9
  3. package/README.md +18 -2
  4. package/alias-script.sh +30 -0
  5. package/dist/index.js +106 -128
  6. package/dist/index.js.map +1 -1
  7. package/dist/templates/db-schema/.gitignore-rename +1 -0
  8. package/dist/templates/db-schema/.gitlab-ci.yml +139 -0
  9. package/dist/templates/db-schema/001_Schema.sql +1 -0
  10. package/dist/templates/db-schema/DEV_MODE.txt +1 -0
  11. package/dist/templates/db-schema/Dockerfile +3 -0
  12. package/dist/templates/db-schema/Email-Templates/Individual/README.md +1 -0
  13. package/dist/templates/db-schema/GET_VERSION.sql +47 -0
  14. package/dist/templates/db-schema/Makefile +885 -0
  15. package/dist/templates/db-schema/README.md +117 -0
  16. package/dist/templates/db-schema/SET_VERSION.sql +5 -0
  17. package/dist/templates/db-schema/docker-compose.yaml +47 -0
  18. package/dist/templates/db-schema/package.json +3 -0
  19. package/dist/templates/db-schema/push.sh +0 -0
  20. package/dist/templates/db-schema/samples/899_DB_Grant_User.sql +9 -0
  21. package/dist/templates/db-schema/samples/990_SAMPLE_Init_Data.sql +27 -0
  22. package/dist/templates/k8s-deployment/.gitignore-rename +1 -0
  23. package/dist/templates/k8s-deployment/.gitlab-ci.yml +128 -0
  24. package/dist/templates/k8s-deployment/.helmignore +23 -0
  25. package/dist/templates/k8s-deployment/Chart.yaml +23 -0
  26. package/dist/templates/k8s-deployment/Makefile +196 -0
  27. package/dist/templates/k8s-deployment/README.md +32 -0
  28. package/dist/templates/k8s-deployment/resources/charts/mysql/Chart.yaml +23 -0
  29. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/Chart.yaml +23 -0
  30. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/script/Makefile +12 -0
  31. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/_helpers.tpl +62 -0
  32. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/configmap.yaml +1 -0
  33. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/job.yaml +1 -0
  34. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/secret.yaml +1 -0
  35. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/values.yaml +51 -0
  36. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/_helpers.tpl +62 -0
  37. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/configmap.yaml +1 -0
  38. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/deployment.yaml +1 -0
  39. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/ingress.yaml +1 -0
  40. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/job.yaml +1 -0
  41. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/pv.yaml +1 -0
  42. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/pvc.yaml +1 -0
  43. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/sc.yaml +1 -0
  44. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/secret.yaml +1 -0
  45. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/service.yaml +1 -0
  46. package/dist/templates/k8s-deployment/resources/charts/mysql/templates/statefulset.yaml +1 -0
  47. package/dist/templates/k8s-deployment/resources/charts/mysql/values.yaml +15 -0
  48. package/dist/templates/k8s-deployment/resources/charts/redis/Chart.yaml +23 -0
  49. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/Chart.yaml +23 -0
  50. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/script/Makefile +8 -0
  51. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/_helpers.tpl +62 -0
  52. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/configmap.yaml +1 -0
  53. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/job.yaml +1 -0
  54. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/secret.yaml +1 -0
  55. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/values.yaml +42 -0
  56. package/dist/templates/k8s-deployment/resources/charts/redis/templates/_helpers.tpl +62 -0
  57. package/dist/templates/k8s-deployment/resources/charts/redis/templates/configmap.yaml +1 -0
  58. package/dist/templates/k8s-deployment/resources/charts/redis/templates/deployment.yaml +1 -0
  59. package/dist/templates/k8s-deployment/resources/charts/redis/templates/ingress.yaml +1 -0
  60. package/dist/templates/k8s-deployment/resources/charts/redis/templates/job.yaml +1 -0
  61. package/dist/templates/k8s-deployment/resources/charts/redis/templates/pv.yaml +1 -0
  62. package/dist/templates/k8s-deployment/resources/charts/redis/templates/pvc.yaml +1 -0
  63. package/dist/templates/k8s-deployment/resources/charts/redis/templates/sc.yaml +1 -0
  64. package/dist/templates/k8s-deployment/resources/charts/redis/templates/secret.yaml +1 -0
  65. package/dist/templates/k8s-deployment/resources/charts/redis/templates/service.yaml +1 -0
  66. package/dist/templates/k8s-deployment/resources/charts/redis/templates/statefulset.yaml +1 -0
  67. package/dist/templates/k8s-deployment/resources/charts/redis/values.yaml +12 -0
  68. package/dist/templates/k8s-deployment/services/charts/hooks/Chart.yaml +23 -0
  69. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/Chart.yaml +23 -0
  70. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/script/Makefile +49 -0
  71. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/script/_env.yaml +2 -0
  72. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/_helpers.tpl +62 -0
  73. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/configmap.yaml +1 -0
  74. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/job.yaml +1 -0
  75. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/secret.yaml +1 -0
  76. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/values.yaml +36 -0
  77. package/dist/templates/k8s-deployment/services/charts/sample-nginx/Chart.yaml +23 -0
  78. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/_helpers.tpl +62 -0
  79. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/cluster-role-binding.yaml +1 -0
  80. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/configmap.yaml +1 -0
  81. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/cronjob.yaml +1 -0
  82. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/deployment.yaml +1 -0
  83. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/ingress.yaml +1 -0
  84. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/pv.yaml +1 -0
  85. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/pvc.yaml +1 -0
  86. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/sc.yaml +1 -0
  87. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/secret.yaml +1 -0
  88. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/service-account.yaml +1 -0
  89. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/service.yaml +1 -0
  90. package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/statefulset.yaml +1 -0
  91. package/dist/templates/k8s-deployment/services/charts/sample-nginx/values.yaml +47 -0
  92. package/dist/templates/k8s-deployment/services/charts/tests/Chart.yaml +23 -0
  93. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/Chart.yaml +23 -0
  94. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/Makefile +9 -0
  95. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/fixtures/index.json +1 -0
  96. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/login/login-spec.js +47 -0
  97. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/login/loginEmailWrong-spec.js +14 -0
  98. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/login/loginPasswordWrong-spec.js +14 -0
  99. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/profile/updatePassword-spec.js +15 -0
  100. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/profile/updateProfile-spec.js +25 -0
  101. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/test-script.spec.js +9 -0
  102. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/plugins/index.js +22 -0
  103. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/support/commands.js +258 -0
  104. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/support/index.js +35 -0
  105. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/support/misc.js +8 -0
  106. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress.json +4 -0
  107. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/_helpers.tpl +62 -0
  108. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/configmap.yaml +1 -0
  109. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/pod.yaml +1 -0
  110. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/secret.yaml +1 -0
  111. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/values.yaml +70 -0
  112. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/.helmignore +2 -0
  113. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/Chart.yaml +23 -0
  114. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/script/Makefile +14 -0
  115. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/_helpers.tpl +62 -0
  116. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/configmap.yaml +1 -0
  117. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/pod.yaml +1 -0
  118. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/secret.yaml +1 -0
  119. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/_t-0100-readiness-liveness.ts +84 -0
  120. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/hub.ts +372 -0
  121. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contact.ts +158 -0
  122. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contract.ts +328 -0
  123. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-kyc.ts +304 -0
  124. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-app.ts +823 -0
  125. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-web.ts +493 -0
  126. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-profile.ts +277 -0
  127. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-whitelist.ts +133 -0
  128. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/resources/live.jpg +0 -0
  129. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/resources/mykad_front.jpg +0 -0
  130. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/resources/profile.jpg +0 -0
  131. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/t-0200-start.ts +172 -0
  132. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/values.yaml +59 -0
  133. package/dist/templates/k8s-deployment/templates/_cluster-role-binding.tpl +20 -0
  134. package/dist/templates/k8s-deployment/templates/_configmap.tpl +37 -0
  135. package/dist/templates/k8s-deployment/templates/_cronjob.tpl +225 -0
  136. package/dist/templates/k8s-deployment/templates/_deployment.tpl +246 -0
  137. package/dist/templates/k8s-deployment/templates/_helpers.tpl +31 -0
  138. package/dist/templates/k8s-deployment/templates/_ingress.tpl +77 -0
  139. package/dist/templates/k8s-deployment/templates/_job.tpl +233 -0
  140. package/dist/templates/k8s-deployment/templates/_pod.tpl +214 -0
  141. package/dist/templates/k8s-deployment/templates/_pv.tpl +42 -0
  142. package/dist/templates/k8s-deployment/templates/_pvc.tpl +27 -0
  143. package/dist/templates/k8s-deployment/templates/_root.tpl +314 -0
  144. package/dist/templates/k8s-deployment/templates/_sc.tpl +19 -0
  145. package/dist/templates/k8s-deployment/templates/_secret.tpl +15 -0
  146. package/dist/templates/k8s-deployment/templates/_service-account.tpl +8 -0
  147. package/dist/templates/k8s-deployment/templates/_service.tpl +40 -0
  148. package/dist/templates/k8s-deployment/templates/_statefulset.tpl +244 -0
  149. package/dist/templates/k8s-deployment/templates/root-cm.yaml +10 -0
  150. package/dist/templates/k8s-deployment/templates/root-pull-secret.yaml +11 -0
  151. package/dist/templates/k8s-deployment/templates/root-secret.yaml +24 -0
  152. package/dist/templates/k8s-deployment/values.yaml +38 -0
  153. package/dist/templates/k8s-helm-chart/Chart.yaml +23 -0
  154. package/dist/templates/k8s-helm-chart/templates/_helpers.tpl +62 -0
  155. package/dist/templates/k8s-helm-chart/templates/cluster-role-binding.yaml +1 -0
  156. package/dist/templates/k8s-helm-chart/templates/configmap.yaml +1 -0
  157. package/dist/templates/k8s-helm-chart/templates/cronjob.yaml +1 -0
  158. package/dist/templates/k8s-helm-chart/templates/deployment.yaml +1 -0
  159. package/dist/templates/k8s-helm-chart/templates/ingress.yaml +1 -0
  160. package/dist/templates/k8s-helm-chart/templates/pv.yaml +1 -0
  161. package/dist/templates/k8s-helm-chart/templates/pvc.yaml +1 -0
  162. package/dist/templates/k8s-helm-chart/templates/sc.yaml +1 -0
  163. package/dist/templates/k8s-helm-chart/templates/secret.yaml +1 -0
  164. package/dist/templates/k8s-helm-chart/templates/service-account.yaml +1 -0
  165. package/dist/templates/k8s-helm-chart/templates/service.yaml +1 -0
  166. package/dist/templates/k8s-helm-chart/templates/statefulset.yaml +1 -0
  167. package/dist/templates/k8s-helm-chart/values.yaml +41 -0
  168. package/dist/templates/mxw-base-api-express/.dockerignore +2 -0
  169. package/dist/templates/mxw-base-api-express/.env +10 -0
  170. package/dist/templates/mxw-base-api-express/.gitignore-rename +3 -0
  171. package/dist/templates/mxw-base-api-express/.gitlab-ci.yml +174 -0
  172. package/dist/templates/mxw-base-api-express/.nvmrc +1 -0
  173. package/dist/templates/mxw-base-api-express/Dockerfile +14 -0
  174. package/dist/templates/mxw-base-api-express/Makefile +84 -0
  175. package/dist/templates/mxw-base-api-express/README.md +71 -0
  176. package/dist/templates/mxw-base-api-express/package.json +55 -0
  177. package/dist/templates/mxw-base-api-express/src/app-service.test.ts +94 -0
  178. package/dist/templates/mxw-base-api-express/src/app-service.ts +498 -0
  179. package/dist/templates/mxw-base-api-express/src/auth/auth-user.test.ts +215 -0
  180. package/dist/templates/mxw-base-api-express/src/auth/auth-user.ts +86 -0
  181. package/dist/templates/mxw-base-api-express/src/auth/auth.ts +81 -0
  182. package/dist/templates/mxw-base-api-express/src/core-service.ts +72 -0
  183. package/dist/templates/mxw-base-api-express/src/crud.ts +84 -0
  184. package/dist/templates/mxw-base-api-express/src/http-handler.ts +71 -0
  185. package/dist/templates/mxw-base-api-express/src/server.ts +54 -0
  186. package/dist/templates/mxw-base-api-express/src/test.ts +38 -0
  187. package/dist/templates/mxw-base-api-express/src/utils/api-utilities.ts +52 -0
  188. package/dist/templates/mxw-base-api-express/src/utils/file-utilities.ts +55 -0
  189. package/dist/templates/mxw-base-api-express/tsconfig.json +32 -0
  190. package/dist/templates/nestjs-api/.dockerignore +2 -0
  191. package/dist/templates/nestjs-api/.env +12 -0
  192. package/dist/templates/nestjs-api/.eslintrc.js +25 -0
  193. package/dist/templates/nestjs-api/.gitignore-rename +35 -0
  194. package/dist/templates/nestjs-api/.gitlab-ci.yml +174 -0
  195. package/dist/templates/nestjs-api/.nvmrc +1 -0
  196. package/dist/templates/nestjs-api/.prettierrc +4 -0
  197. package/dist/templates/nestjs-api/Dockerfile +19 -0
  198. package/dist/templates/nestjs-api/Makefile +84 -0
  199. package/dist/templates/nestjs-api/README.md +67 -0
  200. package/dist/templates/nestjs-api/nest-cli.json +8 -0
  201. package/dist/templates/nestjs-api/package.json +75 -0
  202. package/dist/templates/nestjs-api/src/app.controller.spec.ts +22 -0
  203. package/dist/templates/nestjs-api/src/app.controller.ts +27 -0
  204. package/dist/templates/nestjs-api/src/app.module.ts +10 -0
  205. package/dist/templates/nestjs-api/src/app.service.ts +12 -0
  206. package/dist/templates/nestjs-api/src/main.ts +31 -0
  207. package/dist/templates/nestjs-api/test/app.e2e-spec.ts +24 -0
  208. package/dist/templates/nestjs-api/test/jest-e2e.json +9 -0
  209. package/dist/templates/nestjs-api/tsconfig.build.json +4 -0
  210. package/dist/templates/nestjs-api/tsconfig.json +22 -0
  211. package/dist/templates/nestjs-library/.eslintrc.js +24 -0
  212. package/dist/templates/nestjs-library/.gitignore-rename +39 -0
  213. package/dist/templates/nestjs-library/.gitlab-ci.yml +135 -0
  214. package/dist/templates/nestjs-library/.npmignore-rename +30 -0
  215. package/dist/templates/nestjs-library/.prettierrc +6 -0
  216. package/dist/templates/nestjs-library/LICENSE +21 -0
  217. package/dist/templates/nestjs-library/Makefile +60 -0
  218. package/dist/templates/nestjs-library/README.md +3 -0
  219. package/dist/templates/nestjs-library/index.d.ts +1 -0
  220. package/dist/templates/nestjs-library/index.js +6 -0
  221. package/dist/templates/nestjs-library/index.ts +1 -0
  222. package/dist/templates/nestjs-library/lib/index.ts +2 -0
  223. package/dist/templates/nestjs-library/package.json +43 -0
  224. package/dist/templates/nestjs-library/tsconfig.build.json +4 -0
  225. package/dist/templates/nestjs-library/tsconfig.json +18 -0
  226. package/dist/templates/ts-library/.dockerignore +2 -0
  227. package/dist/templates/ts-library/.eslintrc.js +24 -0
  228. package/dist/templates/ts-library/.gitignore-rename +37 -0
  229. package/dist/templates/ts-library/.gitlab-ci.yml +135 -0
  230. package/dist/templates/ts-library/.npmignore-rename +30 -0
  231. package/dist/templates/ts-library/.prettierrc +6 -0
  232. package/dist/templates/ts-library/LICENSE +21 -0
  233. package/dist/templates/ts-library/Makefile +58 -0
  234. package/dist/templates/ts-library/README.md +1 -0
  235. package/dist/templates/ts-library/index.d.ts +1 -0
  236. package/dist/templates/ts-library/index.js +6 -0
  237. package/dist/templates/ts-library/index.ts +1 -0
  238. package/dist/templates/ts-library/lib/index.ts +1 -0
  239. package/dist/templates/ts-library/lib/samples/index.ts +5 -0
  240. package/dist/templates/ts-library/lib/samples/samples-function.ts +3 -0
  241. package/dist/templates/ts-library/package.json +34 -0
  242. package/dist/templates/ts-library/test/jest-e2e.json +9 -0
  243. package/dist/templates/ts-library/test/sample.e2e-spec.ts +10 -0
  244. package/dist/templates/ts-library/tsconfig.build.json +4 -0
  245. package/dist/templates/ts-library/tsconfig.json +18 -0
  246. package/dist/utils/env.js +146 -0
  247. package/dist/utils/env.js.map +1 -0
  248. package/dist/utils/template.js +362 -1
  249. package/dist/utils/template.js.map +1 -1
  250. package/package.json +9 -5
  251. package/src/index.ts +0 -182
  252. package/src/utils/template.ts +0 -9
@@ -0,0 +1,24 @@
1
+ {{- if .Values.global.secret.root }}
2
+ apiVersion: v1
3
+ kind: Secret
4
+ metadata:
5
+ name: {{ print $.Release.Name "-root" }}
6
+ type: Opaque
7
+ data:
8
+ {{- with .Values.global.secret.root }}
9
+ {{- range $key, $value := . }}
10
+ {{- $key | nindent 2 }}{{- ": " -}}
11
+ {{- if eq (typeOf $value) "string" -}}
12
+ {{ include "root.global" (list $ $value) | b64enc }}
13
+ {{- else -}}
14
+ {{- if hasKey $value "service" -}}
15
+ {{- with index $value "service" -}}
16
+ {{ include "root.global" (list $ "CLUSTER_BASE_URL" .schema .name .namespace .domain .port) | b64enc }}
17
+ {{- end -}}
18
+ {{- else -}}
19
+ {{ include "root.global" (list $ $key) | b64enc }}
20
+ {{- end -}}
21
+ {{- end -}}
22
+ {{- end }}
23
+ {{- end }}
24
+ {{- end }}
@@ -0,0 +1,38 @@
1
+ mysql:
2
+ enabled: false
3
+ mysql-install:
4
+ enabled: false
5
+ config:
6
+ GIT_REPO: "gitlab.com/test-db-scehama.git"
7
+ GIT_TAG: "1.0.0"
8
+ CI_PIPELINE_URL: "{{CI_PIPELINE_URL}}"
9
+ secret:
10
+ HOST_IP: "rm-xxxxxx.mysql.rds.aliyuncs.com"
11
+ USERNAME: "{{CI_DB_USERNAME}}"
12
+ PASSWORD: "{{CI_DB_PASSWORD}}"
13
+ GITLAB_USER_NAME: "{{GITLAB_USER_NAME}}"
14
+ CI_GIT_TOKEN: "{{CI_GIT_TOKEN}}"
15
+ redis:
16
+ enabled: false
17
+ redis-install:
18
+ enabled: false
19
+ secret:
20
+ HOST_URL: "redis://root@{{Release.Name}}-redis.{{CLUSTER_NAMESPACE}}.svc.{{CLUSTER_DOMAIN}}:6379/0"
21
+
22
+
23
+
24
+ global:
25
+ secret:
26
+ root:
27
+ REDIS_URL: "redis://root@{{Release.Name}}-rsc-redis.{{CLUSTER_NAMESPACE}}.svc.{{CLUSTER_DOMAIN}}:6379/0"
28
+
29
+ root:
30
+ SERVICE_DOMAIN: "WKS"
31
+ SERVICE_BASE_SCHEMA: "https"
32
+ SERVICE_BASE_DOMAIN: "api.example.com"
33
+ SERVICE_BASE_DOMAIN_CERT: "ssl-example.com"
34
+ MYSQL_BASE_SCHEMA: "mysql"
35
+ MYSQL_BASE_DATABASE: "dev"
36
+ MYSQL_BASE_DOMAIN: "{{Release.Name}}-mysql.{{CLUSTER_NAMESPACE}}.svc.{{CLUSTER_DOMAIN}}"
37
+
38
+ pathType: "Prefix"
@@ -0,0 +1,23 @@
1
+ apiVersion: v2
2
+ name: <%= chartName %>
3
+ description: <%= chartName %>
4
+
5
+ # A chart can be either an 'application' or a 'library' chart.
6
+ #
7
+ # Application charts are a collection of templates that can be packaged into versioned archives
8
+ # to be deployed.
9
+ #
10
+ # Library charts provide useful utilities or functions for the chart developer. They're included as
11
+ # a dependency of application charts to inject those utilities and functions into the rendering
12
+ # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13
+ type: application
14
+
15
+ # This is the chart version. This version number should be incremented each time you make changes
16
+ # to the chart and its templates, including the app version.
17
+ # Versions are expected to follow Semantic Versioning (https://semver.org/)
18
+ version: 0.1.0
19
+
20
+ # This is the version number of the application being deployed. This version number should be
21
+ # incremented each time you make changes to the application. Versions are not expected to
22
+ # follow Semantic Versioning. They should reflect the version the application is using.
23
+ appVersion: 1.16.0
@@ -0,0 +1,62 @@
1
+ {{/*
2
+ Expand the name of the chart.
3
+ */}}
4
+ {{- define "<%= chartName %>.name" -}}
5
+ {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6
+ {{- end }}
7
+
8
+ {{/*
9
+ Create a default fully qualified app name.
10
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11
+ If release name contains chart name it will be used as a full name.
12
+ */}}
13
+ {{- define "<%= chartName %>.fullname" -}}
14
+ {{- if .Values.fullnameOverride }}
15
+ {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16
+ {{- else }}
17
+ {{- $name := default .Chart.Name .Values.nameOverride }}
18
+ {{- if contains $name .Release.Name }}
19
+ {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20
+ {{- else }}
21
+ {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22
+ {{- end }}
23
+ {{- end }}
24
+ {{- end }}
25
+
26
+ {{/*
27
+ Create chart name and version as used by the chart label.
28
+ */}}
29
+ {{- define "<%= chartName %>.chart" -}}
30
+ {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31
+ {{- end }}
32
+
33
+ {{/*
34
+ Common labels
35
+ */}}
36
+ {{- define "<%= chartName %>.labels" -}}
37
+ helm.sh/chart: {{ include "<%= chartName %>.chart" . }}
38
+ {{ include "<%= chartName %>.selectorLabels" . }}
39
+ {{- if .Chart.AppVersion }}
40
+ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41
+ {{- end }}
42
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
43
+ {{- end }}
44
+
45
+ {{/*
46
+ Selector labels
47
+ */}}
48
+ {{- define "<%= chartName %>.selectorLabels" -}}
49
+ app.kubernetes.io/name: {{ include "<%= chartName %>.name" . }}
50
+ app.kubernetes.io/instance: {{ .Release.Name }}
51
+ {{- end }}
52
+
53
+ {{/*
54
+ Create the name of the service account to use
55
+ */}}
56
+ {{- define "<%= chartName %>.serviceAccountName" -}}
57
+ {{- if .Values.serviceAccount.create }}
58
+ {{- default (include "<%= chartName %>.fullname" .) .Values.serviceAccount.name }}
59
+ {{- else }}
60
+ {{- default "default" .Values.serviceAccount.name }}
61
+ {{- end }}
62
+ {{- end }}
@@ -0,0 +1 @@
1
+ {{- include "root.cluster-role-binding" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.configmap" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.cronjob" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.deployment" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.ingress" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.pv" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.pvc" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.sc" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.secret" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.service-account" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.service" $ }}
@@ -0,0 +1 @@
1
+ {{- include "root.statefulset" $ }}
@@ -0,0 +1,41 @@
1
+ enabled: true
2
+ kind: <%= chartKind %>
3
+ replicaCount: 1
4
+ image:
5
+ repository: <%= containerRegistry %>
6
+ tag: "<%= containerVersion %>"
7
+ pullPolicy: IfNotPresent
8
+
9
+ imagePullSecrets: "{{Release.Name}}-pull"
10
+
11
+ service:
12
+ type: ClusterIP
13
+ port: 80
14
+ targetPort: 80
15
+
16
+ ingress:
17
+ className: "nginx"
18
+ annotations:
19
+ nginx.ingress.kubernetes.io/ssl-redirect: "true"
20
+ nginx.ingress.kubernetes.io/rewrite-target: /$1
21
+ nginx.ingress.kubernetes.io/configuration-snippet: |
22
+ gzip on;
23
+ gzip_min_length 20;
24
+ gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
25
+
26
+ hosts:
27
+ - host: www.example.com
28
+ paths:
29
+ - path: "/?(.*)"
30
+ pathType: "Prefix"
31
+ tls:
32
+ - secretName: SERVICE_BASE_DOMAIN_CERT
33
+ hosts:
34
+ - SERVICE_BASE_DOMAIN
35
+
36
+ readinessProbe:
37
+ httpGet:
38
+ path: /
39
+ port: 80
40
+ initialDelaySeconds: 10
41
+ periodSeconds: 5
@@ -0,0 +1,2 @@
1
+ dist
2
+ node_modules
@@ -0,0 +1,10 @@
1
+ JWT_SECRET="JWT_SECRET"
2
+ WHITELIST="*"
3
+ CORS="*"
4
+
5
+ SERVICE_DOMAIN="DOMAIN"
6
+ SERVICE_SESSION_TIMEOUT="60000"
7
+ SERVICE_WALLET_JSON={"address":"mxw1pv3lfk3s0mp0nw9sftv95s5tfzwqu26qqw3d2s","id":"99ddd9b3-23aa-4dbf-a8cc-d89e885121d2","version":3,"Crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"1fd9e58278c96fd902b334e4a3b16838"},"ciphertext":"fa5ea57bdae0a4dffb997d2c09c93f9a472b2a881c42c486cbd6ba001d112dcd","kdf":"scrypt","kdfparams":{"salt":"f03e572526d9f6fc204f7061d4766cd8eda9760a78f91803783c441879efc5ac","n":131072,"dklen":32,"p":1,"r":8},"mac":"770b8ba60c1167ffaeaace160341d6868437fd4992b772951cc217025082b1f8"},"x-mxw":{"client":"mxw-sdk","filename":"UTC--2019-07-25T11-49-57.0Z--mxw1pv3lfk3s0mp0nw9sftv95s5tfzwqu26qqw3d2s","mnemonicCounter":"d04f8666f6b894af7f4ef90bb568d7b0","mnemonicCiphertext":"0af223d5975c3466b0e2aecd30cdeab0","path":"m/44'/376'/0'/0/0","version":"0.1"}}
8
+ SERVICE_WALLET_PASSWORD=any strong password
9
+
10
+ MYSQL_URL="mysql://user:password@db/db"
@@ -0,0 +1,3 @@
1
+ node_modules/
2
+ dist/
3
+ .DS_Store
@@ -0,0 +1,174 @@
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
+ # run test cases
12
+ - test
13
+ # build container image and push to registry
14
+ - prepare
15
+ - build-init
16
+ - build
17
+ - build-commit
18
+ # mark release commit as verified
19
+ - release
20
+ - notify
21
+
22
+ run-test:
23
+ stage: test
24
+ image: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/docker:18-ci
25
+ services:
26
+ - docker:18-dind
27
+ script:
28
+ - make test
29
+ rules:
30
+ # NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT tag was created
31
+ - if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_COMMIT_TAG != null'
32
+ when: never
33
+ # Merge request
34
+ - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
35
+ # Commit to protected branch or commit branch is default branch (master)
36
+ - if: '$CI_COMMIT_REF_PROTECTED == "true" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
37
+ # Commit message contains `run-test` keyword
38
+ - if: '$CI_COMMIT_MESSAGE =~ /run-test/'
39
+ # Commit message contains `run-prerelease` keyword and commit branch is not default branch (master)
40
+ - if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
41
+
42
+ run-pre-prepare:
43
+ stage: prepare
44
+ image: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/node:10.20.0-alpine-ci-1
45
+ artifacts:
46
+ paths:
47
+ - package.json
48
+ - package-lock.json
49
+ - image-tag.txt
50
+ - postman-collection.json
51
+ script:
52
+ - make spec
53
+ - make version-prerelease
54
+ - make image | awk '{ printf("%s/%s/%s", ENVIRON["CONTAINER_REGISTRY_URL"], ENVIRON["CONTAINER_REGISTRY_NAMESPACE"], $0)}' > image-tag.txt
55
+ rules:
56
+ # NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT merge request and NOT tag was created
57
+ - if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG != null'
58
+ when: never
59
+ # Commit message contains `run-prerelease` keyword and commit branch is not default branch (master)
60
+ - if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
61
+
62
+ run-prepare:
63
+ stage: prepare
64
+ image: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/node:10.20.0-alpine-ci-1
65
+ artifacts:
66
+ paths:
67
+ - package.json
68
+ - package-lock.json
69
+ - image-tag.txt
70
+ - postman-collection.json
71
+ script:
72
+ - make spec
73
+ - make version-patch
74
+ - make image | awk '{ printf("%s/%s/%s", ENVIRON["CONTAINER_REGISTRY_URL"], ENVIRON["CONTAINER_REGISTRY_NAMESPACE"], $0)}' > image-tag.txt
75
+ rules:
76
+ # NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT merge request and NOT tag was created
77
+ - if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG != null'
78
+ when: never
79
+ # Commit into default branch (master)
80
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
81
+
82
+ run-build-warmer:
83
+ stage: build-init
84
+ image:
85
+ name: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/kaniko-warmer:debug
86
+ entrypoint: [""]
87
+ before_script:
88
+ - echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
89
+ script:
90
+ - warmer `cat $CI_PROJECT_DIR/Dockerfile | grep FROM | awk -F" " '{ printf("--image=%s ", $2) }'`
91
+ rules:
92
+ # NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT merge request and NOT tag was created
93
+ - if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG != null'
94
+ when: never
95
+ # Commit message contains `run-prerelease` keyword and commit branch is not default branch (master)
96
+ - if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
97
+ # Commit into default branch (master)
98
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
99
+
100
+ run-build:
101
+ stage: build
102
+ image:
103
+ name: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/kaniko-executor:debug
104
+ entrypoint: [""]
105
+ artifacts:
106
+ paths:
107
+ - image-digest.txt
108
+ before_script:
109
+ - echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
110
+ script:
111
+ - echo "BUILDING... `cat $CI_PROJECT_DIR/image-tag.txt`"
112
+ - if [ -f $CI_PROJECT_DIR/dependency.txt ] && ! [ -z "`cat $CI_PROJECT_DIR/dependency.txt`" ]; then cat $CI_PROJECT_DIR/dependency.txt | awk '{$1=$1;print;exit}' > $CI_PROJECT_DIR/dep.txt; else echo > $CI_PROJECT_DIR/dep.txt; fi
113
+ - echo -n 'LABEL DEPENDENCY='; cat $CI_PROJECT_DIR/dep.txt
114
+ - 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`" --label "dependency=`cat $CI_PROJECT_DIR/dep.txt`"
115
+ - echo "PUSHED `cat $CI_PROJECT_DIR/image-tag.txt` (`cat $CI_PROJECT_DIR/image-digest.txt`)"
116
+ rules:
117
+ # NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT merge request and NOT tag was created
118
+ - if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG != null'
119
+ when: never
120
+ # Commit message contains `run-prerelease` keyword and commit branch is not default branch (master)
121
+ - if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
122
+ # Commit into default branch (master)
123
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
124
+
125
+ run-build-commit:
126
+ stage: build-commit
127
+ image: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/node:10.20.0-alpine-ci-1
128
+ before_script:
129
+ - git config --global user.name "$GITLAB_USER_NAME"
130
+ - git config --global user.email "$GITLAB_USER_EMAIL"
131
+ script:
132
+ - git add -A
133
+ - git commit -m "$(make version)" -m "== release-by-bot ($CI_COMMIT_SHA) =="
134
+ - git tag -a "$(make version)" -m "$(cat image-tag.txt) ($(cat image-digest.txt))"
135
+ - git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL#*@}" "HEAD:${CI_COMMIT_BRANCH}"
136
+ - git push "https://${GITLAB_USER_NAME}:${CI_GIT_TOKEN}@${CI_REPOSITORY_URL#*@}" --tags
137
+ rules:
138
+ # NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT merge request and NOT tag was created
139
+ - if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG != null'
140
+ when: never
141
+ # Commit message contains `run-prerelease` keyword and commit branch is not default branch (master)
142
+ - if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
143
+ # Commit into default branch (master)
144
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
145
+
146
+ run-release:
147
+ stage: release
148
+ image: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/node:10.20.0-alpine-ci-1
149
+ script:
150
+ - echo "Bumped version $(make version)"
151
+ rules:
152
+ # NOT commit message contains `run-without-release` keyword and NOT merge request
153
+ - if: '$CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event"'
154
+ when: never
155
+ # Tag was created
156
+ - if: '$CI_COMMIT_TAG != null'
157
+
158
+ run-notify:
159
+ stage: notify
160
+ image: registry-intl.cn-hongkong.aliyuncs.com/gkci/node:10.20.0-alpine-ci-1
161
+ before_script:
162
+ - apk --no-cache add curl
163
+ script:
164
+ - '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'
165
+ rules:
166
+ # NOT triggerred by bot and NOT commit message contains `run-without-release` keyword and NOT merge request and NOT tag was created
167
+ - if: '$CI_COMMIT_MESSAGE =~ /release-by-bot/ || $CI_COMMIT_MESSAGE =~ /run-without-release/ || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG != null'
168
+ when: never
169
+ - if: '$TELEGRAM_BOT_TOKEN == null || $TELEGRAM_BOT_TOKEN == "" || $TELEGRAM_CHAT_ID == null || $TELEGRAM_CHAT_ID == ""'
170
+ when: never
171
+ # Commit message contains `run-prerelease` keyword and commit branch is not default branch (master)
172
+ - if: '$CI_COMMIT_MESSAGE =~ /run-prerelease/ && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
173
+ # Commit into default branch (master)
174
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
@@ -0,0 +1 @@
1
+ v14.18.2
@@ -0,0 +1,14 @@
1
+ FROM node:14.15.5-buster as builder
2
+ WORKDIR /backend/
3
+ ADD ./package.json /backend/
4
+ ADD ./package-lock.json /backend/
5
+ ADD ./tsconfig.json /backend/
6
+ ADD ./src /backend/src
7
+ RUN npm ci --production && npm cache clean --force
8
+ RUN npm run build
9
+
10
+ FROM node:14.15.5-alpine3.13
11
+ WORKDIR /backend/
12
+ COPY --chown=node:node --from=builder /backend /backend/
13
+ USER node
14
+ CMD [ "node", "dist/server.js" ]
@@ -0,0 +1,84 @@
1
+ MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
2
+ ROOT_PATH := $(shell pwd)
3
+ SERVICE_NAME := <%= projectName %>
4
+
5
+ .PHONY: version name image
6
+
7
+ version-major: version-sync
8
+ @npm -s version major --no-git-tag-version
9
+
10
+ version-minor: version-sync
11
+ @npm -s version minor --no-git-tag-version
12
+
13
+ version-patch: version-sync
14
+ @npm -s version patch --no-git-tag-version
15
+
16
+ version-prerelease: version-sync
17
+ @npm -s version prerelease --preid=rc --no-git-tag-version
18
+
19
+ version-latest:
20
+ @(git tag --sort=-creatordate || echo) | awk 'NR==1 { \
21
+ split($$0, n, "-"); \
22
+ if (n[1] != "") { \
23
+ split(n[1], v, "."); \
24
+ if (v[1] ~ /^[0-9]+$$/ && v[2] ~ /^[0-9]+$$/ && v[3] ~ /^[0-9]+$$/) { \
25
+ print $$0; \
26
+ exit 0; \
27
+ } \
28
+ } \
29
+ print "1.0.0-rc.0"; \
30
+ } \
31
+ END { \
32
+ if (NR == 0) { \
33
+ print "1.0.0-rc.0"; \
34
+ } \
35
+ }'
36
+
37
+ version-sync:
38
+ @git checkout $(CI_COMMIT_BRANCH)
39
+ @git pull --tags 2&>/dev/null || true
40
+ @git tag --sort=-creatordate | head -10
41
+ @cat package.json | jq -r --arg PKG_VERSION `make --no-print-directory -f$(MAKEFILE) version-latest` '.version=$$PKG_VERSION' > package.json;
42
+ @echo -n "Current Git tag: "; cat package.json | jq -r '.version'
43
+
44
+ version:
45
+ @echo $(shell node -p "require('$(ROOT_PATH)/package.json').version")
46
+
47
+ name:
48
+ @echo $(SERVICE_NAME)
49
+
50
+ image:
51
+ @echo $(SERVICE_NAME):$(shell node -p "require('$(ROOT_PATH)/package.json').version")
52
+
53
+ test:
54
+ @npm i
55
+ @npm run -s test
56
+
57
+ spec:
58
+ @set -e -o pipefail; \
59
+ if [ -f "$(ROOT_PATH)/spec.yaml" ]; then \
60
+ make --no-print-directory -f$(MAKEFILE) spec-file > $(ROOT_PATH)/all-spec.yaml; \
61
+ openapi2postmanv2 -s $(ROOT_PATH)/all-spec.yaml -o postman-collection.json | \
62
+ awk ' \
63
+ BEGIN{ result = 0; error = "" } \
64
+ { \
65
+ if (0 < index($$0, "Conversion successful, collection written to file")) { \
66
+ result = 1; \
67
+ } \
68
+ error = error $$0; \
69
+ } \
70
+ END{ \
71
+ if (result != 1) { \
72
+ print error; \
73
+ exit(-1); \
74
+ } \
75
+ }'; \
76
+ rm -f $(ROOT_PATH)/all-spec.yaml; \
77
+ fi;
78
+
79
+ spec-file:
80
+ @cat $(ROOT_PATH)/spec.yaml;
81
+ @for file in `find $(ROOT_PATH)/src -iname "*-spec.yaml"`; do \
82
+ echo ""; \
83
+ cat $$file; \
84
+ done;
@@ -0,0 +1,71 @@
1
+ # <%= projectName %>
2
+
3
+ ### Getting Started
4
+
5
+ The <%= projectName %> API endpoints.
6
+
7
+ ### How to setup environment?
8
+
9
+ 1. Clone this repository.
10
+
11
+ 2. Change directory to the repository.
12
+
13
+ 3. Install package dependencies.
14
+ ```
15
+ npm install
16
+ ```
17
+ 4. Allow `direnv` to populate environment variables from the `.envrc` file. The `direnv` command is required to be installed.
18
+ ```
19
+ direnv allow .
20
+ ```
21
+
22
+ ### How to run unit-test?
23
+
24
+ 1. Write test cases in a `*.test.ts` file under the same folder with the actual module file. For example, module file `src/app-service.ts`, unit-test file `src/app-service.test.ts`.
25
+
26
+ 2. Run unit-test command.
27
+
28
+ - To run single module unit-test.
29
+
30
+ ```
31
+ npm run test-this src/app-service.test.ts
32
+ ```
33
+
34
+ - To run all unit-test.
35
+ ```
36
+ npm run test
37
+ ```
38
+
39
+ ### How to debug?
40
+
41
+ Please use unit-test method for debugging.
42
+
43
+ 1. Set breakpoint on the source code by pressing `F9` key.
44
+
45
+ 2. Run unit-test command with debugging.
46
+
47
+ ```
48
+ npm run debug-this src/app-service.test.ts
49
+ ```
50
+
51
+ 3. Start debugging by pressing `F5` key.
52
+
53
+ ### How to release version?
54
+
55
+ Git pipeline will perform unit-test, build container image and push to the container registry.
56
+
57
+ - Bump a `prerelease` version (E.g. `1.0.0-rc.0`).
58
+
59
+ - Write commit message that contain `run-prerelease` keyword to `feature` branch.
60
+
61
+ - Bump a `release` version (E.g. `1.0.0`).
62
+
63
+ - Merge into `default` branch (main/master) with any commit message.
64
+
65
+ > Note: **Code review** process should be perform before merge into `default` branch or release version.
66
+
67
+ ### Merge into default branch without trigger pipeline
68
+
69
+ If you want to merge into `default` branch without triggering the pipeline, write commit message that contain `run-without-release`.
70
+
71
+ chatbot: 0
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "<%= projectName %>",
3
+ "version": "1.0.0-rc.0",
4
+ "description": "API Description",
5
+ "repository": {},
6
+ "devDependencies": {
7
+ "@types/chai": "^4.3.0",
8
+ "@types/sinon": "^10.0.6",
9
+ "chai": "^4.3.4",
10
+ "dotenv": "^8.2.0",
11
+ "mocha": "^9.1.3",
12
+ "sinon": "^12.0.1",
13
+ "ts-node": "^10.4.0",
14
+ "tsconfig-paths": "^3.12.0"
15
+ },
16
+ "dependencies": {
17
+ "@types/body-parser": "^1.19.2",
18
+ "@types/cors": "^2.8.12",
19
+ "@types/express": "^4.17.13",
20
+ "@types/jsonwebtoken": "^9.0.0",
21
+ "@types/multer": "^1.4.7",
22
+ "@types/node": "^14.18.2",
23
+ "@types/response-time": "^2.3.5",
24
+ "body-parser": "^1.19.1",
25
+ "cors": "^2.8.5",
26
+ "express": "^4.17.2",
27
+ "form-data": "^3.0.1",
28
+ "jsonwebtoken": "^9.0.0",
29
+ "multer": "1.4.4-lts.1",
30
+ "mxw-libs-api-token": "^1.0.13",
31
+ "mxw-libs-clogger": "^1.0.0",
32
+ "mxw-libs-database": "^1.0.19",
33
+ "mxw-libs-email-notify": "^1.0.6",
34
+ "mxw-libs-errors": "^1.0.5",
35
+ "mxw-libs-push-notify": "^1.0.5",
36
+ "mxw-libs-utils": "^1.0.35",
37
+ "process": "^0.11.10",
38
+ "response-time": "^2.3.2",
39
+ "streamifier": "^0.1.1",
40
+ "typescript": "^4.5.4"
41
+ },
42
+ "scripts": {
43
+ "build": "npm run build-ts",
44
+ "build-ts": "tsc",
45
+ "dev": "npm run build && NODE_ENV=local node dist/server.js",
46
+ "start": "node dist/server.js",
47
+ "test": "mocha --recursive --timeout 30000 -r tsconfig-paths/register -r ts-node/register src/**/*.test.ts src/**/**/*.test.ts src/**/**/**/*.test.ts",
48
+ "test-this": "mocha --recursive --timeout 30000 -r tsconfig-paths/register -r ts-node/register",
49
+ "debug": "tsc && node --inspect-brk=0.0.0.0:9229 dist/server.js",
50
+ "debug-this": "npm run build && mocha --inspect-brk=0.0.0.0:9229 --timeout 3000000 -r ts-node/register"
51
+ },
52
+ "keywords": [],
53
+ "author": "",
54
+ "license": "ISC"
55
+ }