@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.
- package/README.md +102 -298
- package/dist/bin/cm.mjs +9985 -1348
- package/dist/bin/cmrelease.mjs +3875 -1193
- package/dist/{cli-truncate-CXNquMRK.mjs → cli-truncate-Bi2MjGwF.mjs} +177 -6
- package/dist/cli-truncate-DMcpM5Q7.mjs +2 -0
- package/dist/cli-truncate-DMcpM5Q7.mjs.map +1 -0
- package/dist/{cli-truncate-BmHD4ngn.mjs → cli-truncate-DsW0mgI_.mjs} +177 -6
- package/dist/{common-CwPbT3So.mjs → common-BdfXquG0.mjs} +31 -36
- package/dist/common-BdfXquG0.mjs.map +1 -0
- package/dist/compile-packages-BB08_q2B.mjs +2 -0
- package/dist/compile-packages-BB08_q2B.mjs.map +1 -0
- package/dist/docker-Cc30aRzl.mjs +34 -0
- package/dist/docker-Cc30aRzl.mjs.map +1 -0
- package/dist/docker-clean-tags-EvFdWykP.mjs +2 -0
- package/dist/docker-clean-tags-EvFdWykP.mjs.map +1 -0
- package/dist/docker-publish-CG0aN9se.mjs +2 -0
- package/dist/docker-publish-CG0aN9se.mjs.map +1 -0
- package/dist/find-packages-611B-66T.mjs +42 -0
- package/dist/find-packages-611B-66T.mjs.map +1 -0
- package/dist/get-config-8ivgd1KC.mjs +9 -0
- package/dist/get-config-8ivgd1KC.mjs.map +1 -0
- package/dist/get-east-asian-width-Tfn8qoqd.mjs.map +1 -1
- package/dist/{get-east-asian-width-eFfEkHwo.mjs → get-east-asian-width-wiVWCFXf.mjs} +4 -4
- package/dist/log-update-CLbF3iV6.mjs +6 -0
- package/dist/log-update-CLbF3iV6.mjs.map +1 -0
- package/dist/{log-update-B2GqeeDd.mjs → log-update-CTXRtajW.mjs} +185 -14
- package/dist/{log-update-BldA9lkm.mjs → log-update-Dy1vPMGY.mjs} +185 -14
- package/dist/npm-VM_GgazT.mjs +2 -0
- package/dist/npm-VM_GgazT.mjs.map +1 -0
- package/dist/{semver-D8gwMSFO.mjs → semver-DFjVbN1S.mjs} +2 -2
- package/dist/semver-DFjVbN1S.mjs.map +1 -0
- package/dist/source-CwLcYLzI.mjs +7 -0
- package/dist/source-CwLcYLzI.mjs.map +1 -0
- package/dist/{wrap-ansi-DsMb4WnZ.mjs → wrap-ansi-9ugahFCy.mjs} +2 -2
- package/dist/wrap-ansi-9ugahFCy.mjs.map +1 -0
- package/dist/{wrap-ansi-CWIezXNl.mjs → wrap-ansi-BRr0GA6g.mjs} +5 -5
- package/dist/{wrap-ansi-T0rz0Urp.mjs → wrap-ansi-Cupoo4Yg.mjs} +5 -5
- package/dist/wrap-ansi-dwgEjNWf.mjs +2 -0
- package/dist/write-package-cxki9d3K.mjs +8 -0
- package/dist/write-package-cxki9d3K.mjs.map +1 -0
- package/dist/write-packages-CxCAl_AG.mjs +10 -0
- package/dist/write-packages-CxCAl_AG.mjs.map +1 -0
- package/package.json +9 -41
- package/tsdown.config.ts +5 -14
- package/.oxfmtrc.json +0 -11
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-4.18.0.cjs +0 -1000
- package/.yarnrc.yml +0 -10
- package/bin/cm-checkfeatures.ts +0 -10
- package/bin/cm-clean.ts +0 -10
- package/bin/cm-config.ts +0 -10
- package/bin/cm-deploy.ts +0 -10
- package/bin/cm-expedit.ts +0 -19
- package/bin/cm-fetch.ts +0 -10
- package/bin/cm-finish.ts +0 -10
- package/bin/cm-jira-releases.ts +0 -10
- package/bin/cm-merge.ts +0 -10
- package/bin/cm-publish.ts +0 -10
- package/bin/cm-pull.ts +0 -8
- package/bin/cm-push.ts +0 -10
- package/bin/cm-rebase.ts +0 -10
- package/bin/cm-release.ts +0 -5
- package/bin/cm-republish.ts +0 -10
- package/bin/cm-start.ts +0 -10
- package/bin/cm.ts +0 -40
- package/dist/cli-truncate-DbOyuy2e.mjs +0 -2
- package/dist/cli-truncate-DbOyuy2e.mjs.map +0 -1
- package/dist/common-CwPbT3So.mjs.map +0 -1
- package/dist/docker-clean-tags-Cd-E8IqJ.mjs +0 -2
- package/dist/docker-clean-tags-Cd-E8IqJ.mjs.map +0 -1
- package/dist/docker-publish-B0E0qYYB.mjs +0 -2
- package/dist/docker-publish-B0E0qYYB.mjs.map +0 -1
- package/dist/get-config-DoOyLztI.mjs +0 -41
- package/dist/get-config-DoOyLztI.mjs.map +0 -1
- package/dist/log-update-By8Z-mak.mjs +0 -6
- package/dist/log-update-By8Z-mak.mjs.map +0 -1
- package/dist/semver-D8gwMSFO.mjs.map +0 -1
- package/dist/src/index.mjs +0 -18
- package/dist/src/index.mjs.map +0 -1
- package/dist/src/semantic/core/analyze-commits.mjs +0 -2
- package/dist/src/semantic/core/analyze-commits.mjs.map +0 -1
- package/dist/src/semantic/core/conditional.mjs +0 -2
- package/dist/src/semantic/core/conditional.mjs.map +0 -1
- package/dist/src/semantic/core/exit.mjs +0 -2
- package/dist/src/semantic/core/exit.mjs.map +0 -1
- package/dist/src/semantic/core/prepare/bump-version.mjs +0 -48
- package/dist/src/semantic/core/prepare/bump-version.mjs.map +0 -1
- package/dist/src/semantic/core/prepare/commit.mjs +0 -2
- package/dist/src/semantic/core/prepare/commit.mjs.map +0 -1
- package/dist/src/semantic/core/prepare/release-info.mjs +0 -2
- package/dist/src/semantic/core/prepare/release-info.mjs.map +0 -1
- package/dist/src/semantic/core/run.mjs +0 -2
- package/dist/src/semantic/core/run.mjs.map +0 -1
- package/dist/src/semantic/core/sync-repository.mjs +0 -2
- package/dist/src/semantic/core/sync-repository.mjs.map +0 -1
- package/dist/src/semantic/core/verify-conditions.mjs +0 -2
- package/dist/src/semantic/core/verify-conditions.mjs.map +0 -1
- package/dist/src/semantic/core/verify-release.mjs +0 -2
- package/dist/src/semantic/core/verify-release.mjs.map +0 -1
- package/dist/src/semantic/docker/publish.mjs +0 -2
- package/dist/src/semantic/docker/publish.mjs.map +0 -1
- package/dist/src/semantic/docker/success.mjs +0 -2
- package/dist/src/semantic/docker/success.mjs.map +0 -1
- package/dist/strip-ansi-Aeu5cmZe.mjs +0 -174
- package/dist/strip-ansi-Cl0pRo-s.mjs +0 -2
- package/dist/strip-ansi-Cl0pRo-s.mjs.map +0 -1
- package/dist/wrap-ansi-BeIjar2W.mjs +0 -2
- package/dist/wrap-ansi-DsMb4WnZ.mjs.map +0 -1
- package/mise.toml +0 -2
- package/oxlint.json +0 -25
- package/release.config.mjs +0 -39
- package/src/commands/checkfeatures.ts +0 -39
- package/src/commands/clean.ts +0 -36
- package/src/commands/config.ts +0 -31
- package/src/commands/deploy.ts +0 -39
- package/src/commands/fetch.ts +0 -30
- package/src/commands/finish.ts +0 -50
- package/src/commands/index.ts +0 -13
- package/src/commands/jira-releases.ts +0 -97
- package/src/commands/merge.ts +0 -58
- package/src/commands/prompts/branches.ts +0 -46
- package/src/commands/pull.ts +0 -44
- package/src/commands/push.ts +0 -48
- package/src/commands/rebase.ts +0 -56
- package/src/commands/release.ts +0 -21
- package/src/commands/republish.ts +0 -34
- package/src/commands/start.ts +0 -123
- package/src/commands/tasks/merge-branch.ts +0 -80
- package/src/commands/tasks/push-branch.ts +0 -19
- package/src/commands/tasks/rebase-all-branches.ts +0 -37
- package/src/commands/tasks/refresh-repository.ts +0 -38
- package/src/commands/tasks/run-test.ts +0 -28
- package/src/commands/tasks/update-branch.ts +0 -49
- package/src/commands/tasks/update-dependencies.ts +0 -43
- package/src/commands/utils/check-install.ts +0 -31
- package/src/common/back/directus/directus-flow.test.ts +0 -63
- package/src/common/back/directus/directus-flow.ts +0 -48
- package/src/common/back/http/http-proxy.ts +0 -21
- package/src/common/back/http/http-request.spec.ts +0 -50
- package/src/common/back/http/http-request.ts +0 -74
- package/src/common/back/jira/get-sorted-releases.ts +0 -40
- package/src/common/back/jira/interfaces/JiraIIssue.d.ts +0 -100
- package/src/common/back/jira/jira-releases.ts +0 -47
- package/src/common/back/jira/jira-request.spec.ts +0 -59
- package/src/common/back/jira/jira-request.ts +0 -29
- package/src/common/back/jira/jira-search.spec.ts +0 -44
- package/src/common/back/jira/jira-search.ts +0 -17
- package/src/common/cli/bun.test.ts +0 -58
- package/src/common/cli/bun.ts +0 -33
- package/src/common/cli/cli.ts +0 -127
- package/src/common/cli/docker.test.ts +0 -141
- package/src/common/cli/docker.ts +0 -66
- package/src/common/cli/git.test.ts +0 -215
- package/src/common/cli/git.ts +0 -121
- package/src/common/cli/lerna.test.ts +0 -58
- package/src/common/cli/lerna.ts +0 -25
- package/src/common/cli/npm.test.ts +0 -58
- package/src/common/cli/npm.ts +0 -33
- package/src/common/cli/pnpm.test.ts +0 -58
- package/src/common/cli/pnpm.ts +0 -34
- package/src/common/cli/yarn.test.ts +0 -58
- package/src/common/cli/yarn.ts +0 -33
- package/src/common/configure-git-workspace.ts +0 -39
- package/src/common/get-config.ts +0 -159
- package/src/common/get-package-json.ts +0 -15
- package/src/common/get-package-manager.ts +0 -13
- package/src/common/get-release-config.ts +0 -9
- package/src/common/index.ts +0 -14
- package/src/common/run-command.test.ts +0 -66
- package/src/common/run-command.ts +0 -67
- package/src/common/types.ts +0 -26
- package/src/common/vendor.d.ts +0 -4
- package/src/index.ts +0 -14
- package/src/semantic/core/analyze-commits.ts +0 -21
- package/src/semantic/core/conditional.ts +0 -62
- package/src/semantic/core/exit.ts +0 -15
- package/src/semantic/core/prepare/bump-version.ts +0 -41
- package/src/semantic/core/prepare/commit.ts +0 -30
- package/src/semantic/core/prepare/release-info.ts +0 -6
- package/src/semantic/core/run.ts +0 -23
- package/src/semantic/core/sync-repository.ts +0 -55
- package/src/semantic/core/verify-conditions.ts +0 -41
- package/src/semantic/core/verify-release.ts +0 -10
- package/src/semantic/define-config.ts +0 -42
- package/src/semantic/docker/publish.ts +0 -6
- package/src/semantic/docker/success.ts +0 -10
- package/src/semantic/utils/__mock__/test1/package.json +0 -7
- package/src/semantic/utils/__mock__/test1/packages/a/package.json +0 -9
- package/src/semantic/utils/__mock__/test1/packages/b/package.json +0 -7
- package/src/semantic/utils/__mock__/test2/package.json +0 -4
- package/src/semantic/utils/__mock__/test2/packages/a/package.json +0 -7
- package/src/semantic/utils/__mock__/test2/packages/b/package.json +0 -5
- package/src/semantic/utils/bump-packages-version.test.ts +0 -76
- package/src/semantic/utils/bump-packages-version.ts +0 -53
- package/src/semantic/utils/calculate-snapshot-version.test.ts +0 -69
- package/src/semantic/utils/calculate-snapshot-version.ts +0 -17
- package/src/semantic/utils/display-package-info.ts +0 -12
- package/src/semantic/utils/display-release-info.ts +0 -13
- package/src/semantic/utils/docker-clean-tags.test.ts +0 -62
- package/src/semantic/utils/docker-clean-tags.ts +0 -58
- package/src/semantic/utils/docker-publish.test.ts +0 -45
- package/src/semantic/utils/docker-publish.ts +0 -24
- package/src/semantic/utils/log-section.ts +0 -9
- package/src/semantic/utils/release-rules.ts +0 -15
- package/src/semantic/utils/transform-writer.ts +0 -101
- package/src/workflow/index.ts +0 -42
- package/tsconfig.build.json +0 -29
- package/tsconfig.json +0 -30
- 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
|
-
[](https://badge.fury.io/js/%40cmflow%2Fcli)
|
|
8
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
9
|
-
[](https://oxc.rs/docs/guide/usage/formatter)
|
|
11
9
|
</div>
|
|
12
10
|
|
|
13
|
-
|
|
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
|
-
|
|
13
|
+
## Installation
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
CmFlow release to deploy your projects based on CmFlow convention.
|
|
15
|
+
Install globally for the Git Flow commands:
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
npm i --save-dev @cmflow/cli
|
|
17
|
+
```bash
|
|
18
|
+
npm install --global @cmflow/cli
|
|
19
|
+
cm --help
|
|
30
20
|
```
|
|
31
21
|
|
|
32
|
-
|
|
22
|
+
Install it as a development dependency when a project uses its release plugins or package-artifact commands:
|
|
33
23
|
|
|
34
|
-
```
|
|
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
|
-
|
|
28
|
+
## Git Flow commands
|
|
46
29
|
|
|
47
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
39
|
+
### Jira releases
|
|
123
40
|
|
|
124
|
-
|
|
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
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
+
## Monorepo package artifacts
|
|
157
50
|
|
|
158
|
-
|
|
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
|
-
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
"
|
|
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
|
-
|
|
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
|
-
|
|
229
|
-
import { defineConfig } from "@cmflow/cli";
|
|
79
|
+
Configure package build and publication defaults in the root `package.json`:
|
|
230
80
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
|
|
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
|
-
|
|
111
|
+
A workspace package may set its own `flow.registries` array to replace the root registries for that package.
|
|
247
112
|
|
|
248
|
-
|
|
249
|
-
import { defineConfig } from "@cmflow/cli";
|
|
113
|
+
## Semantic Release
|
|
250
114
|
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
151
|
+
## Development
|
|
334
152
|
|
|
335
|
-
From
|
|
153
|
+
From the monorepo root:
|
|
336
154
|
|
|
337
|
-
```
|
|
338
|
-
yarn
|
|
155
|
+
```bash
|
|
156
|
+
yarn workspace @cmflow/cli build
|
|
157
|
+
yarn workspace @cmflow/cli test
|
|
158
|
+
yarn check
|
|
339
159
|
```
|
|
340
160
|
|
|
341
|
-
|
|
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
|
-
|
|
163
|
+
The MIT License (MIT)
|
|
164
|
+
Copyright (c) 2016 - Today ClubMed
|
|
358
165
|
|
|
359
|
-
|
|
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.
|