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

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 +110 -294
  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/.oxfmtrc.json +0 -11
  45. package/.yarn/install-state.gz +0 -0
  46. package/.yarn/releases/yarn-4.18.0.cjs +0 -1000
  47. package/.yarnrc.yml +0 -10
  48. package/bin/cm-checkfeatures.ts +0 -10
  49. package/bin/cm-clean.ts +0 -10
  50. package/bin/cm-config.ts +0 -10
  51. package/bin/cm-deploy.ts +0 -10
  52. package/bin/cm-expedit.ts +0 -19
  53. package/bin/cm-fetch.ts +0 -10
  54. package/bin/cm-finish.ts +0 -10
  55. package/bin/cm-jira-releases.ts +0 -10
  56. package/bin/cm-merge.ts +0 -10
  57. package/bin/cm-publish.ts +0 -10
  58. package/bin/cm-pull.ts +0 -8
  59. package/bin/cm-push.ts +0 -10
  60. package/bin/cm-rebase.ts +0 -10
  61. package/bin/cm-release.ts +0 -5
  62. package/bin/cm-republish.ts +0 -10
  63. package/bin/cm-start.ts +0 -10
  64. package/bin/cm.ts +0 -40
  65. package/dist/cli-truncate-DbOyuy2e.mjs +0 -2
  66. package/dist/cli-truncate-DbOyuy2e.mjs.map +0 -1
  67. package/dist/common-CwPbT3So.mjs.map +0 -1
  68. package/dist/docker-clean-tags-Cd-E8IqJ.mjs +0 -2
  69. package/dist/docker-clean-tags-Cd-E8IqJ.mjs.map +0 -1
  70. package/dist/docker-publish-B0E0qYYB.mjs +0 -2
  71. package/dist/docker-publish-B0E0qYYB.mjs.map +0 -1
  72. package/dist/get-config-DoOyLztI.mjs +0 -41
  73. package/dist/get-config-DoOyLztI.mjs.map +0 -1
  74. package/dist/log-update-By8Z-mak.mjs +0 -6
  75. package/dist/log-update-By8Z-mak.mjs.map +0 -1
  76. package/dist/semver-D8gwMSFO.mjs.map +0 -1
  77. package/dist/src/index.mjs +0 -18
  78. package/dist/src/index.mjs.map +0 -1
  79. package/dist/src/semantic/core/analyze-commits.mjs +0 -2
  80. package/dist/src/semantic/core/analyze-commits.mjs.map +0 -1
  81. package/dist/src/semantic/core/conditional.mjs +0 -2
  82. package/dist/src/semantic/core/conditional.mjs.map +0 -1
  83. package/dist/src/semantic/core/exit.mjs +0 -2
  84. package/dist/src/semantic/core/exit.mjs.map +0 -1
  85. package/dist/src/semantic/core/prepare/bump-version.mjs +0 -48
  86. package/dist/src/semantic/core/prepare/bump-version.mjs.map +0 -1
  87. package/dist/src/semantic/core/prepare/commit.mjs +0 -2
  88. package/dist/src/semantic/core/prepare/commit.mjs.map +0 -1
  89. package/dist/src/semantic/core/prepare/release-info.mjs +0 -2
  90. package/dist/src/semantic/core/prepare/release-info.mjs.map +0 -1
  91. package/dist/src/semantic/core/run.mjs +0 -2
  92. package/dist/src/semantic/core/run.mjs.map +0 -1
  93. package/dist/src/semantic/core/sync-repository.mjs +0 -2
  94. package/dist/src/semantic/core/sync-repository.mjs.map +0 -1
  95. package/dist/src/semantic/core/verify-conditions.mjs +0 -2
  96. package/dist/src/semantic/core/verify-conditions.mjs.map +0 -1
  97. package/dist/src/semantic/core/verify-release.mjs +0 -2
  98. package/dist/src/semantic/core/verify-release.mjs.map +0 -1
  99. package/dist/src/semantic/docker/publish.mjs +0 -2
  100. package/dist/src/semantic/docker/publish.mjs.map +0 -1
  101. package/dist/src/semantic/docker/success.mjs +0 -2
  102. package/dist/src/semantic/docker/success.mjs.map +0 -1
  103. package/dist/strip-ansi-Aeu5cmZe.mjs +0 -174
  104. package/dist/strip-ansi-Cl0pRo-s.mjs +0 -2
  105. package/dist/strip-ansi-Cl0pRo-s.mjs.map +0 -1
  106. package/dist/wrap-ansi-BeIjar2W.mjs +0 -2
  107. package/dist/wrap-ansi-DsMb4WnZ.mjs.map +0 -1
  108. package/mise.toml +0 -2
  109. package/oxlint.json +0 -25
  110. package/release.config.mjs +0 -39
  111. package/src/commands/checkfeatures.ts +0 -39
  112. package/src/commands/clean.ts +0 -36
  113. package/src/commands/config.ts +0 -31
  114. package/src/commands/deploy.ts +0 -39
  115. package/src/commands/fetch.ts +0 -30
  116. package/src/commands/finish.ts +0 -50
  117. package/src/commands/index.ts +0 -13
  118. package/src/commands/jira-releases.ts +0 -97
  119. package/src/commands/merge.ts +0 -58
  120. package/src/commands/prompts/branches.ts +0 -46
  121. package/src/commands/pull.ts +0 -44
  122. package/src/commands/push.ts +0 -48
  123. package/src/commands/rebase.ts +0 -56
  124. package/src/commands/release.ts +0 -21
  125. package/src/commands/republish.ts +0 -34
  126. package/src/commands/start.ts +0 -123
  127. package/src/commands/tasks/merge-branch.ts +0 -80
  128. package/src/commands/tasks/push-branch.ts +0 -19
  129. package/src/commands/tasks/rebase-all-branches.ts +0 -37
  130. package/src/commands/tasks/refresh-repository.ts +0 -38
  131. package/src/commands/tasks/run-test.ts +0 -28
  132. package/src/commands/tasks/update-branch.ts +0 -49
  133. package/src/commands/tasks/update-dependencies.ts +0 -43
  134. package/src/commands/utils/check-install.ts +0 -31
  135. package/src/common/back/directus/directus-flow.test.ts +0 -63
  136. package/src/common/back/directus/directus-flow.ts +0 -48
  137. package/src/common/back/http/http-proxy.ts +0 -21
  138. package/src/common/back/http/http-request.spec.ts +0 -50
  139. package/src/common/back/http/http-request.ts +0 -74
  140. package/src/common/back/jira/get-sorted-releases.ts +0 -40
  141. package/src/common/back/jira/interfaces/JiraIIssue.d.ts +0 -100
  142. package/src/common/back/jira/jira-releases.ts +0 -47
  143. package/src/common/back/jira/jira-request.spec.ts +0 -59
  144. package/src/common/back/jira/jira-request.ts +0 -29
  145. package/src/common/back/jira/jira-search.spec.ts +0 -44
  146. package/src/common/back/jira/jira-search.ts +0 -17
  147. package/src/common/cli/bun.test.ts +0 -58
  148. package/src/common/cli/bun.ts +0 -33
  149. package/src/common/cli/cli.ts +0 -127
  150. package/src/common/cli/docker.test.ts +0 -141
  151. package/src/common/cli/docker.ts +0 -66
  152. package/src/common/cli/git.test.ts +0 -215
  153. package/src/common/cli/git.ts +0 -121
  154. package/src/common/cli/lerna.test.ts +0 -58
  155. package/src/common/cli/lerna.ts +0 -25
  156. package/src/common/cli/npm.test.ts +0 -58
  157. package/src/common/cli/npm.ts +0 -33
  158. package/src/common/cli/pnpm.test.ts +0 -58
  159. package/src/common/cli/pnpm.ts +0 -34
  160. package/src/common/cli/yarn.test.ts +0 -58
  161. package/src/common/cli/yarn.ts +0 -33
  162. package/src/common/configure-git-workspace.ts +0 -39
  163. package/src/common/get-config.ts +0 -159
  164. package/src/common/get-package-json.ts +0 -15
  165. package/src/common/get-package-manager.ts +0 -13
  166. package/src/common/get-release-config.ts +0 -9
  167. package/src/common/index.ts +0 -14
  168. package/src/common/run-command.test.ts +0 -66
  169. package/src/common/run-command.ts +0 -67
  170. package/src/common/types.ts +0 -26
  171. package/src/common/vendor.d.ts +0 -4
  172. package/src/index.ts +0 -14
  173. package/src/semantic/core/analyze-commits.ts +0 -21
  174. package/src/semantic/core/conditional.ts +0 -62
  175. package/src/semantic/core/exit.ts +0 -15
  176. package/src/semantic/core/prepare/bump-version.ts +0 -41
  177. package/src/semantic/core/prepare/commit.ts +0 -30
  178. package/src/semantic/core/prepare/release-info.ts +0 -6
  179. package/src/semantic/core/run.ts +0 -23
  180. package/src/semantic/core/sync-repository.ts +0 -55
  181. package/src/semantic/core/verify-conditions.ts +0 -41
  182. package/src/semantic/core/verify-release.ts +0 -10
  183. package/src/semantic/define-config.ts +0 -42
  184. package/src/semantic/docker/publish.ts +0 -6
  185. package/src/semantic/docker/success.ts +0 -10
  186. package/src/semantic/utils/__mock__/test1/package.json +0 -7
  187. package/src/semantic/utils/__mock__/test1/packages/a/package.json +0 -9
  188. package/src/semantic/utils/__mock__/test1/packages/b/package.json +0 -7
  189. package/src/semantic/utils/__mock__/test2/package.json +0 -4
  190. package/src/semantic/utils/__mock__/test2/packages/a/package.json +0 -7
  191. package/src/semantic/utils/__mock__/test2/packages/b/package.json +0 -5
  192. package/src/semantic/utils/bump-packages-version.test.ts +0 -76
  193. package/src/semantic/utils/bump-packages-version.ts +0 -53
  194. package/src/semantic/utils/calculate-snapshot-version.test.ts +0 -69
  195. package/src/semantic/utils/calculate-snapshot-version.ts +0 -17
  196. package/src/semantic/utils/display-package-info.ts +0 -12
  197. package/src/semantic/utils/display-release-info.ts +0 -13
  198. package/src/semantic/utils/docker-clean-tags.test.ts +0 -62
  199. package/src/semantic/utils/docker-clean-tags.ts +0 -58
  200. package/src/semantic/utils/docker-publish.test.ts +0 -45
  201. package/src/semantic/utils/docker-publish.ts +0 -24
  202. package/src/semantic/utils/log-section.ts +0 -9
  203. package/src/semantic/utils/release-rules.ts +0 -15
  204. package/src/semantic/utils/transform-writer.ts +0 -101
  205. package/src/workflow/index.ts +0 -42
  206. package/tsconfig.build.json +0 -29
  207. package/tsconfig.json +0 -30
  208. package/tsdown.config.ts +0 -63
  209. package/vitest.config.mts +0 -9
package/README.md CHANGED
@@ -1,362 +1,178 @@
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.
41
+ `jira-releases` lists release versions for a Jira project and component, generates delivery notes, and can mark versions as released.
134
42
 
135
- ### Condition step (publish, success, fail)
136
-
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)
155
-
156
- This plugin synchronizes your remote repository after publishing:
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.
157
48
 
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.
49
+ ## Monorepo package artifacts
160
50
 
161
- Options:
51
+ `cm packages build` creates the npm-ready artifacts of a Yarn-workspace monorepo. It performs the following steps:
162
52
 
163
- - pluginOptions.branches: Allows you to explicitly define the list of branches that must be pushed to synchronize the remote. Example:
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.
164
57
 
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.
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.
181
64
 
182
- Notes:
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.
183
66
 
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.
185
-
186
- ### Build and E2E Test
187
-
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
77
+ ## `flow` configuration
225
78
 
226
- CmFlow release generate a `release.info` file in the root of your project. This file contains the branch name.
79
+ Configure package build and publication defaults in the root `package.json`:
227
80
 
228
- ```js
229
- import { defineConfig } from "@cmflow/cli";
230
-
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
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.
293
146
 
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`
147
+ For CircleCI, export the OIDC token in each job that runs a real release:
303
148
 
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]
149
+ ```yaml
150
+ - run:
151
+ name: Cm Release
152
+ command: |
153
+ export NPM_ID_TOKEN=$(circleci run oidc get --claims '{"aud":"npm:registry.npmjs.org"}')
154
+ yarn release
310
155
  ```
311
156
 
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
157
+ Each npm package must also be configured with a CircleCI trusted publisher and allow the `npm publish` action. The Organization ID, Project ID, Pipeline definition ID and VCS origin configured on npm must match the CircleCI project exactly. [npm’s CircleCI trusted publishing guide](https://docs.npmjs.com/trusted-publishers/) details the required values.
323
158
 
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.
159
+ ## Atlas
330
160
 
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.
161
+ 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
162
 
333
- ### Example
163
+ ## Development
334
164
 
335
- From this repo, a sample script is provided in `package.json`:
165
+ From the monorepo root:
336
166
 
337
- ```sh
338
- yarn jira:releases
167
+ ```bash
168
+ yarn workspace @cmflow/cli build
169
+ yarn workspace @cmflow/cli test
170
+ yarn check
339
171
  ```
340
172
 
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
- ```
173
+ ## License
356
174
 
357
- ### Best practices
175
+ The MIT License (MIT)
176
+ Copyright (c) 2016 - Today ClubMed
358
177
 
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.
178
+ 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.