@common-stack/generate-plugin 5.0.5-alpha.9 → 6.0.1-alpha.0

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 (307) hide show
  1. package/CHANGELOG.md +1 -85
  2. package/generators.json +15 -0
  3. package/lib/generators/add-backend/files/__tests__/test.ts.template +3 -2
  4. package/lib/generators/add-backend/files/package.json +5 -7
  5. package/lib/generators/add-backend/generator.cjs +5 -4
  6. package/lib/generators/add-backend/generator.cjs.map +1 -1
  7. package/lib/generators/add-backend/generator.mjs +6 -5
  8. package/lib/generators/add-backend/generator.mjs.map +1 -1
  9. package/lib/generators/add-backend/schema.json +6 -4
  10. package/lib/generators/add-browser-package/files/CHANGELOG.md +3119 -0
  11. package/lib/generators/add-browser-package/files/LICENSE +674 -0
  12. package/lib/generators/add-browser-package/files/jest.config.js +8 -0
  13. package/lib/generators/add-browser-package/files/package.json +49 -0
  14. package/lib/generators/add-browser-package/files/rollup.config.mjs +29 -0
  15. package/lib/generators/add-browser-package/files/src/index.ts.template +4 -0
  16. package/lib/generators/add-browser-package/files/src/interfaces/index.ts.template +1 -0
  17. package/lib/generators/add-browser-package/files/src/interfaces/interfaces.ts.template +1 -0
  18. package/lib/generators/add-browser-package/files/src/module.tsx.template +7 -0
  19. package/lib/generators/add-browser-package/files/tsconfig.json +28 -0
  20. package/lib/generators/add-browser-package/files/webpack.config.js +71 -0
  21. package/lib/generators/add-browser-package/generator.cjs +19 -0
  22. package/lib/generators/add-browser-package/generator.cjs.map +1 -0
  23. package/lib/generators/add-browser-package/generator.d.ts +4 -0
  24. package/lib/generators/add-browser-package/generator.mjs +19 -0
  25. package/lib/generators/add-browser-package/generator.mjs.map +1 -0
  26. package/lib/generators/add-browser-package/generator.spec.d.ts +1 -0
  27. package/lib/generators/add-browser-package/schema.json +19 -0
  28. package/lib/generators/add-frontend/generator.cjs +6 -5
  29. package/lib/generators/add-frontend/generator.cjs.map +1 -1
  30. package/lib/generators/add-frontend/generator.mjs +7 -6
  31. package/lib/generators/add-frontend/generator.mjs.map +1 -1
  32. package/lib/generators/add-frontend/schema.json +8 -5
  33. package/lib/generators/add-frontend/templates/package.json +8 -8
  34. package/lib/generators/add-fullstack/files/CHANGELOG.md +20 -0
  35. package/lib/generators/add-fullstack/files/CODE_OF_CONDUCT.md +94 -0
  36. package/lib/generators/add-fullstack/files/Dockerfile +10 -0
  37. package/lib/generators/add-fullstack/files/ISSUES.md +24 -0
  38. package/lib/generators/add-fullstack/files/Jenkinsfile +672 -0
  39. package/lib/generators/add-fullstack/files/LICENSE +21 -0
  40. package/lib/generators/add-fullstack/files/README.md +50 -0
  41. package/lib/generators/add-fullstack/files/ScreenShot.png +0 -0
  42. package/lib/generators/add-fullstack/files/babel.config.js +24 -0
  43. package/lib/generators/add-fullstack/files/build.config.js +32 -0
  44. package/lib/generators/add-fullstack/files/build.config.mjs +37 -0
  45. package/lib/generators/add-fullstack/files/codegen.yml +47 -0
  46. package/lib/generators/add-fullstack/files/commitlint.config.js +6 -0
  47. package/lib/generators/add-fullstack/files/config/development/dev.env.sample +21 -0
  48. package/lib/generators/add-fullstack/files/config/development/settings.json +9 -0
  49. package/lib/generators/add-fullstack/files/config/staging/docker-staging.env.sample +26 -0
  50. package/lib/generators/add-fullstack/files/config/staging/staging.env.sample +20 -0
  51. package/lib/generators/add-fullstack/files/config/test/test.env.sample +9 -0
  52. package/lib/generators/add-fullstack/files/docs/Moleculer.md +10 -0
  53. package/lib/generators/add-fullstack/files/docs/References.md +13 -0
  54. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Adding_New_Modules.md +84 -0
  55. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Desktop_Setup.md +12 -0
  56. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/DoAndDont.md +35 -0
  57. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/GitHooks.md +3 -0
  58. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/HowToContribute.md +14 -0
  59. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/How_to_Run_Various_Options.md +95 -0
  60. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Known_Issues.md +19 -0
  61. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Lint_And_Formatter.md +9 -0
  62. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Project_Setup.md +159 -0
  63. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Dynamically_Render_Components.md +57 -0
  64. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/HOC_With_Render_Props.md +87 -0
  65. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Mongoose_Connection.md +45 -0
  66. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/React_Componet_Extensions.md +11 -0
  67. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/RxJS_notes.md +3 -0
  68. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Styles_With_Type.md +52 -0
  69. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Tutorials.md +12 -0
  70. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/faq.md +17 -0
  71. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/installation_issues.md +9 -0
  72. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/lerna-build-tools.md +504 -0
  73. package/lib/generators/add-fullstack/files/docs/development/CodeContribution/lerna-yarn-workspaces.md +82 -0
  74. package/lib/generators/add-fullstack/files/docs/development/Database/mongodb-test.md +6 -0
  75. package/lib/generators/add-fullstack/files/docs/development/Deployment/How_To_Setup_Jenkins.md +60 -0
  76. package/lib/generators/add-fullstack/files/docs/development/Deployment/JenkinsDeployment.md +16 -0
  77. package/lib/generators/add-fullstack/files/docs/development/Expo/expo-commands.md +5 -0
  78. package/lib/generators/add-fullstack/files/docs/development/Mobile/How_To_Make_Expo_Wrok_With_Monorepos.md +9 -0
  79. package/lib/generators/add-fullstack/files/docs/development/Mobile/React-Native-FAQ.md +4 -0
  80. package/lib/generators/add-fullstack/files/docs/development/Mobile/Run_mobile.md +9 -0
  81. package/lib/generators/add-fullstack/files/husky.config.js +6 -0
  82. package/lib/generators/add-fullstack/files/jenkins_variables.groovy +22 -0
  83. package/lib/generators/add-fullstack/files/jest-mongodb-config.js +12 -0
  84. package/lib/generators/add-fullstack/files/jest-transform-i18next.js +24 -0
  85. package/lib/generators/add-fullstack/files/jest.config.base.js +60 -0
  86. package/lib/generators/add-fullstack/files/jest.config.js +22 -0
  87. package/lib/generators/add-fullstack/files/jest.config.mongodb.js +3 -0
  88. package/lib/generators/add-fullstack/files/lerna.json +48 -0
  89. package/lib/generators/add-fullstack/files/lint-staged.config.js +4 -0
  90. package/lib/generators/add-fullstack/files/nx.json +20 -0
  91. package/lib/generators/add-fullstack/files/package.json +361 -0
  92. package/lib/generators/add-fullstack/files/prettier.config.js +8 -0
  93. package/lib/generators/add-fullstack/files/rollup.config.base.mjs +147 -0
  94. package/lib/generators/add-fullstack/files/tools/.eslintrc +5 -0
  95. package/lib/generators/add-fullstack/files/tools/cli/command-invoker.js +54 -0
  96. package/lib/generators/add-fullstack/files/tools/cli/commands/add-module.js +64 -0
  97. package/lib/generators/add-fullstack/files/tools/cli/commands/delete-module.js +56 -0
  98. package/lib/generators/add-fullstack/files/tools/cli/config.js +11 -0
  99. package/lib/generators/add-fullstack/files/tools/cli/helpers/util.js +76 -0
  100. package/lib/generators/add-fullstack/files/tools/cli.js +31 -0
  101. package/lib/generators/add-fullstack/files/tools/deploy-cli/runUpdateJenkinsfileVersion.js +30 -0
  102. package/lib/generators/add-fullstack/files/tools/deploy-cli/runUpdateVersionWrapper.js +32 -0
  103. package/lib/generators/add-fullstack/files/tools/deploy-cli/runUpdateYamlSettingsWrapper.js +38 -0
  104. package/lib/generators/add-fullstack/files/tools/deploy-cli/updateJenkinsfileVersion.js +62 -0
  105. package/lib/generators/add-fullstack/files/tools/deploy-cli/updateLernaVersion.js +51 -0
  106. package/lib/generators/add-fullstack/files/tools/deploy-cli/updateYamlSettings.js +53 -0
  107. package/lib/generators/add-fullstack/files/tools/deployVersionUpdate.js +39 -0
  108. package/lib/generators/add-fullstack/files/tools/esm-wrapper.js +7 -0
  109. package/lib/generators/add-fullstack/files/tools/get-symlinked-modules.js +44 -0
  110. package/lib/generators/add-fullstack/files/tools/sortPackageJson.mjs +46 -0
  111. package/lib/generators/add-fullstack/files/tools/update-dependency-link.js +107 -0
  112. package/lib/generators/add-fullstack/files/tools/update-dependency-version.js +106 -0
  113. package/lib/generators/add-fullstack/files/tools/webpack/server.config.js +165 -0
  114. package/lib/generators/add-fullstack/files/tools/webpack-util.js +14 -0
  115. package/lib/generators/add-fullstack/files/tools/webpackAppConfig.js +44 -0
  116. package/lib/generators/add-fullstack/files/transform.js +14 -0
  117. package/lib/generators/add-fullstack/files/tsconfig.json +26 -0
  118. package/lib/generators/add-fullstack/files/typings/graphql.d.ts.template +72 -0
  119. package/lib/generators/add-fullstack/files/typings/index.d.ts.template +123 -0
  120. package/lib/generators/add-fullstack/files/values-dev.yaml +74 -0
  121. package/lib/generators/add-fullstack/files/values-prod.yaml +67 -0
  122. package/lib/generators/add-fullstack/files/values-stage.yaml +70 -0
  123. package/lib/generators/add-fullstack/files/values.secret.json +11 -0
  124. package/lib/generators/add-fullstack/generator.cjs +18 -0
  125. package/lib/generators/add-fullstack/generator.cjs.map +1 -0
  126. package/lib/generators/add-fullstack/generator.d.ts +4 -0
  127. package/lib/generators/add-fullstack/generator.mjs +18 -0
  128. package/lib/generators/add-fullstack/generator.mjs.map +1 -0
  129. package/lib/generators/add-fullstack/generator.spec.d.ts +1 -0
  130. package/lib/generators/add-fullstack/schema.json +14 -0
  131. package/lib/generators/add-moleculer/files/CHANGELOG.md +2250 -0
  132. package/lib/generators/add-moleculer/files/Dockerfile +30 -0
  133. package/lib/generators/add-moleculer/files/charts/chart/.helmignore +21 -0
  134. package/lib/generators/add-moleculer/files/charts/chart/Chart.yaml +9 -0
  135. package/lib/generators/add-moleculer/files/charts/chart/values-dev.yaml +13 -0
  136. package/lib/generators/add-moleculer/files/charts/chart/values-prod.yaml +13 -0
  137. package/lib/generators/add-moleculer/files/charts/chart/values-stage.yaml +13 -0
  138. package/lib/generators/add-moleculer/files/draft.toml +61 -0
  139. package/lib/generators/add-moleculer/files/package.json +69 -0
  140. package/lib/generators/add-moleculer/files/rollup.config.mjs +36 -0
  141. package/lib/generators/add-moleculer/files/src/config/env-config.ts.template +20 -0
  142. package/lib/generators/add-moleculer/files/src/config/index.ts.template +1 -0
  143. package/lib/generators/add-moleculer/files/src/env.ts.template +5 -0
  144. package/lib/generators/add-moleculer/files/src/index.ts.template +13 -0
  145. package/lib/generators/add-moleculer/files/src/modules/index.ts.template +4 -0
  146. package/lib/generators/add-moleculer/files/src/modules/module.ts.template +31 -0
  147. package/lib/generators/add-moleculer/files/tsconfig.base.json +28 -0
  148. package/lib/generators/add-moleculer/files/tsconfig.json +16 -0
  149. package/lib/generators/add-moleculer/files/webpack.config.js +58 -0
  150. package/lib/generators/add-moleculer/generator.cjs +19 -0
  151. package/lib/generators/add-moleculer/generator.cjs.map +1 -0
  152. package/lib/generators/add-moleculer/generator.d.ts +4 -0
  153. package/lib/generators/add-moleculer/generator.mjs +19 -0
  154. package/lib/generators/add-moleculer/generator.mjs.map +1 -0
  155. package/lib/generators/add-moleculer/generator.spec.d.ts +1 -0
  156. package/lib/generators/add-moleculer/schema.json +19 -0
  157. package/lib/index.cjs +1 -1
  158. package/lib/index.d.ts +3 -0
  159. package/lib/index.mjs +1 -1
  160. package/lib/utils/index.cjs +6 -8
  161. package/lib/utils/index.cjs.map +1 -1
  162. package/lib/utils/index.d.ts +2 -0
  163. package/lib/utils/index.mjs +6 -8
  164. package/lib/utils/index.mjs.map +1 -1
  165. package/package.json +2 -2
  166. package/rollup.config.mjs +11 -5
  167. package/src/generators/add-backend/generator.spec.ts +1 -1
  168. package/src/generators/add-backend/generator.ts +6 -6
  169. package/src/generators/add-backend/schema.d.ts +1 -1
  170. package/src/generators/add-backend/schema.json +6 -4
  171. package/src/generators/add-browser-package/generator.spec.ts +20 -0
  172. package/src/generators/add-browser-package/generator.ts +23 -0
  173. package/src/generators/add-browser-package/schema.d.ts +4 -0
  174. package/src/generators/add-browser-package/schema.json +19 -0
  175. package/src/generators/add-frontend/generator.spec.ts +1 -1
  176. package/src/generators/add-frontend/generator.ts +6 -6
  177. package/src/generators/add-frontend/schema.d.ts +1 -1
  178. package/src/generators/add-frontend/schema.json +8 -5
  179. package/src/generators/add-fullstack/files/.browserslistrc +3 -0
  180. package/src/generators/add-fullstack/files/.eslintignore +3 -0
  181. package/src/generators/add-fullstack/files/.eslintrc.js +92 -0
  182. package/src/generators/add-fullstack/files/.gitattributes +5 -0
  183. package/src/generators/add-fullstack/files/.markdownlint.json +6 -0
  184. package/src/generators/add-fullstack/files/.markdownlintignore +5 -0
  185. package/src/generators/add-fullstack/files/.travis.yml +18 -0
  186. package/src/generators/add-fullstack/files/CHANGELOG.md +20 -0
  187. package/src/generators/add-fullstack/files/CODE_OF_CONDUCT.md +94 -0
  188. package/src/generators/add-fullstack/files/Dockerfile +10 -0
  189. package/src/generators/add-fullstack/files/ISSUES.md +24 -0
  190. package/src/generators/add-fullstack/files/Jenkinsfile +672 -0
  191. package/src/generators/add-fullstack/files/LICENSE +21 -0
  192. package/src/generators/add-fullstack/files/README.md +50 -0
  193. package/src/generators/add-fullstack/files/ScreenShot.png +0 -0
  194. package/src/generators/add-fullstack/files/babel.config.js +24 -0
  195. package/src/generators/add-fullstack/files/build.config.js +32 -0
  196. package/src/generators/add-fullstack/files/build.config.mjs +37 -0
  197. package/src/generators/add-fullstack/files/codegen.yml +47 -0
  198. package/src/generators/add-fullstack/files/commitlint.config.js +6 -0
  199. package/src/generators/add-fullstack/files/config/development/dev.env.sample +21 -0
  200. package/src/generators/add-fullstack/files/config/development/settings.json +9 -0
  201. package/src/generators/add-fullstack/files/config/staging/docker-staging.env.sample +26 -0
  202. package/src/generators/add-fullstack/files/config/staging/staging.env.sample +20 -0
  203. package/src/generators/add-fullstack/files/config/test/test.env.sample +9 -0
  204. package/src/generators/add-fullstack/files/docs/Moleculer.md +10 -0
  205. package/src/generators/add-fullstack/files/docs/References.md +13 -0
  206. package/src/generators/add-fullstack/files/docs/development/CodeContribution/Adding_New_Modules.md +84 -0
  207. package/src/generators/add-fullstack/files/docs/development/CodeContribution/Desktop_Setup.md +12 -0
  208. package/src/generators/add-fullstack/files/docs/development/CodeContribution/DoAndDont.md +35 -0
  209. package/src/generators/add-fullstack/files/docs/development/CodeContribution/GitHooks.md +3 -0
  210. package/src/generators/add-fullstack/files/docs/development/CodeContribution/HowToContribute.md +14 -0
  211. package/src/generators/add-fullstack/files/docs/development/CodeContribution/How_to_Run_Various_Options.md +95 -0
  212. package/src/generators/add-fullstack/files/docs/development/CodeContribution/Known_Issues.md +19 -0
  213. package/src/generators/add-fullstack/files/docs/development/CodeContribution/Lint_And_Formatter.md +9 -0
  214. package/src/generators/add-fullstack/files/docs/development/CodeContribution/Project_Setup.md +159 -0
  215. package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Dynamically_Render_Components.md +57 -0
  216. package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/HOC_With_Render_Props.md +87 -0
  217. package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Mongoose_Connection.md +45 -0
  218. package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/React_Componet_Extensions.md +11 -0
  219. package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/RxJS_notes.md +3 -0
  220. package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Styles_With_Type.md +52 -0
  221. package/src/generators/add-fullstack/files/docs/development/CodeContribution/Tutorials.md +12 -0
  222. package/src/generators/add-fullstack/files/docs/development/CodeContribution/faq.md +17 -0
  223. package/src/generators/add-fullstack/files/docs/development/CodeContribution/installation_issues.md +9 -0
  224. package/src/generators/add-fullstack/files/docs/development/CodeContribution/lerna-build-tools.md +504 -0
  225. package/src/generators/add-fullstack/files/docs/development/CodeContribution/lerna-yarn-workspaces.md +82 -0
  226. package/src/generators/add-fullstack/files/docs/development/Database/mongodb-test.md +6 -0
  227. package/src/generators/add-fullstack/files/docs/development/Deployment/How_To_Setup_Jenkins.md +60 -0
  228. package/src/generators/add-fullstack/files/docs/development/Deployment/JenkinsDeployment.md +16 -0
  229. package/src/generators/add-fullstack/files/docs/development/Expo/expo-commands.md +5 -0
  230. package/src/generators/add-fullstack/files/docs/development/Mobile/How_To_Make_Expo_Wrok_With_Monorepos.md +9 -0
  231. package/src/generators/add-fullstack/files/docs/development/Mobile/React-Native-FAQ.md +4 -0
  232. package/src/generators/add-fullstack/files/docs/development/Mobile/Run_mobile.md +9 -0
  233. package/src/generators/add-fullstack/files/husky.config.js +6 -0
  234. package/src/generators/add-fullstack/files/jenkins_variables.groovy +22 -0
  235. package/src/generators/add-fullstack/files/jest-mongodb-config.js +12 -0
  236. package/src/generators/add-fullstack/files/jest-transform-i18next.js +24 -0
  237. package/src/generators/add-fullstack/files/jest.config.base.js +60 -0
  238. package/src/generators/add-fullstack/files/jest.config.js +22 -0
  239. package/src/generators/add-fullstack/files/jest.config.mongodb.js +3 -0
  240. package/src/generators/add-fullstack/files/lerna.json +48 -0
  241. package/src/generators/add-fullstack/files/lint-staged.config.js +4 -0
  242. package/src/generators/add-fullstack/files/nx.json +20 -0
  243. package/src/generators/add-fullstack/files/package.json +361 -0
  244. package/src/generators/add-fullstack/files/prettier.config.js +8 -0
  245. package/src/generators/add-fullstack/files/rollup.config.base.mjs +147 -0
  246. package/src/generators/add-fullstack/files/tools/.eslintrc +5 -0
  247. package/src/generators/add-fullstack/files/tools/cli/command-invoker.js +54 -0
  248. package/src/generators/add-fullstack/files/tools/cli/commands/add-module.js +64 -0
  249. package/src/generators/add-fullstack/files/tools/cli/commands/delete-module.js +56 -0
  250. package/src/generators/add-fullstack/files/tools/cli/config.js +11 -0
  251. package/src/generators/add-fullstack/files/tools/cli/helpers/util.js +76 -0
  252. package/src/generators/add-fullstack/files/tools/cli.js +31 -0
  253. package/src/generators/add-fullstack/files/tools/deploy-cli/runUpdateJenkinsfileVersion.js +30 -0
  254. package/src/generators/add-fullstack/files/tools/deploy-cli/runUpdateVersionWrapper.js +32 -0
  255. package/src/generators/add-fullstack/files/tools/deploy-cli/runUpdateYamlSettingsWrapper.js +38 -0
  256. package/src/generators/add-fullstack/files/tools/deploy-cli/updateJenkinsfileVersion.js +62 -0
  257. package/src/generators/add-fullstack/files/tools/deploy-cli/updateLernaVersion.js +51 -0
  258. package/src/generators/add-fullstack/files/tools/deploy-cli/updateYamlSettings.js +53 -0
  259. package/src/generators/add-fullstack/files/tools/deployVersionUpdate.js +39 -0
  260. package/src/generators/add-fullstack/files/tools/esm-wrapper.js +7 -0
  261. package/src/generators/add-fullstack/files/tools/get-symlinked-modules.js +44 -0
  262. package/src/generators/add-fullstack/files/tools/sortPackageJson.mjs +46 -0
  263. package/src/generators/add-fullstack/files/tools/update-dependency-link.js +107 -0
  264. package/src/generators/add-fullstack/files/tools/update-dependency-version.js +106 -0
  265. package/src/generators/add-fullstack/files/tools/webpack/server.config.js +165 -0
  266. package/src/generators/add-fullstack/files/tools/webpack-util.js +14 -0
  267. package/src/generators/add-fullstack/files/tools/webpackAppConfig.js +44 -0
  268. package/src/generators/add-fullstack/files/transform.js +14 -0
  269. package/src/generators/add-fullstack/files/tsconfig.json +26 -0
  270. package/src/generators/add-fullstack/files/typings/graphql.d.ts.template +72 -0
  271. package/src/generators/add-fullstack/files/typings/index.d.ts.template +123 -0
  272. package/src/generators/add-fullstack/files/values-dev.yaml +74 -0
  273. package/src/generators/add-fullstack/files/values-prod.yaml +67 -0
  274. package/src/generators/add-fullstack/files/values-stage.yaml +70 -0
  275. package/src/generators/add-fullstack/files/values.secret.json +11 -0
  276. package/src/generators/add-fullstack/generator.spec.ts +20 -0
  277. package/src/generators/add-fullstack/generator.ts +22 -0
  278. package/src/generators/add-fullstack/schema.d.ts +3 -0
  279. package/src/generators/add-fullstack/schema.json +14 -0
  280. package/src/generators/add-moleculer/files/.dockerignore +5 -0
  281. package/src/generators/add-moleculer/files/.draft-tasks.toml +0 -0
  282. package/src/generators/add-moleculer/files/.draftignore +4 -0
  283. package/src/generators/add-moleculer/files/CHANGELOG.md +2250 -0
  284. package/src/generators/add-moleculer/files/Dockerfile +30 -0
  285. package/src/generators/add-moleculer/files/charts/chart/.helmignore +21 -0
  286. package/src/generators/add-moleculer/files/charts/chart/Chart.yaml +9 -0
  287. package/src/generators/add-moleculer/files/charts/chart/values-dev.yaml +13 -0
  288. package/src/generators/add-moleculer/files/charts/chart/values-prod.yaml +13 -0
  289. package/src/generators/add-moleculer/files/charts/chart/values-stage.yaml +13 -0
  290. package/src/generators/add-moleculer/files/draft.toml +61 -0
  291. package/src/generators/add-moleculer/files/package.json +69 -0
  292. package/src/generators/add-moleculer/files/rollup.config.mjs +36 -0
  293. package/src/generators/add-moleculer/files/src/config/env-config.ts.template +20 -0
  294. package/src/generators/add-moleculer/files/src/config/index.ts.template +1 -0
  295. package/src/generators/add-moleculer/files/src/env.ts.template +5 -0
  296. package/src/generators/add-moleculer/files/src/index.ts.template +13 -0
  297. package/src/generators/add-moleculer/files/src/modules/index.ts.template +4 -0
  298. package/src/generators/add-moleculer/files/src/modules/module.ts.template +31 -0
  299. package/src/generators/add-moleculer/files/tsconfig.base.json +28 -0
  300. package/src/generators/add-moleculer/files/tsconfig.json +16 -0
  301. package/src/generators/add-moleculer/files/webpack.config.js +58 -0
  302. package/src/generators/add-moleculer/generator.spec.ts +20 -0
  303. package/src/generators/add-moleculer/generator.ts +23 -0
  304. package/src/generators/add-moleculer/schema.d.ts +4 -0
  305. package/src/generators/add-moleculer/schema.json +19 -0
  306. package/src/index.ts +3 -0
  307. package/src/utils/index.ts +8 -0
@@ -0,0 +1,147 @@
1
+ // rollup.config.base.js
2
+ import graphql from '@rollup/plugin-graphql';
3
+ import image from '@rollup/plugin-image';
4
+ import typescript from '@rollup/plugin-typescript';
5
+ import { string } from 'rollup-plugin-string';
6
+ import { copy } from '@web/rollup-plugin-copy';
7
+ import modifyLibFilesPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginModifyLibFiles.js';
8
+ import generateJsonFromObject from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginGenerateJson.js';
9
+ import addJsExtensionToImportsPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginAddJsExtension.js';
10
+ // Define any additional plugins specific to this bundle
11
+ const additionalPlugins = [copy({ patterns: '**/cdm-locales/**/*', rootDir: './src' })];
12
+
13
+ function deepMergeConfigs(baseConfig, specificConfig) {
14
+ const mergedConfig = { ...baseConfig, ...specificConfig };
15
+
16
+ // Assuming both configs have a plugins array; adjust logic as needed
17
+ if (baseConfig.plugins && specificConfig.plugins) {
18
+ mergedConfig.plugins = [...baseConfig.plugins, ...specificConfig.plugins];
19
+ }
20
+
21
+ return mergedConfig;
22
+ }
23
+
24
+ // Base configuration
25
+ const baseConfig = {
26
+ plugins: [
27
+ image(),
28
+ graphql({ include: '**/*.gql' }),
29
+ string({
30
+ include: ['**/*.ejs', '**/*.graphql'],
31
+ }),
32
+ addJsExtensionToImportsPlugin({
33
+ packages: '*',
34
+ needToAddIndexJs: [],
35
+ excludeImports: ['@emotion/react/jsx-runtime'],
36
+ }),
37
+ typescript(), // TypeScript at the top as per best practices
38
+ modifyLibFilesPlugin({
39
+ include: ['**/**/compute.js'], // Adjust to target specific files or patterns
40
+ outputDir: 'lib', // Ensure this matches your actual output directory
41
+ }),
42
+ generateJsonFromObject({}),
43
+ ...additionalPlugins,
44
+ ],
45
+ external: (id) => !/^[./]/.test(id),
46
+ globals: { react: 'React' },
47
+ };
48
+
49
+ // Function to create a configuration by extending the base
50
+ function createRollupConfig(overrides) {
51
+ return deepMergeConfigs(baseConfig, overrides);
52
+ }
53
+ function watch(watchOptions, buildMode = '') {
54
+ const filename = path.basename(watchOptions.input);
55
+ message(
56
+ 'note',
57
+ `${dt()} Rollup: Watcher Starting - watching for changes starting with: "${filename}" buildMode="${buildMode}"...`,
58
+ 'WATCH ',
59
+ true,
60
+ );
61
+ const watcher = rollup.watch(watchOptions);
62
+
63
+ watcher.on('event', (event) => {
64
+ // event.code can be one of:
65
+ // START — the watcher is (re)starting
66
+ // BUNDLE_START — building an individual bundle
67
+ // * event.input will be the input options object if present
68
+ // * event.output contains an array of the "file" or
69
+ // "dir" option values of the generated outputs
70
+ // BUNDLE_END — finished building a bundle
71
+ // * event.input will be the input options object if present
72
+ // * event.output contains an array of the "file" or
73
+ // "dir" option values of the generated outputs
74
+ // * event.duration is the build duration in milliseconds
75
+ // * event.result contains the bundle object that can be
76
+ // used to generate additional outputs by calling
77
+ // bundle.generate or bundle.write. This is especially
78
+ // important when the watch.skipWrite option is used.
79
+ // You should call "event.result.close()" once you are done
80
+ // generating outputs, or if you do not generate outputs.
81
+ // This will allow plugins to clean up resources via the
82
+ // "closeBundle" hook.
83
+ // END — finished building all bundles
84
+ // ERROR — encountered an error while bundling
85
+ // * event.error contains the error that was thrown
86
+ // * event.result is null for build errors and contains the
87
+ // bundle object for output generation errors. As with
88
+ // "BUNDLE_END", you should call "event.result.close()" if
89
+ // present once you are done.
90
+ // If you return a Promise from your event handler, Rollup will wait until the
91
+ // Promise is resolved before continuing.
92
+ // console.log(`rollup: ${event.code}`)
93
+ if (event.code === 'BUNDLE_END') {
94
+ const outputFiles = event.output.map((o) => path.basename(o)).join(', .../');
95
+ const msg = `${dt()} Rollup: wrote bundle${event.output.length > 1 ? 's' : ''}: ".../${outputFiles}"`;
96
+ if (NOTIFY) {
97
+ notifier.notify({
98
+ title: 'React Component Build',
99
+ message: msg,
100
+ });
101
+ }
102
+ // messenger: success, warn, critical, note, log
103
+ message('success', msg, 'SUCCESS', true);
104
+ } else if (event.code === 'ERROR') {
105
+ message('critical', `!!!!!!!!!!!!!!!\nRollup ${event.error}\n!!!!!!!!!!!!!!!\n`, 'ERROR', true);
106
+ if (NOTIFY) {
107
+ notifier.notify({
108
+ title: 'NotePlan Plugins Build',
109
+ message: `An error occurred during build process.\nSee console for more information`,
110
+ });
111
+ }
112
+ }
113
+ });
114
+
115
+ // This will make sure that bundles are properly closed after each run
116
+ watcher.on('event', ({ result }) => {
117
+ if (result) {
118
+ result.close();
119
+ }
120
+ });
121
+
122
+ // Additionally, you can hook into the following. Again, return a Promise to
123
+ // make Rollup wait at that stage:
124
+ watcher.on('change', (id /* , { event } */) => {
125
+ const filename = path.basename(id);
126
+ message('info', `${dt()} Rollup: file: "${filename}" changed`, 'CHANGE', true);
127
+ /* a file was modified */
128
+ });
129
+ watcher.on('restart', () => {
130
+ // console.log(`rollup: restarting`)
131
+ /* a new run was triggered (usually a watched file change) */
132
+ });
133
+ watcher.on('close', () => {
134
+ console.log(`rollup: closing`);
135
+ /* the watcher was closed, see below */
136
+ });
137
+ process.on('SIGINT', async function () {
138
+ console.log('\n\n');
139
+ console.log(colors.yellow('Quitting...\n'));
140
+ if (watcher) {
141
+ await watcher.close();
142
+ }
143
+ process.exit();
144
+ });
145
+ }
146
+
147
+ export { createRollupConfig, baseConfig };
@@ -0,0 +1,5 @@
1
+ {
2
+ "rules": {
3
+ "import/no-extraneous-dependencies": 0
4
+ }
5
+ }
@@ -0,0 +1,54 @@
1
+ const { MODULE_TEMPLATES } = require('./config');
2
+
3
+ /**
4
+ * Class CommandInvoker. Takes all CLI operations and calls certain CLI operation depends of variables.
5
+ */
6
+ class CommandInvoker {
7
+ /**
8
+ * Sets CLI operations (functions).
9
+ * @constructor
10
+ *
11
+ * @param addModule - The function for creating a new module.
12
+ * @param deleteModule - The function for deleting existing module.
13
+ */
14
+ constructor(addModule, deleteModule) {
15
+ this.addModule = addModule;
16
+ this.deleteModule = deleteModule;
17
+ }
18
+
19
+ /**
20
+ * Calls CLI operation with correct location.
21
+ *
22
+ * @param func - The func to call.
23
+ * @param location - The location for a new module [browser|server|both].
24
+ * @param args - The function for deleting existing module.
25
+ */
26
+ static runCommand(func, location, ...args) {
27
+ // browser
28
+ if (location === 'browser' || location === 'both') {
29
+ func(...args, 'browser');
30
+ }
31
+ // server
32
+ if (location === 'server' || location === 'both') {
33
+ func(...args, 'server');
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Runs operation (function) for creating a new module.
39
+ */
40
+ runAddModule(args, options, logger) {
41
+ const { moduleName, location = 'both' } = args;
42
+ CommandInvoker.runCommand(this.addModule, location, logger, MODULE_TEMPLATES, moduleName);
43
+ }
44
+
45
+ /**
46
+ * Runs operation (function) for deleting existing module.
47
+ */
48
+ runDeleteModule(args, options, logger) {
49
+ const { moduleName, location = 'both' } = args;
50
+ CommandInvoker.runCommand(this.deleteModule, location, logger, moduleName);
51
+ }
52
+ }
53
+
54
+ module.exports = CommandInvoker;
@@ -0,0 +1,64 @@
1
+ const shell = require('shelljs');
2
+ const fs = require('fs');
3
+ const chalk = require('chalk');
4
+ const { copyFiles, renameFiles, computeModulesPath, runPrettier } = require('../helpers/util');
5
+
6
+ /**
7
+ * Adds application module to browser or server code and adds it to the module list.
8
+ *
9
+ * @param logger - The Logger.
10
+ * @param templatesPath - The path to the templates for a new module.
11
+ * @param moduleName - The name of a new module.
12
+ * @param location - The location for a new module [browser|server|both].
13
+ * @param finished - The flag about the end of the generating process.
14
+ */
15
+ function addModule(logger, templatesPath, moduleName, location, finished = true) {
16
+ logger.info(`Copying ${location} files…`);
17
+
18
+ // create new module directory
19
+ const destinationPath = computeModulesPath(location, moduleName);
20
+ const newModule = shell.mkdir(destinationPath);
21
+
22
+ // continue only if directory does not jet exist
23
+ if (newModule.code !== 0) {
24
+ console.log(newModule)
25
+ logger.error(`creating destination '${destinationPath} failed.`)
26
+ logger.error(chalk.red(`The ${moduleName} directory is already exists.`));
27
+ process.exit();
28
+ }
29
+ //copy and rename templates in destination directory
30
+ copyFiles(destinationPath, templatesPath, location);
31
+ renameFiles(destinationPath, moduleName);
32
+
33
+ logger.info(chalk.green(`✔ The ${location} files have been copied!`));
34
+
35
+ // get index file path
36
+ const modulesPath = computeModulesPath(location);
37
+ const indexFullFileName = fs.readdirSync(modulesPath).find(name => name.search(/index/) >= 0);
38
+ const indexPath = modulesPath + indexFullFileName;
39
+ let indexContent;
40
+
41
+ try {
42
+ // prepend import module
43
+ indexContent = `import ${moduleName} from './${moduleName}';\n` + fs.readFileSync(indexPath);
44
+ } catch (e) {
45
+ logger.error(chalk.red(`Failed to read ${indexPath} file`));
46
+ process.exit();
47
+ }
48
+
49
+ // extract application modules
50
+ const appModuleRegExp = /Module\(([^()]+)\)/g;
51
+ const [, appModules] = appModuleRegExp.exec(indexContent) || ['', ''];
52
+
53
+ // add module to app module list
54
+ shell
55
+ .ShellString(indexContent.replace(RegExp(appModuleRegExp, 'g'), `Module(${moduleName}, ${appModules})`))
56
+ .to(indexPath);
57
+ runPrettier(indexPath);
58
+
59
+ if (finished) {
60
+ logger.info(chalk.green(`✔ Module for ${location} successfully created!`));
61
+ }
62
+ }
63
+
64
+ module.exports = addModule;
@@ -0,0 +1,56 @@
1
+ const shell = require('shelljs');
2
+ const fs = require('fs');
3
+ const chalk = require('chalk');
4
+ const { computeModulesPath, runPrettier } = require('../helpers/util');
5
+
6
+ /**
7
+ * Removes the module from browser, server or both locations and removes the module from the module list.
8
+ *
9
+ * @param logger - The Logger.
10
+ * @param moduleName - The name of a new module.
11
+ * @param location - The location for a new module [browser|server|both].
12
+ */
13
+ function deleteModule(logger, moduleName, location) {
14
+ logger.info(`Deleting ${location} files…`);
15
+ const modulePath = computeModulesPath(location, moduleName);
16
+
17
+ if (fs.existsSync(modulePath)) {
18
+ // remove module directory
19
+ shell.rm('-rf', modulePath);
20
+
21
+ const modulesPath = computeModulesPath(location);
22
+
23
+ // get index file path
24
+ const indexFullFileName = fs.readdirSync(modulesPath).find(name => name.search(/index/) >= 0);
25
+ const indexPath = modulesPath + indexFullFileName;
26
+ let indexContent;
27
+
28
+ try {
29
+ indexContent = fs.readFileSync(indexPath);
30
+ } catch (e) {
31
+ logger.error(chalk.red(`Failed to read ${indexPath} file`));
32
+ process.exit();
33
+ }
34
+
35
+ // extract application modules
36
+ const appModuleRegExp = /Module\(([^()]+)\)/g;
37
+ const [, appModules] = appModuleRegExp.exec(indexContent) || ['', ''];
38
+ const appModulesWithoutDeleted = appModules.split(',').filter(appModule => appModule.trim() !== moduleName);
39
+
40
+ const contentWithoutDeletedModule = indexContent
41
+ .toString()
42
+ // remove module from modules list
43
+ .replace(appModuleRegExp, `Module(${appModulesWithoutDeleted.toString().trim()})`)
44
+ // remove module import
45
+ .replace(RegExp(`import ${moduleName} from './${moduleName}';\n`, 'g'), '');
46
+
47
+ fs.writeFileSync(indexPath, contentWithoutDeletedModule);
48
+ runPrettier(indexPath);
49
+
50
+ logger.info(chalk.green(`✔ Module for ${location} successfully deleted!`));
51
+ } else {
52
+ logger.info(chalk.red(`✘ Module ${location} location for ${modulePath} not found!`));
53
+ }
54
+ }
55
+
56
+ module.exports = deleteModule;
@@ -0,0 +1,11 @@
1
+ const path = require('path');
2
+
3
+ const BASE_PATH = path.resolve(`${__dirname}/../..`);
4
+ const TEMPLATES_DIR = `${BASE_PATH}/tools/templates`;
5
+ const MODULE_TEMPLATES = `${TEMPLATES_DIR}/module`;
6
+
7
+ module.exports = {
8
+ BASE_PATH,
9
+ TEMPLATES_DIR,
10
+ MODULE_TEMPLATES
11
+ };
@@ -0,0 +1,76 @@
1
+ const shell = require('shelljs');
2
+ const fs = require('fs');
3
+ const { pascalize, decamelize } = require('humps');
4
+ const { startCase } = require('lodash');
5
+ const { BASE_PATH } = require('../config');
6
+
7
+ /**
8
+ * Copies the templates to the destination directory.
9
+ *
10
+ * @param destinationPath - The destination path for a new module.
11
+ * @param templatesPath - The path to the templates for a new module.
12
+ * @param location - The location for a new module [client|server|both].
13
+ */
14
+ function copyFiles(destinationPath, templatesPath, location) {
15
+ shell.cp('-R', `${templatesPath}/${location}/*`, destinationPath);
16
+ }
17
+
18
+ /**
19
+ * Renames the templates in the destination directory.
20
+ *
21
+ * @param destinationPath - The destination path of a new module.
22
+ * @param moduleName - The name of a new module.
23
+ */
24
+ function renameFiles(destinationPath, moduleName) {
25
+ const Module = pascalize(moduleName);
26
+
27
+ // change to destination directory
28
+ shell.cd(destinationPath);
29
+
30
+ // rename files
31
+ shell.ls('-Rl', '.').forEach(entry => {
32
+ if (entry.isFile()) {
33
+ shell.mv(entry.name, entry.name.replace('Module', Module));
34
+ }
35
+ });
36
+
37
+ // replace module names
38
+ shell.ls('-Rl', '.').forEach(entry => {
39
+ if (entry.isFile()) {
40
+ shell.sed('-i', /\$module\$/g, moduleName, entry.name);
41
+ shell.sed('-i', /\$_module\$/g, decamelize(moduleName), entry.name);
42
+ shell.sed('-i', /\$Module\$/g, Module, entry.name);
43
+ shell.sed('-i', /\$MoDuLe\$/g, startCase(moduleName), entry.name);
44
+ shell.sed('-i', /\$MODULE\$/g, moduleName.toUpperCase(), entry.name);
45
+ }
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Gets the computed path of the module or modules dir path.
51
+ *
52
+ * @param location - The location for a new module [client|server|both].
53
+ * @param moduleName - The name of a new module.
54
+ * @returns {string} - Return the computed path
55
+ */
56
+ function computeModulesPath(location, moduleName = '') {
57
+ return `${BASE_PATH}/packages-modules/${moduleName}/${location}`;
58
+ }
59
+
60
+ /**
61
+ * Run prettier on file that was changed.
62
+ *
63
+ * @param pathToFile
64
+ */
65
+ function runPrettier(pathToFile) {
66
+ if (fs.existsSync(pathToFile)) {
67
+ shell.exec(`prettier --print-width 120 --single-quote --loglevel error --write ${pathToFile}`);
68
+ }
69
+ }
70
+
71
+ module.exports = {
72
+ renameFiles,
73
+ copyFiles,
74
+ computeModulesPath,
75
+ runPrettier
76
+ };
@@ -0,0 +1,31 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ // require('babel-register')({ presets: ['env'], plugins: ['transform-class-properties'] });
3
+ // require('babel-polyfill');
4
+ const prog = require('caporal');
5
+
6
+ const addModuleCommand = require('./cli/commands/add-module');
7
+ const deleteModuleCommand = require('./cli/commands/delete-module');
8
+ const CommandInvoker = require('./cli/command-invoker');
9
+
10
+ const commandInvoker = new CommandInvoker(addModuleCommand, deleteModuleCommand);
11
+
12
+ prog
13
+ .version('1.0.0')
14
+ .description('Full info: https://github.com/sysgears/apollo-universal-starter-kit/wiki/Apollo-Starter-Kit-CLI')
15
+ // Add module
16
+ .command('addmodule', 'Create a new Module.')
17
+ .argument('<moduleName>', 'Module name')
18
+ .argument(
19
+ '[location]',
20
+ 'Where should new module be created. [both, server, browser]',
21
+ ['both', 'server', 'browser'],
22
+ 'both',
23
+ )
24
+ .action((args, options, logger) => commandInvoker.runAddModule(args, options, logger))
25
+ // Delete module
26
+ .command('deletemodule', 'Delete a Module')
27
+ .argument('<moduleName>', 'Module name')
28
+ .argument('[location]', 'Where should we delete module. [both, server, browser]', ['both', 'server', 'browser'], 'both')
29
+ .action((args, options, logger) => commandInvoker.runDeleteModule(args, options, logger));
30
+
31
+ prog.parse(process.argv);
@@ -0,0 +1,30 @@
1
+ const { exec } = require('child_process');
2
+ const path = require('path');
3
+
4
+ // Use __dirname to get the directory of the current script and specify the relative path to the Jenkinsfile
5
+ const jenkinsfilePath = path.join(__dirname, '../../Jenkinsfile'); // Replace with your actual Jenkinsfile relative path
6
+
7
+ // Function to run the update script
8
+ function runUpdateScript(versionArg) {
9
+ exec(`node ${path.join(__dirname, 'updateJenkinsfileVersion.js')} ${jenkinsfilePath} ${versionArg}`, (error, stdout, stderr) => {
10
+ if (error) {
11
+ console.error(`Error: ${error.message}`);
12
+ return;
13
+ }
14
+ if (stderr) {
15
+ console.error(`Stderr: ${stderr}`);
16
+ return;
17
+ }
18
+ console.log(`Stdout: ${stdout}`);
19
+ });
20
+ }
21
+
22
+ // Process command line arguments
23
+ const versionArg = process.argv[2];
24
+
25
+ if (!versionArg || !versionArg.match(/^v\d+(\.\d+)?$/)) {
26
+ console.error('Usage: node runUpdateJenkinsfileVersion.js v[Major].[Minor]');
27
+ process.exit(1);
28
+ }
29
+
30
+ runUpdateScript(versionArg);
@@ -0,0 +1,32 @@
1
+ const { exec } = require('child_process');
2
+ const path = require('path');
3
+
4
+ // Define the path to lerna.json relative to the tools directory
5
+ const LERNA_JSON_PATH = path.join(__dirname, '../../lerna.json'); // Update this to the actual relative path of your lerna.json file
6
+
7
+ function runUpdateVersion(versionArg) {
8
+ const scriptPath = path.join(__dirname, 'updateLernaVersion.js');
9
+
10
+ exec(`node ${scriptPath} ${LERNA_JSON_PATH} ${versionArg}`, (err, stdout, stderr) => {
11
+ if (err) {
12
+ console.error(`Execution error: ${err}`);
13
+ return;
14
+ }
15
+
16
+ if (stderr) {
17
+ console.error(`Error: ${stderr}`);
18
+ return;
19
+ }
20
+
21
+ console.log(stdout);
22
+ });
23
+ }
24
+
25
+ const versionArg = process.argv[2];
26
+
27
+ if (!versionArg || !versionArg.match(/^v\d+(\.\d+)?$/)) {
28
+ console.error('Usage: node runUpdateVersionWrapper.js v[Major].[Minor]');
29
+ process.exit(1);
30
+ }
31
+
32
+ runUpdateVersion(versionArg);
@@ -0,0 +1,38 @@
1
+ const path = require('path');
2
+ const { exec } = require('child_process');
3
+
4
+ // Define the path to lerna.json relative to the tools directory
5
+ const DEV_YAML_SETTIGNS = path.join(__dirname, '../../values-dev.yaml');
6
+
7
+ // Function to call the updateConfiguration script
8
+ function runUpdateYamlSettings(version) {
9
+ // Construct the path to the updateConfiguration script
10
+ const updateScriptPath = path.join(__dirname, 'updateYamlSettings.js');
11
+
12
+ // Construct the command to execute
13
+ const command = `node ${updateScriptPath} ${DEV_YAML_SETTIGNS} ${version}`;
14
+
15
+ // Execute the command
16
+ exec(command, (error, stdout, stderr) => {
17
+ if (error) {
18
+ console.error(`Error: ${error.message}`);
19
+ return;
20
+ }
21
+ if (stderr) {
22
+ console.error(`Error: ${stderr}`);
23
+ return;
24
+ }
25
+ console.log(stdout);
26
+ });
27
+ }
28
+
29
+ // Process command line arguments
30
+ const versionArg = process.argv[2];
31
+
32
+ if (!versionArg || !versionArg.match(/^v\d+(\.\d+)?$/)) {
33
+ console.error('Usage: node runUpdateVersionWrapper.js v[Major].[Minor]');
34
+ process.exit(1);
35
+ }
36
+
37
+ // Call the function with the provided arguments
38
+ runUpdateYamlSettings(versionArg);
@@ -0,0 +1,62 @@
1
+ const fs = require('fs');
2
+
3
+ // Function to update the Jenkinsfile
4
+ function updateJenkinsfile(filePath, versionArg) {
5
+ fs.readFile(filePath, 'utf8', (err, data) => {
6
+ if (err) {
7
+ console.error(`Error reading the Jenkinsfile: ${err}`);
8
+ return;
9
+ }
10
+
11
+ // Extract the major and minor version (if present)
12
+ const versionParts = versionArg.match(/^v(\d+)(\.(\d+))?$/);
13
+ if (!versionParts) {
14
+ console.error('Invalid version format. Please use the format v[Major].[Minor]');
15
+ return;
16
+ }
17
+ const majorVersion = versionParts[1];
18
+ const minorVersion = versionParts[3];
19
+ const versionSuffix = minorVersion ? `${majorVersion}-${minorVersion}` : majorVersion;
20
+ // Update the branch names using correct regular expressions
21
+ const updatedData = data
22
+ .replace(
23
+ /string\(name: 'VERSION', defaultValue: '.*?', description: 'version of the deployment', trim: true\)/,
24
+ `string(name: 'VERSION', defaultValue: 'v${versionSuffix}', description: 'version of the deployment', trim: true)`
25
+ )
26
+ .replace(
27
+ /string\(name: 'REPOSITORY_BRANCH', defaultValue: 'develop', description: 'the branch with changes'\)/,
28
+ `string(name: 'REPOSITORY_BRANCH', defaultValue: 'develop${versionSuffix}', description: 'the branch with changes')`,
29
+ )
30
+ .replace(
31
+ /string\(name: 'DEVELOP_BRANCH', defaultValue: 'develop', description: 'the branch for the development'\)/,
32
+ `string(name: 'DEVELOP_BRANCH', defaultValue: 'develop${versionSuffix}', description: 'the branch for the development')`,
33
+ )
34
+ .replace(
35
+ /string\(name: 'PUBLISH_BRANCH', defaultValue: 'devpublish', description: 'the publish branch for packages release'\)/,
36
+ `string(name: 'PUBLISH_BRANCH', defaultValue: 'devpublish${versionSuffix}', description: 'the publish branch for packages release')`,
37
+ );
38
+
39
+ // Debugging - Log the updated lines for verification
40
+ console.log(updatedData.match(/(REPOSITORY_BRANCH|DEVELOP_BRANCH|PUBLISH_BRANCH).*?;/g));
41
+
42
+ // Write the updated Jenkinsfile back
43
+ fs.writeFile(filePath, updatedData, 'utf8', (writeErr) => {
44
+ if (writeErr) {
45
+ console.error(`Error writing the Jenkinsfile: ${writeErr}`);
46
+ return;
47
+ }
48
+ console.log(`Jenkinsfile updated successfully for version ${versionArg}.`);
49
+ });
50
+ });
51
+ }
52
+
53
+ // Process command line arguments
54
+ const filePath = process.argv[2];
55
+ const versionArg = process.argv[3];
56
+
57
+ if (!filePath || !versionArg || !versionArg.match(/^v\d+(\.\d+)?$/)) {
58
+ console.error('Usage: node updateJenkinsfileVersion.js <path-to-Jenkinsfile> v[Major].[Minor]');
59
+ process.exit(1);
60
+ }
61
+
62
+ updateJenkinsfile(filePath, versionArg);
@@ -0,0 +1,51 @@
1
+ const fs = require('fs');
2
+
3
+ function updateLernaJson(filePath, versionArg) {
4
+ // Read the existing lerna.json file
5
+ fs.readFile(filePath, { encoding: 'utf8' }, (err, data) => {
6
+ if (err) {
7
+ console.error(`Error reading file: ${err}`);
8
+ return;
9
+ }
10
+
11
+ let lernaConfig;
12
+ try {
13
+ lernaConfig = JSON.parse(data);
14
+ } catch (parseErr) {
15
+ console.error(`Error parsing JSON: ${parseErr}`);
16
+ return;
17
+ }
18
+
19
+ // Update the version field
20
+ // Extract major and minor version, assuming format vMajor.Minor (e.g., v2.1)
21
+ const versionComponents = versionArg.substring(1).split('.');
22
+ const majorVersion = versionComponents[0];
23
+ const minorVersion = versionComponents.length > 1 ? versionComponents[1] : '0';
24
+ lernaConfig.version = `${majorVersion}.${minorVersion}.0`;
25
+
26
+ // Update the allowBranch fields
27
+ const branchName = `devpublish${majorVersion}${minorVersion !== '0' ? '.' + minorVersion : ''}`;
28
+ lernaConfig.command.publish.allowBranch.push(branchName);
29
+ lernaConfig.command.version.allowBranch.push(branchName);
30
+
31
+ // Write the updated lerna.json file
32
+ fs.writeFile(filePath, JSON.stringify(lernaConfig, null, 2), 'utf8', writeErr => {
33
+ if (writeErr) {
34
+ console.error(`Error writing file: ${writeErr}`);
35
+ return;
36
+ }
37
+ console.log(`lerna.json updated successfully to version ${lernaConfig.version} with branch ${branchName}`);
38
+ });
39
+ });
40
+ }
41
+
42
+ // Process command line arguments
43
+ const filePath = process.argv[2];
44
+ const versionArg = process.argv[3];
45
+
46
+ if (!filePath || !versionArg || !versionArg.match(/^v\d+(\.\d+)?$/)) {
47
+ console.error('Usage: node updateLernaVersion.js <path-to-lerna.json> v[Major].[Minor]');
48
+ process.exit(1);
49
+ }
50
+
51
+ updateLernaJson(filePath, versionArg);