@cmflow/cli 3.4.0-alpha.1 → 3.4.0-alpha.3

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 (209) hide show
  1. package/README.md +102 -298
  2. package/dist/bin/cm.mjs +9985 -1348
  3. package/dist/bin/cmrelease.mjs +3875 -1193
  4. package/dist/{cli-truncate-CXNquMRK.mjs → cli-truncate-Bi2MjGwF.mjs} +177 -6
  5. package/dist/cli-truncate-DMcpM5Q7.mjs +2 -0
  6. package/dist/cli-truncate-DMcpM5Q7.mjs.map +1 -0
  7. package/dist/{cli-truncate-BmHD4ngn.mjs → cli-truncate-DsW0mgI_.mjs} +177 -6
  8. package/dist/{common-CwPbT3So.mjs → common-BdfXquG0.mjs} +31 -36
  9. package/dist/common-BdfXquG0.mjs.map +1 -0
  10. package/dist/compile-packages-BB08_q2B.mjs +2 -0
  11. package/dist/compile-packages-BB08_q2B.mjs.map +1 -0
  12. package/dist/docker-Cc30aRzl.mjs +34 -0
  13. package/dist/docker-Cc30aRzl.mjs.map +1 -0
  14. package/dist/docker-clean-tags-EvFdWykP.mjs +2 -0
  15. package/dist/docker-clean-tags-EvFdWykP.mjs.map +1 -0
  16. package/dist/docker-publish-CG0aN9se.mjs +2 -0
  17. package/dist/docker-publish-CG0aN9se.mjs.map +1 -0
  18. package/dist/find-packages-611B-66T.mjs +42 -0
  19. package/dist/find-packages-611B-66T.mjs.map +1 -0
  20. package/dist/get-config-8ivgd1KC.mjs +9 -0
  21. package/dist/get-config-8ivgd1KC.mjs.map +1 -0
  22. package/dist/get-east-asian-width-Tfn8qoqd.mjs.map +1 -1
  23. package/dist/{get-east-asian-width-eFfEkHwo.mjs → get-east-asian-width-wiVWCFXf.mjs} +4 -4
  24. package/dist/log-update-CLbF3iV6.mjs +6 -0
  25. package/dist/log-update-CLbF3iV6.mjs.map +1 -0
  26. package/dist/{log-update-B2GqeeDd.mjs → log-update-CTXRtajW.mjs} +185 -14
  27. package/dist/{log-update-BldA9lkm.mjs → log-update-Dy1vPMGY.mjs} +185 -14
  28. package/dist/npm-VM_GgazT.mjs +2 -0
  29. package/dist/npm-VM_GgazT.mjs.map +1 -0
  30. package/dist/{semver-D8gwMSFO.mjs → semver-DFjVbN1S.mjs} +2 -2
  31. package/dist/semver-DFjVbN1S.mjs.map +1 -0
  32. package/dist/source-CwLcYLzI.mjs +7 -0
  33. package/dist/source-CwLcYLzI.mjs.map +1 -0
  34. package/dist/{wrap-ansi-DsMb4WnZ.mjs → wrap-ansi-9ugahFCy.mjs} +2 -2
  35. package/dist/wrap-ansi-9ugahFCy.mjs.map +1 -0
  36. package/dist/{wrap-ansi-CWIezXNl.mjs → wrap-ansi-BRr0GA6g.mjs} +5 -5
  37. package/dist/{wrap-ansi-T0rz0Urp.mjs → wrap-ansi-Cupoo4Yg.mjs} +5 -5
  38. package/dist/wrap-ansi-dwgEjNWf.mjs +2 -0
  39. package/dist/write-package-cxki9d3K.mjs +8 -0
  40. package/dist/write-package-cxki9d3K.mjs.map +1 -0
  41. package/dist/write-packages-CxCAl_AG.mjs +10 -0
  42. package/dist/write-packages-CxCAl_AG.mjs.map +1 -0
  43. package/package.json +9 -41
  44. package/tsdown.config.ts +5 -14
  45. package/.oxfmtrc.json +0 -11
  46. package/.yarn/install-state.gz +0 -0
  47. package/.yarn/releases/yarn-4.18.0.cjs +0 -1000
  48. package/.yarnrc.yml +0 -10
  49. package/bin/cm-checkfeatures.ts +0 -10
  50. package/bin/cm-clean.ts +0 -10
  51. package/bin/cm-config.ts +0 -10
  52. package/bin/cm-deploy.ts +0 -10
  53. package/bin/cm-expedit.ts +0 -19
  54. package/bin/cm-fetch.ts +0 -10
  55. package/bin/cm-finish.ts +0 -10
  56. package/bin/cm-jira-releases.ts +0 -10
  57. package/bin/cm-merge.ts +0 -10
  58. package/bin/cm-publish.ts +0 -10
  59. package/bin/cm-pull.ts +0 -8
  60. package/bin/cm-push.ts +0 -10
  61. package/bin/cm-rebase.ts +0 -10
  62. package/bin/cm-release.ts +0 -5
  63. package/bin/cm-republish.ts +0 -10
  64. package/bin/cm-start.ts +0 -10
  65. package/bin/cm.ts +0 -40
  66. package/dist/cli-truncate-DbOyuy2e.mjs +0 -2
  67. package/dist/cli-truncate-DbOyuy2e.mjs.map +0 -1
  68. package/dist/common-CwPbT3So.mjs.map +0 -1
  69. package/dist/docker-clean-tags-Cd-E8IqJ.mjs +0 -2
  70. package/dist/docker-clean-tags-Cd-E8IqJ.mjs.map +0 -1
  71. package/dist/docker-publish-B0E0qYYB.mjs +0 -2
  72. package/dist/docker-publish-B0E0qYYB.mjs.map +0 -1
  73. package/dist/get-config-DoOyLztI.mjs +0 -41
  74. package/dist/get-config-DoOyLztI.mjs.map +0 -1
  75. package/dist/log-update-By8Z-mak.mjs +0 -6
  76. package/dist/log-update-By8Z-mak.mjs.map +0 -1
  77. package/dist/semver-D8gwMSFO.mjs.map +0 -1
  78. package/dist/src/index.mjs +0 -18
  79. package/dist/src/index.mjs.map +0 -1
  80. package/dist/src/semantic/core/analyze-commits.mjs +0 -2
  81. package/dist/src/semantic/core/analyze-commits.mjs.map +0 -1
  82. package/dist/src/semantic/core/conditional.mjs +0 -2
  83. package/dist/src/semantic/core/conditional.mjs.map +0 -1
  84. package/dist/src/semantic/core/exit.mjs +0 -2
  85. package/dist/src/semantic/core/exit.mjs.map +0 -1
  86. package/dist/src/semantic/core/prepare/bump-version.mjs +0 -48
  87. package/dist/src/semantic/core/prepare/bump-version.mjs.map +0 -1
  88. package/dist/src/semantic/core/prepare/commit.mjs +0 -2
  89. package/dist/src/semantic/core/prepare/commit.mjs.map +0 -1
  90. package/dist/src/semantic/core/prepare/release-info.mjs +0 -2
  91. package/dist/src/semantic/core/prepare/release-info.mjs.map +0 -1
  92. package/dist/src/semantic/core/run.mjs +0 -2
  93. package/dist/src/semantic/core/run.mjs.map +0 -1
  94. package/dist/src/semantic/core/sync-repository.mjs +0 -2
  95. package/dist/src/semantic/core/sync-repository.mjs.map +0 -1
  96. package/dist/src/semantic/core/verify-conditions.mjs +0 -2
  97. package/dist/src/semantic/core/verify-conditions.mjs.map +0 -1
  98. package/dist/src/semantic/core/verify-release.mjs +0 -2
  99. package/dist/src/semantic/core/verify-release.mjs.map +0 -1
  100. package/dist/src/semantic/docker/publish.mjs +0 -2
  101. package/dist/src/semantic/docker/publish.mjs.map +0 -1
  102. package/dist/src/semantic/docker/success.mjs +0 -2
  103. package/dist/src/semantic/docker/success.mjs.map +0 -1
  104. package/dist/strip-ansi-Aeu5cmZe.mjs +0 -174
  105. package/dist/strip-ansi-Cl0pRo-s.mjs +0 -2
  106. package/dist/strip-ansi-Cl0pRo-s.mjs.map +0 -1
  107. package/dist/wrap-ansi-BeIjar2W.mjs +0 -2
  108. package/dist/wrap-ansi-DsMb4WnZ.mjs.map +0 -1
  109. package/mise.toml +0 -2
  110. package/oxlint.json +0 -25
  111. package/release.config.mjs +0 -39
  112. package/src/commands/checkfeatures.ts +0 -39
  113. package/src/commands/clean.ts +0 -36
  114. package/src/commands/config.ts +0 -31
  115. package/src/commands/deploy.ts +0 -39
  116. package/src/commands/fetch.ts +0 -30
  117. package/src/commands/finish.ts +0 -50
  118. package/src/commands/index.ts +0 -13
  119. package/src/commands/jira-releases.ts +0 -97
  120. package/src/commands/merge.ts +0 -58
  121. package/src/commands/prompts/branches.ts +0 -46
  122. package/src/commands/pull.ts +0 -44
  123. package/src/commands/push.ts +0 -48
  124. package/src/commands/rebase.ts +0 -56
  125. package/src/commands/release.ts +0 -21
  126. package/src/commands/republish.ts +0 -34
  127. package/src/commands/start.ts +0 -123
  128. package/src/commands/tasks/merge-branch.ts +0 -80
  129. package/src/commands/tasks/push-branch.ts +0 -19
  130. package/src/commands/tasks/rebase-all-branches.ts +0 -37
  131. package/src/commands/tasks/refresh-repository.ts +0 -38
  132. package/src/commands/tasks/run-test.ts +0 -28
  133. package/src/commands/tasks/update-branch.ts +0 -49
  134. package/src/commands/tasks/update-dependencies.ts +0 -43
  135. package/src/commands/utils/check-install.ts +0 -31
  136. package/src/common/back/directus/directus-flow.test.ts +0 -63
  137. package/src/common/back/directus/directus-flow.ts +0 -48
  138. package/src/common/back/http/http-proxy.ts +0 -21
  139. package/src/common/back/http/http-request.spec.ts +0 -50
  140. package/src/common/back/http/http-request.ts +0 -74
  141. package/src/common/back/jira/get-sorted-releases.ts +0 -40
  142. package/src/common/back/jira/interfaces/JiraIIssue.d.ts +0 -100
  143. package/src/common/back/jira/jira-releases.ts +0 -47
  144. package/src/common/back/jira/jira-request.spec.ts +0 -59
  145. package/src/common/back/jira/jira-request.ts +0 -29
  146. package/src/common/back/jira/jira-search.spec.ts +0 -44
  147. package/src/common/back/jira/jira-search.ts +0 -17
  148. package/src/common/cli/bun.test.ts +0 -58
  149. package/src/common/cli/bun.ts +0 -33
  150. package/src/common/cli/cli.ts +0 -127
  151. package/src/common/cli/docker.test.ts +0 -141
  152. package/src/common/cli/docker.ts +0 -66
  153. package/src/common/cli/git.test.ts +0 -215
  154. package/src/common/cli/git.ts +0 -121
  155. package/src/common/cli/lerna.test.ts +0 -58
  156. package/src/common/cli/lerna.ts +0 -25
  157. package/src/common/cli/npm.test.ts +0 -58
  158. package/src/common/cli/npm.ts +0 -33
  159. package/src/common/cli/pnpm.test.ts +0 -58
  160. package/src/common/cli/pnpm.ts +0 -34
  161. package/src/common/cli/yarn.test.ts +0 -58
  162. package/src/common/cli/yarn.ts +0 -33
  163. package/src/common/configure-git-workspace.ts +0 -39
  164. package/src/common/get-config.ts +0 -159
  165. package/src/common/get-package-json.ts +0 -15
  166. package/src/common/get-package-manager.ts +0 -13
  167. package/src/common/get-release-config.ts +0 -9
  168. package/src/common/index.ts +0 -14
  169. package/src/common/run-command.test.ts +0 -66
  170. package/src/common/run-command.ts +0 -67
  171. package/src/common/types.ts +0 -26
  172. package/src/common/vendor.d.ts +0 -4
  173. package/src/index.ts +0 -14
  174. package/src/semantic/core/analyze-commits.ts +0 -21
  175. package/src/semantic/core/conditional.ts +0 -62
  176. package/src/semantic/core/exit.ts +0 -15
  177. package/src/semantic/core/prepare/bump-version.ts +0 -41
  178. package/src/semantic/core/prepare/commit.ts +0 -30
  179. package/src/semantic/core/prepare/release-info.ts +0 -6
  180. package/src/semantic/core/run.ts +0 -23
  181. package/src/semantic/core/sync-repository.ts +0 -55
  182. package/src/semantic/core/verify-conditions.ts +0 -41
  183. package/src/semantic/core/verify-release.ts +0 -10
  184. package/src/semantic/define-config.ts +0 -42
  185. package/src/semantic/docker/publish.ts +0 -6
  186. package/src/semantic/docker/success.ts +0 -10
  187. package/src/semantic/utils/__mock__/test1/package.json +0 -7
  188. package/src/semantic/utils/__mock__/test1/packages/a/package.json +0 -9
  189. package/src/semantic/utils/__mock__/test1/packages/b/package.json +0 -7
  190. package/src/semantic/utils/__mock__/test2/package.json +0 -4
  191. package/src/semantic/utils/__mock__/test2/packages/a/package.json +0 -7
  192. package/src/semantic/utils/__mock__/test2/packages/b/package.json +0 -5
  193. package/src/semantic/utils/bump-packages-version.test.ts +0 -76
  194. package/src/semantic/utils/bump-packages-version.ts +0 -53
  195. package/src/semantic/utils/calculate-snapshot-version.test.ts +0 -69
  196. package/src/semantic/utils/calculate-snapshot-version.ts +0 -17
  197. package/src/semantic/utils/display-package-info.ts +0 -12
  198. package/src/semantic/utils/display-release-info.ts +0 -13
  199. package/src/semantic/utils/docker-clean-tags.test.ts +0 -62
  200. package/src/semantic/utils/docker-clean-tags.ts +0 -58
  201. package/src/semantic/utils/docker-publish.test.ts +0 -45
  202. package/src/semantic/utils/docker-publish.ts +0 -24
  203. package/src/semantic/utils/log-section.ts +0 -9
  204. package/src/semantic/utils/release-rules.ts +0 -15
  205. package/src/semantic/utils/transform-writer.ts +0 -101
  206. package/src/workflow/index.ts +0 -42
  207. package/tsconfig.build.json +0 -29
  208. package/tsconfig.json +0 -30
  209. package/vitest.config.mts +0 -9
package/README.md CHANGED
@@ -1,362 +1,166 @@
1
- <h1 style="text-align: center" align="center">@clubmed/cli aka ClubMed Flow </h1>
2
-
3
1
  <div align="center">
4
-
2
+ <img src="https://ns.clubmed.com/fbs/RWD/branding2023/Logo/MicrosoftTeams-image%20(9).png" width="200" alt="Club Med" />
3
+ <h1>@cmflow/cli</h1>
5
4
  <hr />
6
5
 
7
- [![npm version](https://badge.fury.io/js/%40cmflow%cli.svg)](https://badge.fury.io/js/%40cmflow%2Fcli)
6
+ [![npm version](https://badge.fury.io/js/%40cmflow%2Fcli.svg)](https://badge.fury.io/js/%40cmflow%2Fcli)
8
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
9
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
10
-
8
+ [![code style: oxfmt](https://img.shields.io/badge/code_style-oxfmt-ef4444.svg?style=flat-square)](https://oxc.rs/docs/guide/usage/formatter)
11
9
  </div>
12
10
 
13
- <hr />
14
-
15
- ```
16
- npm i -g @cmflow/cli
17
- ```
18
-
19
- ## CmFlow release using Semantic Release
11
+ Club Med Flow command-line tooling for Git Flow, Semantic Release and publishing Yarn workspace packages.
20
12
 
21
- ### Installation
13
+ ## Installation
22
14
 
23
- CmFlow is compatible with [semantic-release](https://github.com/semantic-release/semantic-release) 📦🚀. You can use
24
- CmFlow release to deploy your projects based on CmFlow convention.
15
+ Install globally for the Git Flow commands:
25
16
 
26
- Add the cmflow to your project:
27
-
28
- ```sh
29
- npm i --save-dev @cmflow/cli
17
+ ```bash
18
+ npm install --global @cmflow/cli
19
+ cm --help
30
20
  ```
31
21
 
32
- Edit your `package.json` and add the following configuration:
22
+ Install it as a development dependency when a project uses its release plugins or package-artifact commands:
33
23
 
34
- ```json
35
- {
36
- "flow": {
37
- "branch": {
38
- "develop": "master",
39
- "production": "master"
40
- }
41
- }
42
- }
24
+ ```bash
25
+ npm install --save-dev @cmflow/cli
43
26
  ```
44
27
 
45
- Then create `release.config.js` with this configuration:
28
+ ## Git Flow commands
46
29
 
47
- ```javascript
48
- import { defineConfig } from "@cmflow/cli";
30
+ `cm` provides commands for starting, finishing, pushing, pulling, merging, rebasing and deploying branches, plus release and Jira helpers.
49
31
 
50
- export default defineConfig({
51
- verifyConditions: ["@cmflow/cli/semantic/core/verify-conditions"],
52
- analyzeCommits: ["@cmflow/cli/semantic/core/analyze-commits"],
53
- verifyRelease: ["@cmflow/cli/semantic/core/verify-release"],
54
- generateNotes: [
55
- [
56
- "@cmflow/cli/semantic/conditional", // add this task to trigger build npm task
57
- {
58
- // when: (context) => context.branch.type === "release" // default condition to run the task
59
- run: ["@semantic-release/core/release-notes-generator"]
60
- }
61
- ]
62
- ],
63
- prepare: [
64
- "@cmflow/cli/semantic/core/prepare/bump-version",
65
- [
66
- "@cmflow/cli/semantic/core/prepare/run", // add this task to trigger build npm task
67
- {
68
- command: "build"
69
- }
70
- ],
71
- [
72
- "@cmflow/cli/semantic/core/prepare/run", // add this task to trigger build npm task
73
- {
74
- command: "test_e2e"
75
- }
76
- ],
77
- [
78
- "@cmflow/cli/semantic/core/conditional", // add this task to trigger build npm task
79
- {
80
- // when: (context) => context.branch.type === "release" // default condition to run the task
81
- run: ["@cmflow/cli/semantic/core/prepare/commit"]
82
- }
83
- ]
84
- ],
85
- publish: [
86
- [
87
- "@cmflow/cli/semantic/core/conditional",
88
- {
89
- // when: (context) => context.branch.type === "release" // default condition to run the task
90
- run: ["@cmflow/cli/semantic/core/sync-repository", "@semantic-release/github"] // only run if the conditional rule is true
91
- }
92
- ],
93
- [
94
- "@cmflow/cli/semantic/core/exit", // run process.exit(0) if the branch is not a release branch - legacy: maybe not necessary now all task are conditional
95
- {
96
- when: (context) => context.nextRelease.channel === "prerelease"
97
- }
98
- ]
99
- ],
100
- success: [
101
- [
102
- "@cmflow/cli/semantic/core/conditional",
103
- {
104
- // when: (context) => context.branch.type === "release" // default condition to run the task
105
- run: "@semantic-release/github" // only run if the conditional rule is true
106
- }
107
- ]
108
- ],
109
- fail: [
110
- [
111
- "@cmflow/cli/semantic/core/conditional",
112
- {
113
- // when: (context) => context.branch.type === "release" // default condition to run the task
114
- run: "@semantic-release/github" // only run if the conditional rule is true
115
- }
116
- ]
117
- ],
118
- npmPublish: false
119
- });
32
+ ```bash
33
+ cm --help
34
+ cm start --help
35
+ cm finish --help
36
+ cm deploy --help
120
37
  ```
121
38
 
122
- Then edit your `package.json` add the following tasks on script property:
39
+ ### Jira releases
123
40
 
124
- ```json
125
- {
126
- "script": {
127
- "release": "cmrelease",
128
- "release:dry_run": "cmrelease --dry-run"
129
- }
130
- }
131
- ```
132
-
133
- Now, CmFlow and semantic release are correctly installed on your project.
134
-
135
- ### Condition step (publish, success, fail)
41
+ `jira-releases` lists release versions for a Jira project and component, generates delivery notes, and can mark versions as released.
136
42
 
137
- CMFlow provide a `@cmflow/cli/semantic/core/conditional` task to run one task or many task only if a condition is true. The condition is a
138
- function that takes the semantic context as parameter and return a boolean.
139
-
140
- You can customize the condition to run the task by adding a `when` property to the configuration object.
141
-
142
- ```javascript
143
- export default defineConfig({
144
- publish: [
145
- "@cmflow/cli/semantic/core/conditional",
146
- {
147
- when: (context) => context.branch.type === "release", // default condition to run the task
148
- run: ["@semantic-release/github", "@semantic-release/github"] // only run if the conditional rule is true
149
- }
150
- ]
151
- });
43
+ ```bash
44
+ cm jira-releases --project-id <PROJECT_KEY> --component <COMPONENT> --tag <VERSION> [--update] [--verbose]
152
45
  ```
153
46
 
154
- ### Sync repository plugin (@cmflow/cli/semantic/core/sync-repository)
47
+ It requires `JIRA_API`, `JIRA_EMAIL` and `JIRA_TOKEN`. Directus workflow support is optional and uses `DIRECTUS_URL`, `DIRECTUS_FLOW_ID` and `DIRECTUS_ACCESS_TOKEN`. Run without `--update` first to review the selected versions.
155
48
 
156
- This plugin synchronizes your remote repository after publishing:
49
+ ## Monorepo package artifacts
157
50
 
158
- - It pushes the current branch to the remote (with --set-upstream) if it is part of the candidate branches.
159
- - It then synchronizes the development branch with the production branch if they are different.
51
+ `cm packages build` creates the npm-ready artifacts of a Yarn-workspace monorepo. It performs the following steps:
160
52
 
161
- Options:
53
+ 1. Cleans the configured output directory.
54
+ 2. Runs the configured build script.
55
+ 3. Copies non-private workspace packages into `dist/<package-name>`.
56
+ 4. Writes package manifests with the release version and rewritten internal dependencies.
162
57
 
163
- - pluginOptions.branches: Allows you to explicitly define the list of branches that must be pushed to synchronize the remote. Example:
164
-
165
- ```javascript
166
- export default defineConfig({
167
- publish: [
168
- [
169
- "@cmflow/cli/semantic/core/conditional",
170
- {
171
- run: [["@cmflow/cli/semantic/core/sync-repository", { includes: ["main", "develop", "release"] }], "@semantic-release/github"]
172
- }
173
- ]
174
- ]
175
- });
58
+ ```bash
59
+ cm packages build
60
+ cm packages build --version 3.4.0-alpha.3
176
61
  ```
177
62
 
178
- Default behavior:
179
-
180
- - If pluginOptions.branches is not provided, the plugin falls back to semantic-release's branches configuration (options.branches). Values can be strings or branch objects; in the latter case, only the branch name is used.
181
-
182
- Notes:
183
-
184
- - PRODUCTION_BRANCH and DEVELOP_BRANCH are defined via the CmFlow configuration (flow.branch.production and flow.branch.develop) and are used for the synchronization between production and develop.
63
+ The default output is `dist`. Private workspaces are never included in the artifacts or published. If `--version` is omitted, the current root `package.json` version is retained.
185
64
 
186
- ### Build and E2E Test
65
+ `cm packages build` is invoked by the Semantic Release `prepare` step for the `cmflow` bump method. Do not add it to the release command: Semantic Release owns the artifact lifecycle.
187
66
 
188
- CmFlow release is able to run `build` and `test_e2e` task during the `prepare` step. It's useful when you want to
189
- deploy a docker image on docker hub with the right revision number in the `package.json`. The only requirement, is to
190
- have a `build` and `test_e2e` tasks in you npm scripts.
191
-
192
- Example:
67
+ Use a dedicated script only to verify artifact generation locally or in a pre-release CI check:
193
68
 
194
69
  ```json
195
70
  {
196
71
  "scripts": {
197
- "build": "docker-compose build",
198
- "test_e2e": "docker-compose up -d && sleep 10 && npm run test_cucumber && docker-compose stop"
72
+ "artifacts:prepare": "yarn build && cm packages build"
199
73
  }
200
74
  }
201
75
  ```
202
76
 
203
- Then:
204
-
205
- ```javascript
206
- export default defineConfig({
207
- prepare: [
208
- [
209
- "@cmflow/cli/semantic/core/run",
210
- {
211
- command: "build"
212
- }
213
- ],
214
- [
215
- "@cmflow/cli/semantic/core/run",
216
- {
217
- command: "test_e2e"
218
- }
219
- ]
220
- ]
221
- });
222
- ```
223
-
224
- ### Generate release.info file
225
-
226
- CmFlow release generate a `release.info` file in the root of your project. This file contains the branch name.
77
+ ## `flow` configuration
227
78
 
228
- ```js
229
- import { defineConfig } from "@cmflow/cli";
79
+ Configure package build and publication defaults in the root `package.json`:
230
80
 
231
- export default defineConfig({
232
- prepare: [
233
- "@cmflow/cli/semantic/prepare/bump-version",
234
- [
235
- "@cmflow/cli/semantic/prepare/release-info",
236
- {
237
- path: "./resources/release.info"
238
- }
239
- ]
240
- ]
241
- });
81
+ ```json
82
+ {
83
+ "workspaces": ["packages/*"],
84
+ "publishConfig": {
85
+ "registry": "https://registry.npmjs.org/"
86
+ },
87
+ "flow": {
88
+ "outputDir": "dist",
89
+ "buildCmd": "build",
90
+ "npmAccess": "public",
91
+ "npmDistTag": "next",
92
+ "npmFallbackDistTag": "latest",
93
+ "registries": [],
94
+ "skipNpmPublish": false,
95
+ "trustedPublishing": true
96
+ }
97
+ }
242
98
  ```
243
99
 
244
- ### Deploy on Docker Hub
100
+ | Option | Default | Purpose |
101
+ | --- | --- | --- |
102
+ | `outputDir` | `dist` | Destination directory for generated package artifacts. |
103
+ | `buildCmd` | `build` | Root package script run by `cm packages build`. |
104
+ | `npmAccess` | `public` | npm access passed to `npm publish`. |
105
+ | `npmDistTag` | `publishConfig.tag` | Dist-tag written in generated package manifests. |
106
+ | `npmFallbackDistTag` | `latest` | Tag used when npm rejects an implicit `latest` tag. |
107
+ | `registries` | `[]` | Additional registries to publish to. |
108
+ | `skipNpmPublish` | `false` | Builds release artifacts but skips npm publication. |
109
+ | `trustedPublishing` | `false` | Enables npm trusted publishing; no npmjs token is written to `.npmrc`. |
245
110
 
246
- Add the following configuration to your `release.config.js`:
111
+ A workspace package may set its own `flow.registries` array to replace the root registries for that package.
247
112
 
248
- ```js
249
- import { defineConfig } from "@cmflow/cli";
113
+ ## Semantic Release
250
114
 
251
- export default defineConfig({
252
- publish: ["@cmflow/cli/semantic/docker/publish"]
253
- });
115
+ Use `cmrelease` to run Semantic Release:
116
+
117
+ ```json
118
+ {
119
+ "scripts": {
120
+ "release": "cmrelease",
121
+ "release:dry_run": "cmrelease --dry-run"
122
+ }
123
+ }
254
124
  ```
255
125
 
256
- ### Publish & Clean docker tags
126
+ For a workspace release, the publish sequence must push the release branch and tag before npm publication:
257
127
 
258
128
  ```js
259
129
  import { defineConfig } from "@cmflow/cli";
260
130
 
261
131
  export default defineConfig({
262
- success: ["@cmflow/cli/semantic/docker/success"]
132
+ prepare: [
133
+ "@cmflow/cli/semantic/core/prepare/bump-version",
134
+ "@cmflow/cli/semantic/core/prepare/commit"
135
+ ],
136
+ publish: [
137
+ "@cmflow/cli/semantic/core/push-release",
138
+ "@cmflow/cli/semantic/core/publish-packages",
139
+ "@cmflow/cli/semantic/core/sync-repository"
140
+ ],
141
+ npmPublish: false
263
142
  });
264
143
  ```
265
144
 
266
- ### Configure CI
267
-
268
- CmFlow release can be used with Travis CI, Circle CI and GitLab. You have to create these environments variables to
269
- allow git release note deployment, commit push and docker image deployment.
270
-
271
- | Variable | Description |
272
- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
273
- | PROJECT_NAME | The project to publish artifact on docker |
274
- | SCM_TOKEN | A SCM Token (GH_TOKEN or GITLAB_TOKEN) |
275
- | GH_TOKEN (deprecated) | A GitHub token [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line). |
276
- | GIT_USER_EMAIL | User mail to sign the commit produced by CmFlow release |
277
- | GIT_USER_NAME | User name to sign the commit produced by CmFlow release |
278
- | DOCKER_HUB_ID | The docker hub id |
279
- | DOCKER_HUB_PWD | The docker password account |
280
-
281
- ## Jira Releases Command
282
-
283
- The `jira-releases` command lists and (optionally) updates Jira versions related to an application version, then generates a share-ready delivery note.
284
-
285
- ### Goal
286
-
287
- - For a given Jira project and component, retrieve all versions whose number is less than or equal to a target tag/version.
288
- - Display the issues associated with those versions and produce a delivery note.
289
- - Optionally mark the versions as "released" (with today's date) and move the corresponding issues to the "Livré en production" state.
290
- - Optionally trigger a CMS (Directus) workflow if configuration is provided.
291
-
292
- ### Prerequisites
293
-
294
- - Access to the Jira API via environment variables:
295
- - `JIRA_API` (e.g., https://your-instance.atlassian.net)
296
- - `JIRA_EMAIL`
297
- - `JIRA_TOKEN` (API token)
298
- - Optional: `HTTPS_PROXY` if you need a proxy
299
- - Optional (to trigger a Directus workflow):
300
- - `DIRECTUS_URL`
301
- - `DIRECTUS_FLOW_ID`
302
- - `DIRECTUS_ACCESS_TOKEN`
303
-
304
- If all three Directus variables are present, `CmFlow` considers `CAN_TRIGGER_WORKFLOW=true` and will attempt to run the workflow after updating releases.
305
-
306
- ### Usage
307
-
308
- ```sh
309
- cm jira-releases --project-id <PROJECT_KEY> --component <COMPONENT> --tag <VERSION> [--update] [--verbose]
310
- ```
311
-
312
- Aliases and options (from `bin/cm-jira-releases.js`):
313
-
314
- - `-c, --component <component>`: Jira component filter (e.g., `API`).
315
- - `-c, --project-id <projectId>`: Jira project key (e.g., `CMAB`).
316
- - `-t, --tag <tag>`: target version to analyze (e.g., `0.3241.3`, `v0.3241.3`, or `version-0.3241.3`). `v` and `version-` prefixes are automatically ignored.
317
- - `-u, --update`: updates Jira (marks the version(s) as released with today's date and moves the issues).
318
- - `-v, --verbose`: verbose logs.
319
-
320
- Note: Jira versions are expected to follow `<COMPONENT>-<version>` or similar. For example, if `--component API` and a Jira version is named `API-0.3241.3`, the `0.3241.3` part will be compared to `--tag` using semver.
321
-
322
- ### Detailed behavior
145
+ `push-release` pushes the branch and release tag first. `publish-packages` publishes only non-private generated artifacts. It supports npmjs, GitHub Packages and additional registries; `trustedPublishing` uses npm’s OIDC-based trusted publishing flow. During a dry run, packages are packed but never published.
323
146
 
324
- 1. Fetch all Jira versions for the project (`projectId`).
325
- 2. Keep those whose version (after stripping `component-`, `version-`, and `v` prefixes) is semver <= the provided `--tag`.
326
- 3. Print the delivery note to stdout (example below).
327
- 4. If `--update` is provided:
328
- - Mark the relevant version(s) as `released=true` with `releaseDate=YYYY-MM-DD` (today's date).
329
- 5. If the Directus config is complete, trigger the workflow by passing the list of `version` values for the processed releases.
147
+ ## Atlas
330
148
 
331
- > Important: moving issue isn't supported from the cmflow. You have to create a jira automation script to move the issue on your board.
149
+ API-to-backend catalogue tooling is published separately as [`@cmflow/atlas`](../atlas). Its project configuration is `atlas.config.ts`; it does not belong in this repository or in this CLI package.
332
150
 
333
- ### Example
151
+ ## Development
334
152
 
335
- From this repo, a sample script is provided in `package.json`:
153
+ From the monorepo root:
336
154
 
337
- ```sh
338
- yarn jira:releases
155
+ ```bash
156
+ yarn workspace @cmflow/cli build
157
+ yarn workspace @cmflow/cli test
158
+ yarn check
339
159
  ```
340
160
 
341
- which runs, with `.env` loaded:
342
-
343
- ```sh
344
- node --env-file=.env bin/cm.js jira-releases \
345
- --project-id CMAB \
346
- --component API \
347
- --tag 0.3241.3 \
348
- --verbose
349
- ```
350
-
351
- Raw CLI example:
352
-
353
- ```
354
- cm jira-releases --project-id CMAB --component API --tag v0.3241.3 --update
355
- ```
161
+ ## License
356
162
 
357
- ### Best practices
163
+ The MIT License (MIT)
164
+ Copyright (c) 2016 - Today ClubMed
358
165
 
359
- - Use a valid semver `--tag` (the `v`/`version-` prefixes are accepted).
360
- - Ensure your Jira versions follow a consistent schema that includes the component (`<COMPONENT>-<version>`) to allow matching.
361
- - First run without `--update` to preview the note and verify selected versions and issues.
362
- - Provide `HTTPS_PROXY` if your environment requires it to reach Jira/Directus.
166
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.