@cmflow/cli 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.prettierrc → .oxfmtrc.json} +2 -1
- package/.yarn/install-state.gz +0 -0
- package/README.md +66 -72
- package/bin/checkfeatures.js +13 -0
- package/bin/cm-expedit.js +19 -0
- package/bin/cmpull.js +22 -0
- package/mise.toml +2 -0
- package/oxlint.json +25 -0
- package/package.json +30 -36
- package/src/commands/checkfeatures.js +20 -0
- package/src/commands/index.js +2 -0
- package/src/commands/pull.js +30 -0
- package/src/common/back/jira/interfaces/JiraIIssue.d.ts +3 -3
- package/src/common/back/jira/jira-request.js +0 -4
- package/src/common/back/jira/jira-request.spec.js +1 -1
- package/src/semantic/utils/__mock__/test1/package.json +7 -1
- package/src/semantic/utils/__mock__/test1/packages/a/package.json +9 -1
- package/src/semantic/utils/__mock__/test1/packages/b/package.json +7 -1
- package/tsconfig.json +4 -21
- package/vitest.config.mts +3 -3
- package/.prettierignore +0 -5
- package/bin/checkfeatures.sh +0 -5
- package/bin/cmexpedit.sh +0 -9
- package/bin/cmpull.sh +0 -7
- package/eslint.config.mjs +0 -67
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
npm i -g @cmflow/cli
|
|
17
|
-
|
|
17
|
+
```
|
|
18
18
|
|
|
19
19
|
## CmFlow release using Semantic Release
|
|
20
|
+
|
|
20
21
|
### Installation
|
|
21
22
|
|
|
22
23
|
CmFlow is compatible with [semantic-release](https://github.com/semantic-release/semantic-release) 📦🚀. You can use
|
|
@@ -44,12 +45,12 @@ Edit your `package.json` and add the following configuration:
|
|
|
44
45
|
Then create `release.config.js` with this configuration:
|
|
45
46
|
|
|
46
47
|
```javascript
|
|
47
|
-
import { defineConfig } from
|
|
48
|
+
import { defineConfig } from "@cmflow/cli";
|
|
48
49
|
|
|
49
50
|
export default defineConfig({
|
|
50
|
-
verifyConditions: [
|
|
51
|
-
analyzeCommits: [
|
|
52
|
-
verifyRelease: [
|
|
51
|
+
verifyConditions: ["@cmflow/cli/semantic/core/verify-conditions"],
|
|
52
|
+
analyzeCommits: ["@cmflow/cli/semantic/core/analyze-commits"],
|
|
53
|
+
verifyRelease: ["@cmflow/cli/semantic/core/verify-release"],
|
|
53
54
|
generateNotes: [
|
|
54
55
|
[
|
|
55
56
|
"@cmflow/cli/semantic/conditional", // add this task to trigger build npm task
|
|
@@ -60,53 +61,48 @@ export default defineConfig({
|
|
|
60
61
|
]
|
|
61
62
|
],
|
|
62
63
|
prepare: [
|
|
63
|
-
|
|
64
|
+
"@cmflow/cli/semantic/core/prepare/bump-version",
|
|
64
65
|
[
|
|
65
|
-
|
|
66
|
+
"@cmflow/cli/semantic/core/prepare/run", // add this task to trigger build npm task
|
|
66
67
|
{
|
|
67
|
-
command:
|
|
68
|
+
command: "build"
|
|
68
69
|
}
|
|
69
70
|
],
|
|
70
71
|
[
|
|
71
|
-
|
|
72
|
+
"@cmflow/cli/semantic/core/prepare/run", // add this task to trigger build npm task
|
|
72
73
|
{
|
|
73
|
-
command:
|
|
74
|
+
command: "test_e2e"
|
|
74
75
|
}
|
|
75
76
|
],
|
|
76
77
|
[
|
|
77
|
-
|
|
78
|
+
"@cmflow/cli/semantic/core/conditional", // add this task to trigger build npm task
|
|
78
79
|
{
|
|
79
80
|
// when: (context) => context.branch.type === "release" // default condition to run the task
|
|
80
|
-
run:
|
|
81
|
-
'@cmflow/cli/semantic/core/prepare/commit'
|
|
82
|
-
]
|
|
81
|
+
run: ["@cmflow/cli/semantic/core/prepare/commit"]
|
|
83
82
|
}
|
|
84
83
|
]
|
|
85
84
|
],
|
|
86
85
|
publish: [
|
|
87
86
|
[
|
|
88
|
-
|
|
87
|
+
"@cmflow/cli/semantic/core/conditional",
|
|
89
88
|
{
|
|
90
89
|
// when: (context) => context.branch.type === "release" // default condition to run the task
|
|
91
|
-
run: [
|
|
92
|
-
'@cmflow/cli/semantic/core/sync-repository',
|
|
93
|
-
'@semantic-release/github'
|
|
94
|
-
] // only run if the conditional rule is true
|
|
90
|
+
run: ["@cmflow/cli/semantic/core/sync-repository", "@semantic-release/github"] // only run if the conditional rule is true
|
|
95
91
|
}
|
|
96
92
|
],
|
|
97
93
|
[
|
|
98
|
-
|
|
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
|
|
99
95
|
{
|
|
100
|
-
when: (context) => context.nextRelease.channel ===
|
|
96
|
+
when: (context) => context.nextRelease.channel === "prerelease"
|
|
101
97
|
}
|
|
102
98
|
]
|
|
103
99
|
],
|
|
104
100
|
success: [
|
|
105
101
|
[
|
|
106
|
-
|
|
102
|
+
"@cmflow/cli/semantic/core/conditional",
|
|
107
103
|
{
|
|
108
104
|
// when: (context) => context.branch.type === "release" // default condition to run the task
|
|
109
|
-
run:
|
|
105
|
+
run: "@semantic-release/github" // only run if the conditional rule is true
|
|
110
106
|
}
|
|
111
107
|
]
|
|
112
108
|
],
|
|
@@ -115,12 +111,12 @@ export default defineConfig({
|
|
|
115
111
|
"@cmflow/cli/semantic/core/conditional",
|
|
116
112
|
{
|
|
117
113
|
// when: (context) => context.branch.type === "release" // default condition to run the task
|
|
118
|
-
run:
|
|
114
|
+
run: "@semantic-release/github" // only run if the conditional rule is true
|
|
119
115
|
}
|
|
120
116
|
]
|
|
121
117
|
],
|
|
122
118
|
npmPublish: false
|
|
123
|
-
})
|
|
119
|
+
});
|
|
124
120
|
```
|
|
125
121
|
|
|
126
122
|
Then edit your `package.json` add the following tasks on script property:
|
|
@@ -129,7 +125,7 @@ Then edit your `package.json` add the following tasks on script property:
|
|
|
129
125
|
{
|
|
130
126
|
"script": {
|
|
131
127
|
"release": "cmrelease",
|
|
132
|
-
"
|
|
128
|
+
"release:dry_run": "cmrelease --dry-run"
|
|
133
129
|
}
|
|
134
130
|
}
|
|
135
131
|
```
|
|
@@ -139,54 +135,52 @@ Now, CmFlow and semantic release are correctly installed on your project.
|
|
|
139
135
|
### Condition step (publish, success, fail)
|
|
140
136
|
|
|
141
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
|
|
142
|
-
function that takes the semantic context as parameter and return a boolean.
|
|
138
|
+
function that takes the semantic context as parameter and return a boolean.
|
|
143
139
|
|
|
144
140
|
You can customize the condition to run the task by adding a `when` property to the configuration object.
|
|
145
141
|
|
|
146
142
|
```javascript
|
|
147
143
|
export default defineConfig({
|
|
148
144
|
publish: [
|
|
149
|
-
|
|
145
|
+
"@cmflow/cli/semantic/core/conditional",
|
|
150
146
|
{
|
|
151
|
-
when: (context) => context.branch.type ===
|
|
152
|
-
run: [
|
|
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
|
|
153
149
|
}
|
|
154
150
|
]
|
|
155
|
-
})
|
|
151
|
+
});
|
|
156
152
|
```
|
|
157
153
|
|
|
158
154
|
### Sync repository plugin (@cmflow/cli/semantic/core/sync-repository)
|
|
159
155
|
|
|
160
156
|
This plugin synchronizes your remote repository after publishing:
|
|
157
|
+
|
|
161
158
|
- It pushes the current branch to the remote (with --set-upstream) if it is part of the candidate branches.
|
|
162
159
|
- It then synchronizes the development branch with the production branch if they are different.
|
|
163
160
|
|
|
164
161
|
Options:
|
|
162
|
+
|
|
165
163
|
- pluginOptions.branches: Allows you to explicitly define the list of branches that must be pushed to synchronize the remote. Example:
|
|
166
164
|
|
|
167
165
|
```javascript
|
|
168
166
|
export default defineConfig({
|
|
169
167
|
publish: [
|
|
170
168
|
[
|
|
171
|
-
|
|
169
|
+
"@cmflow/cli/semantic/core/conditional",
|
|
172
170
|
{
|
|
173
|
-
run: [
|
|
174
|
-
[
|
|
175
|
-
'@cmflow/cli/semantic/core/sync-repository',
|
|
176
|
-
{ includes: ['main', 'develop', 'release'] }
|
|
177
|
-
],
|
|
178
|
-
'@semantic-release/github'
|
|
179
|
-
]
|
|
171
|
+
run: [["@cmflow/cli/semantic/core/sync-repository", { includes: ["main", "develop", "release"] }], "@semantic-release/github"]
|
|
180
172
|
}
|
|
181
173
|
]
|
|
182
174
|
]
|
|
183
|
-
})
|
|
175
|
+
});
|
|
184
176
|
```
|
|
185
177
|
|
|
186
178
|
Default behavior:
|
|
179
|
+
|
|
187
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.
|
|
188
181
|
|
|
189
182
|
Notes:
|
|
183
|
+
|
|
190
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.
|
|
191
185
|
|
|
192
186
|
### Build and E2E Test
|
|
@@ -205,45 +199,46 @@ Example:
|
|
|
205
199
|
}
|
|
206
200
|
}
|
|
207
201
|
```
|
|
202
|
+
|
|
208
203
|
Then:
|
|
209
204
|
|
|
210
205
|
```javascript
|
|
211
206
|
export default defineConfig({
|
|
212
207
|
prepare: [
|
|
213
208
|
[
|
|
214
|
-
|
|
209
|
+
"@cmflow/cli/semantic/core/run",
|
|
215
210
|
{
|
|
216
|
-
command:
|
|
211
|
+
command: "build"
|
|
217
212
|
}
|
|
218
213
|
],
|
|
219
214
|
[
|
|
220
|
-
|
|
215
|
+
"@cmflow/cli/semantic/core/run",
|
|
221
216
|
{
|
|
222
|
-
command:
|
|
217
|
+
command: "test_e2e"
|
|
223
218
|
}
|
|
224
219
|
]
|
|
225
220
|
]
|
|
226
|
-
})
|
|
221
|
+
});
|
|
227
222
|
```
|
|
228
223
|
|
|
229
|
-
### Generate release.info file
|
|
224
|
+
### Generate release.info file
|
|
230
225
|
|
|
231
226
|
CmFlow release generate a `release.info` file in the root of your project. This file contains the branch name.
|
|
232
227
|
|
|
233
228
|
```js
|
|
234
|
-
import { defineConfig } from
|
|
229
|
+
import { defineConfig } from "@cmflow/cli";
|
|
235
230
|
|
|
236
231
|
export default defineConfig({
|
|
237
232
|
prepare: [
|
|
238
|
-
|
|
233
|
+
"@cmflow/cli/semantic/prepare/bump-version",
|
|
239
234
|
[
|
|
240
|
-
|
|
235
|
+
"@cmflow/cli/semantic/prepare/release-info",
|
|
241
236
|
{
|
|
242
|
-
path:
|
|
237
|
+
path: "./resources/release.info"
|
|
243
238
|
}
|
|
244
239
|
]
|
|
245
240
|
]
|
|
246
|
-
})
|
|
241
|
+
});
|
|
247
242
|
```
|
|
248
243
|
|
|
249
244
|
### Deploy on Docker Hub
|
|
@@ -251,25 +246,21 @@ export default defineConfig({
|
|
|
251
246
|
Add the following configuration to your `release.config.js`:
|
|
252
247
|
|
|
253
248
|
```js
|
|
254
|
-
import { defineConfig } from
|
|
249
|
+
import { defineConfig } from "@cmflow/cli";
|
|
255
250
|
|
|
256
251
|
export default defineConfig({
|
|
257
|
-
publish: [
|
|
258
|
-
'@cmflow/cli/semantic/docker/publish'
|
|
259
|
-
]
|
|
252
|
+
publish: ["@cmflow/cli/semantic/docker/publish"]
|
|
260
253
|
});
|
|
261
254
|
```
|
|
262
255
|
|
|
263
256
|
### Publish & Clean docker tags
|
|
264
257
|
|
|
265
258
|
```js
|
|
266
|
-
import { defineConfig } from
|
|
259
|
+
import { defineConfig } from "@cmflow/cli";
|
|
267
260
|
|
|
268
261
|
export default defineConfig({
|
|
269
|
-
success: [
|
|
270
|
-
|
|
271
|
-
]
|
|
272
|
-
})
|
|
262
|
+
success: ["@cmflow/cli/semantic/docker/success"]
|
|
263
|
+
});
|
|
273
264
|
```
|
|
274
265
|
|
|
275
266
|
### Configure CI
|
|
@@ -277,29 +268,29 @@ export default defineConfig({
|
|
|
277
268
|
CmFlow release can be used with Travis CI, Circle CI and GitLab. You have to create these environments variables to
|
|
278
269
|
allow git release note deployment, commit push and docker image deployment.
|
|
279
270
|
|
|
280
|
-
| Variable
|
|
281
|
-
|
|
282
|
-
| PROJECT_NAME
|
|
283
|
-
| SCM_TOKEN
|
|
284
|
-
| GH_TOKEN
|
|
285
|
-
| GIT_USER_EMAIL
|
|
286
|
-
| GIT_USER_NAME
|
|
287
|
-
| DOCKER_HUB_ID
|
|
288
|
-
| DOCKER_HUB_PWD
|
|
289
|
-
|
|
290
|
-
|
|
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 |
|
|
291
280
|
|
|
292
281
|
## Jira Releases Command
|
|
293
282
|
|
|
294
283
|
The `jira-releases` command lists and (optionally) updates Jira versions related to an application version, then generates a share-ready delivery note.
|
|
295
284
|
|
|
296
285
|
### Goal
|
|
286
|
+
|
|
297
287
|
- For a given Jira project and component, retrieve all versions whose number is less than or equal to a target tag/version.
|
|
298
288
|
- Display the issues associated with those versions and produce a delivery note.
|
|
299
289
|
- Optionally mark the versions as "released" (with today's date) and move the corresponding issues to the "Livré en production" state.
|
|
300
290
|
- Optionally trigger a CMS (Directus) workflow if configuration is provided.
|
|
301
291
|
|
|
302
292
|
### Prerequisites
|
|
293
|
+
|
|
303
294
|
- Access to the Jira API via environment variables:
|
|
304
295
|
- `JIRA_API` (e.g., https://your-instance.atlassian.net)
|
|
305
296
|
- `JIRA_EMAIL`
|
|
@@ -329,6 +320,7 @@ Aliases and options (from `bin/cm-jira-releases.js`):
|
|
|
329
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.
|
|
330
321
|
|
|
331
322
|
### Detailed behavior
|
|
323
|
+
|
|
332
324
|
1. Fetch all Jira versions for the project (`projectId`).
|
|
333
325
|
2. Keep those whose version (after stripping `component-`, `version-`, and `v` prefixes) is semver <= the provided `--tag`.
|
|
334
326
|
3. Print the delivery note to stdout (example below).
|
|
@@ -343,7 +335,7 @@ Note: Jira versions are expected to follow `<COMPONENT>-<version>` or similar. F
|
|
|
343
335
|
From this repo, a sample script is provided in `package.json`:
|
|
344
336
|
|
|
345
337
|
```sh
|
|
346
|
-
yarn
|
|
338
|
+
yarn jira:releases
|
|
347
339
|
```
|
|
348
340
|
|
|
349
341
|
which runs, with `.env` loaded:
|
|
@@ -357,11 +349,13 @@ node --env-file=.env bin/cm.js jira-releases \
|
|
|
357
349
|
```
|
|
358
350
|
|
|
359
351
|
Raw CLI example:
|
|
352
|
+
|
|
360
353
|
```
|
|
361
354
|
cm jira-releases --project-id CMAB --component API --tag v0.3241.3 --update
|
|
362
355
|
```
|
|
363
356
|
|
|
364
357
|
### Best practices
|
|
358
|
+
|
|
365
359
|
- Use a valid semver `--tag` (the `v`/`version-` prefixes are accepted).
|
|
366
360
|
- Ensure your Jira versions follow a consistent schema that includes the component (`<COMPONENT>-<version>`) to allow matching.
|
|
367
361
|
- First run without `--update` to preview the note and verify selected versions and issues.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import commander from "commander";
|
|
4
|
+
|
|
5
|
+
import { commands, runCommand } from "../src/index.js";
|
|
6
|
+
|
|
7
|
+
commander
|
|
8
|
+
.usage("checkfeatures")
|
|
9
|
+
.alias("cm checkfeatures")
|
|
10
|
+
.option("-v, --verbose", "Enable verbose log", (v, t) => t + 1, 0)
|
|
11
|
+
.parse(process.argv);
|
|
12
|
+
|
|
13
|
+
runCommand(commands.Checkfeatures, commander);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { getConfig, getPackageManager, git } from "../src/index.js";
|
|
4
|
+
|
|
5
|
+
async function expedit() {
|
|
6
|
+
await git.fetch("--all", "--prune", "--tags");
|
|
7
|
+
|
|
8
|
+
const featureBranch = git.getBranchName();
|
|
9
|
+
const { PACKAGE_MANAGER } = getConfig();
|
|
10
|
+
|
|
11
|
+
getPackageManager(PACKAGE_MANAGER).newVersion("patch");
|
|
12
|
+
|
|
13
|
+
await git.push("-u", "-f", "origin", featureBranch);
|
|
14
|
+
|
|
15
|
+
console.log(`${featureBranch} PUBLISH DONE`);
|
|
16
|
+
console.log("End publishfeat");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
expedit();
|
package/bin/cmpull.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import commander from "commander";
|
|
4
|
+
|
|
5
|
+
import { commands, runCommand } from "../src/index.js";
|
|
6
|
+
|
|
7
|
+
const options = {};
|
|
8
|
+
|
|
9
|
+
commander
|
|
10
|
+
.usage("cmpull <branch>")
|
|
11
|
+
.arguments("<branch>")
|
|
12
|
+
.alias("cm pull")
|
|
13
|
+
.option("-v, --verbose", "Enable verbose log", (v, t) => t + 1, 0)
|
|
14
|
+
.action((branch) => {
|
|
15
|
+
options.branch = branch;
|
|
16
|
+
})
|
|
17
|
+
.parse(process.argv);
|
|
18
|
+
|
|
19
|
+
runCommand(commands.Pull, {
|
|
20
|
+
...options,
|
|
21
|
+
verbose: commander.verbose
|
|
22
|
+
});
|
package/mise.toml
ADDED
package/oxlint.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["typescript", "vitest"],
|
|
4
|
+
"env": {
|
|
5
|
+
"node": true
|
|
6
|
+
},
|
|
7
|
+
"ignorePatterns": ["node_modules", "dist", "public", "reports", "coverage", ".yarn", "__generated__"],
|
|
8
|
+
"rules": {
|
|
9
|
+
"no-var": "error",
|
|
10
|
+
"no-console": "error",
|
|
11
|
+
"camelcase": "off",
|
|
12
|
+
"func-names": "error",
|
|
13
|
+
"no-unused-vars": "off",
|
|
14
|
+
"typescript/no-unused-vars": "error"
|
|
15
|
+
},
|
|
16
|
+
"overrides": [
|
|
17
|
+
{
|
|
18
|
+
"files": ["**/*.spec.{js,ts}", "**/*.test.{js,ts}"],
|
|
19
|
+
"rules": {
|
|
20
|
+
"vitest/consistent-test-it": ["error", { "fn": "it", "withinDescribe": "it" }],
|
|
21
|
+
"vitest/no-alias-methods": "error"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,33 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmflow/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "An awesome Git Flow",
|
|
5
|
-
"author": "camfou",
|
|
6
5
|
"license": "MIT",
|
|
7
|
-
"
|
|
8
|
-
"main": "./src/index.js",
|
|
9
|
-
"module": "./src/index.js",
|
|
10
|
-
"type": "module",
|
|
6
|
+
"author": "camfou",
|
|
11
7
|
"bin": {
|
|
12
|
-
"checkfeatures": "./bin/checkfeatures.
|
|
8
|
+
"checkfeatures": "./bin/checkfeatures.js",
|
|
13
9
|
"cm": "./bin/cm.js",
|
|
14
10
|
"cmconfig": "bin/cm-config.js",
|
|
15
|
-
"cmexpedit": "
|
|
11
|
+
"cmexpedit": "bin/cm-expedit.js",
|
|
16
12
|
"cmfetch": "bin/cm-fetch.js",
|
|
17
13
|
"cmfinish": "bin/cm-finish.js",
|
|
18
14
|
"cmmerge": "./bin/cm-merge.js",
|
|
19
15
|
"cmpublish": "bin/cm-publish.js",
|
|
20
|
-
"cmpull": "./bin/cmpull.
|
|
16
|
+
"cmpull": "./bin/cmpull.js",
|
|
21
17
|
"cmpush": "bin/cm-push.js",
|
|
22
18
|
"cmrebase": "bin/cm-rebase.js",
|
|
23
19
|
"cmrelease": "./bin/cmrelease.js",
|
|
24
20
|
"cmrepublish": "bin/cm-republish.js",
|
|
25
21
|
"cmstart": "bin/cm-start.js"
|
|
26
22
|
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./src/index.js",
|
|
25
|
+
"module": "./src/index.js",
|
|
27
26
|
"exports": {
|
|
28
27
|
".": "./src/index.js",
|
|
29
28
|
"./semantic/*": "./src/semantic/*.js"
|
|
30
29
|
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "yarn lint && yarn format:check && yarn test:unit",
|
|
32
|
+
"test:unit": "vitest run",
|
|
33
|
+
"lint": "oxlint src bin",
|
|
34
|
+
"lint:ci": "mkdir -p ./reports && oxlint --format checkstyle src bin > ./reports/oxlint.xml",
|
|
35
|
+
"lint:fix": "oxlint --fix src bin",
|
|
36
|
+
"format": "oxfmt",
|
|
37
|
+
"format:check": "oxfmt --check",
|
|
38
|
+
"release": "node bin/cmrelease.js",
|
|
39
|
+
"release:dry_run": "node bin/cmrelease.js --dry-run",
|
|
40
|
+
"jira:releases": "node --env-file=.env bin/cm.js jira-releases --project-id CMAB --component API --tag 0.3241.3 --verbose"
|
|
41
|
+
},
|
|
31
42
|
"dependencies": {
|
|
32
43
|
"any-observable": "0.5.1",
|
|
33
44
|
"axios": "1.8.2",
|
|
@@ -53,18 +64,10 @@
|
|
|
53
64
|
"devDependencies": {
|
|
54
65
|
"@semantic-release/github": "11.0.1",
|
|
55
66
|
"@semantic-release/release-notes-generator": ">=14.0.3",
|
|
56
|
-
"@stylistic/eslint-plugin": "^4.2.0",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "8.26.1",
|
|
58
|
-
"@typescript-eslint/parser": "8.26.1",
|
|
59
|
-
"eslint": "9.21.0",
|
|
60
|
-
"eslint-config-prettier": "10.0.2",
|
|
61
|
-
"eslint-formatter-junit": "^8.40.0",
|
|
62
|
-
"eslint-plugin-prettier": "5.2.3",
|
|
63
|
-
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
64
|
-
"eslint-plugin-vitest": "0.5.4",
|
|
65
67
|
"husky": "4.3.6",
|
|
66
68
|
"lint-staged": "10.5.3",
|
|
67
|
-
"
|
|
69
|
+
"oxfmt": "^0.64.0",
|
|
70
|
+
"oxlint": "^1.79.0",
|
|
68
71
|
"typescript": "5.8.2",
|
|
69
72
|
"vitest": "^3.0.8"
|
|
70
73
|
},
|
|
@@ -80,33 +83,24 @@
|
|
|
80
83
|
"optional": true
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
|
-
"scripts": {
|
|
84
|
-
"test": "yarn lint && yarn test_unit",
|
|
85
|
-
"test_unit": "vitest run",
|
|
86
|
-
"lint": "eslint",
|
|
87
|
-
"lint_ci": "eslint --format junit --output-file ./reports/eslint.xml",
|
|
88
|
-
"lint_fix": "eslint --fix",
|
|
89
|
-
"release": "node bin/cmrelease.js",
|
|
90
|
-
"release_dry_run": "node bin/cmrelease.js --dry-run",
|
|
91
|
-
"jira_releases": "node --env-file=.env bin/cm.js jira-releases --project-id CMAB --component API --tag 0.3241.3 --verbose"
|
|
92
|
-
},
|
|
93
86
|
"husky": {
|
|
94
87
|
"hooks": {
|
|
95
|
-
"
|
|
96
|
-
"
|
|
88
|
+
"post-commit": "git update-index --again",
|
|
89
|
+
"pre-commit": "lint-staged"
|
|
97
90
|
}
|
|
98
91
|
},
|
|
99
92
|
"lint-staged": {
|
|
100
|
-
"*.js": [
|
|
101
|
-
"
|
|
102
|
-
"
|
|
93
|
+
"*.{js,ts}": [
|
|
94
|
+
"oxlint --fix",
|
|
95
|
+
"oxfmt"
|
|
103
96
|
]
|
|
104
97
|
},
|
|
98
|
+
"packageManager": "yarn@4.7.0",
|
|
99
|
+
"email": "camfou@gmail.com",
|
|
105
100
|
"flow": {
|
|
106
101
|
"branch": {
|
|
107
102
|
"develop": "master",
|
|
108
103
|
"production": "master"
|
|
109
104
|
}
|
|
110
|
-
}
|
|
111
|
-
"packageManager": "yarn@4.7.0"
|
|
105
|
+
}
|
|
112
106
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { git } from "../common/index.js";
|
|
2
|
+
import { refreshRepository } from "./tasks/refresh-repository.js";
|
|
3
|
+
|
|
4
|
+
export class Checkfeatures {
|
|
5
|
+
mapContext(commander, context) {
|
|
6
|
+
return { ...context, output: [] };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getTasks(context) {
|
|
10
|
+
return [refreshRepository(context)];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
success() {
|
|
14
|
+
const branches = git.branchesInfos("-r");
|
|
15
|
+
|
|
16
|
+
for (const { branch, date, creation, author } of branches) {
|
|
17
|
+
console.log(`${date}\t${creation}\t${author}\t${branch}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/commands/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export * from "./checkfeatures.js";
|
|
1
2
|
export * from "./clean.js";
|
|
2
3
|
export * from "./deploy.js";
|
|
3
4
|
export * from "./fetch.js";
|
|
4
5
|
export * from "./finish.js";
|
|
5
6
|
export * from "./jira-releases.js";
|
|
6
7
|
export * from "./merge.js";
|
|
8
|
+
export * from "./pull.js";
|
|
7
9
|
export * from "./push.js";
|
|
8
10
|
export * from "./rebase.js";
|
|
9
11
|
export * from "./republish.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { git } from "../common/index.js";
|
|
2
|
+
|
|
3
|
+
export class Pull {
|
|
4
|
+
mapContext(options, context) {
|
|
5
|
+
return { ...context, targetBranch: options.branch };
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
getTasks(context) {
|
|
9
|
+
const { targetBranch } = context;
|
|
10
|
+
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
title: "Git fetch",
|
|
14
|
+
task: () => git.fetch("--all", "--prune", "--tags")
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: `Delete local branch ${targetBranch}`,
|
|
18
|
+
task: () => git.branch("-D", targetBranch).catch(() => {})
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: `Checkout origin/${targetBranch}`,
|
|
22
|
+
task: () => git.checkout(`origin/${targetBranch}`, "--track")
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
success(context) {
|
|
28
|
+
console.log(`BRANCH ${context.targetBranch} RETRIEVE DONE`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ADFDocument } from
|
|
2
|
-
import type { JiraChangelog } from
|
|
1
|
+
import type { ADFDocument } from "./ADFDocument.js";
|
|
2
|
+
import type { JiraChangelog } from "./JiraChangelogIssueResponse.js";
|
|
3
3
|
|
|
4
4
|
export interface JiraStatus {
|
|
5
5
|
id: string;
|
|
@@ -60,7 +60,7 @@ export interface CreateJiraFieldsIssue {
|
|
|
60
60
|
};
|
|
61
61
|
assignee?: Partial<JiraUser>; // Utilisateur assigné
|
|
62
62
|
reporter?: Partial<JiraUser>; // Créateur de l'issue
|
|
63
|
-
status?: Omit<JiraStatus,
|
|
63
|
+
status?: Omit<JiraStatus, "name">;
|
|
64
64
|
components?: { name: string }[];
|
|
65
65
|
|
|
66
66
|
[customFieldId: `customfield_${string}`]: unknown; // Autres champs personnalisés
|
|
@@ -8,10 +8,6 @@ export async function jiraRequest(endpoint, opts = {}) {
|
|
|
8
8
|
const jiraUrl = `${JIRA_API}${endpoint}`;
|
|
9
9
|
const auth = Buffer.from(`${JIRA_EMAIL}:${JIRA_TOKEN}`).toString("base64");
|
|
10
10
|
|
|
11
|
-
if (opts.data && opts.headers?.["Content-Type"] === "application/json") {
|
|
12
|
-
opts.data = JSON.stringify(opts.data);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
11
|
return httpRequest(jiraUrl, {
|
|
16
12
|
...opts,
|
|
17
13
|
callee: "JIRA",
|
|
@@ -41,7 +41,7 @@ describe("jiraRequest", () => {
|
|
|
41
41
|
callee: "JIRA",
|
|
42
42
|
method: "post",
|
|
43
43
|
params: { key: "value" },
|
|
44
|
-
data:
|
|
44
|
+
data: { key: "value" },
|
|
45
45
|
headers: expect.objectContaining({
|
|
46
46
|
Authorization: expect.stringContaining("Basic ")
|
|
47
47
|
}),
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@package/a",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@package/b": "1.1.0"
|
|
6
|
+
},
|
|
7
|
+
"devDependencies": {},
|
|
8
|
+
"peerDependencies": {}
|
|
9
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -25,30 +25,13 @@
|
|
|
25
25
|
"esModuleInterop": true,
|
|
26
26
|
"resolveJsonModule": true,
|
|
27
27
|
"useDefineForClassFields": false,
|
|
28
|
-
"lib": [
|
|
29
|
-
"ESNext",
|
|
30
|
-
"dom",
|
|
31
|
-
"ESNext.AsyncIterable"
|
|
32
|
-
],
|
|
28
|
+
"lib": ["ESNext", "dom", "ESNext.AsyncIterable"],
|
|
33
29
|
"noResolve": false,
|
|
34
30
|
"preserveConstEnums": true,
|
|
35
31
|
"verbatimModuleSyntax": true,
|
|
36
32
|
"outDir": "./dist",
|
|
37
|
-
"types": [
|
|
38
|
-
"vitest/globals",
|
|
39
|
-
"vitest/importMeta",
|
|
40
|
-
"vite/client",
|
|
41
|
-
"node",
|
|
42
|
-
"vitest"
|
|
43
|
-
]
|
|
33
|
+
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"]
|
|
44
34
|
},
|
|
45
|
-
"include": [
|
|
46
|
-
|
|
47
|
-
"./src/**",
|
|
48
|
-
"./src/**/*.spec.js",
|
|
49
|
-
"./src/**/*.test.js"
|
|
50
|
-
],
|
|
51
|
-
"exclude": [
|
|
52
|
-
"node_modules"
|
|
53
|
-
]
|
|
35
|
+
"include": ["vite.config.mts", "./src/**", "./src/**/*.spec.js", "./src/**/*.test.js"],
|
|
36
|
+
"exclude": ["node_modules"]
|
|
54
37
|
}
|
package/vitest.config.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-unresolved
|
|
2
|
-
import { defineConfig } from
|
|
2
|
+
import { defineConfig } from "vitest/config";
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
5
|
test: {
|
|
6
6
|
globals: true,
|
|
7
|
-
environment:
|
|
7
|
+
environment: "node"
|
|
8
8
|
// ... Specify options here.
|
|
9
9
|
}
|
|
10
|
-
})
|
|
10
|
+
});
|
package/.prettierignore
DELETED
package/bin/checkfeatures.sh
DELETED
package/bin/cmexpedit.sh
DELETED
package/bin/cmpull.sh
DELETED
package/eslint.config.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import stylistic from "@stylistic/eslint-plugin";
|
|
2
|
-
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
|
3
|
-
import typescriptParser from "@typescript-eslint/parser";
|
|
4
|
-
import pluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
5
|
-
import pluginSimpleImportSort from "eslint-plugin-simple-import-sort";
|
|
6
|
-
import vitest from "eslint-plugin-vitest";
|
|
7
|
-
import globals from "globals";
|
|
8
|
-
|
|
9
|
-
export default [
|
|
10
|
-
{
|
|
11
|
-
ignores: [
|
|
12
|
-
"node_modules",
|
|
13
|
-
"dist",
|
|
14
|
-
"**/public",
|
|
15
|
-
"reports",
|
|
16
|
-
"**/coverage",
|
|
17
|
-
"**/reports",
|
|
18
|
-
"**/dist",
|
|
19
|
-
"**/node_modules",
|
|
20
|
-
".yarn",
|
|
21
|
-
"**/__generated__/**"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
languageOptions: {
|
|
26
|
-
sourceType: "module",
|
|
27
|
-
parser: typescriptParser,
|
|
28
|
-
parserOptions: {
|
|
29
|
-
ecmaVersion: "latest",
|
|
30
|
-
sourceType: "module"
|
|
31
|
-
},
|
|
32
|
-
globals: {
|
|
33
|
-
...globals.node
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
plugins: {
|
|
37
|
-
...stylistic.configs.recommended.plugins,
|
|
38
|
-
"@typescript-eslint": typescriptEslint,
|
|
39
|
-
"simple-import-sort": pluginSimpleImportSort
|
|
40
|
-
},
|
|
41
|
-
rules: {
|
|
42
|
-
...stylistic.configs.recommended.rules,
|
|
43
|
-
"@stylistic/lines-between-class-members": ["error", "always", { exceptAfterOverload: true }],
|
|
44
|
-
"@typescript-eslint/no-unused-vars": "error",
|
|
45
|
-
"simple-import-sort/imports": "error",
|
|
46
|
-
"simple-import-sort/exports": "error"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
files: ["*/*.spec.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}", "*/*.test.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], // or any other pattern
|
|
51
|
-
plugins: {
|
|
52
|
-
vitest
|
|
53
|
-
},
|
|
54
|
-
rules: {
|
|
55
|
-
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules
|
|
56
|
-
"vitest/consistent-test-it": [
|
|
57
|
-
"error",
|
|
58
|
-
{
|
|
59
|
-
fn: "it",
|
|
60
|
-
withinDescribe: "it"
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
"vitest/no-alias-methods": "error"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
pluginPrettierRecommended
|
|
67
|
-
];
|