@cmflow/cli 2.0.0-alpha.12 → 2.0.0-alpha.14
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/.yarn/install-state.gz +0 -0
- package/README.md +25 -17
- package/package.json +1 -1
- package/release.config.mjs +1 -1
- package/src/semantic/core/conditional.js +15 -2
- package/src/semantic/core/exit.js +8 -0
- package/src/semantic/core/{prepare/run.js → run.js} +2 -2
- package/src/semantic/core/{publish/sync-repository.js → sync-repository.js} +2 -2
- package/src/semantic/define-config.js +0 -26
- package/src/semantic/core/publish/exit.js +0 -7
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ export default defineConfig({
|
|
|
89
89
|
{
|
|
90
90
|
// when: (context) => context.branch.type === "release" // default condition to run the task
|
|
91
91
|
run: [
|
|
92
|
-
'@cmflow/cli/semantic/core/
|
|
92
|
+
'@cmflow/cli/semantic/core/sync-repository',
|
|
93
93
|
'@semantic-release/github'
|
|
94
94
|
] // only run if the conditional rule is true
|
|
95
95
|
}
|
|
@@ -98,7 +98,7 @@ export default defineConfig({
|
|
|
98
98
|
'@cmflow/cli/semantic/core/conditional', // run process.exit(0) if the branch is not a release branch - legacy: maybe not necessary now all task are conditional
|
|
99
99
|
{
|
|
100
100
|
when: (context) => context.branch.type !== 'release',
|
|
101
|
-
run: '@cmflow/cli/semantic/core/
|
|
101
|
+
run: '@cmflow/cli/semantic/core/exit'
|
|
102
102
|
}
|
|
103
103
|
]
|
|
104
104
|
],
|
|
@@ -172,6 +172,26 @@ Example:
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
```
|
|
175
|
+
Then:
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
export default defineConfig({
|
|
179
|
+
prepare: [
|
|
180
|
+
[
|
|
181
|
+
'@cmflow/cli/semantic/core/run',
|
|
182
|
+
{
|
|
183
|
+
command: 'build'
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
'@cmflow/cli/semantic/core/run',
|
|
188
|
+
{
|
|
189
|
+
command: 'test_e2e'
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
]
|
|
193
|
+
})
|
|
194
|
+
```
|
|
175
195
|
|
|
176
196
|
### Generate release.info file
|
|
177
197
|
|
|
@@ -202,33 +222,21 @@ import { defineConfig } from '@cmflow/cli'
|
|
|
202
222
|
|
|
203
223
|
export default defineConfig({
|
|
204
224
|
publish: [
|
|
205
|
-
[
|
|
206
|
-
'@cmflow/cli/semantic/conditional',
|
|
207
|
-
{
|
|
208
|
-
run: '@semantic-release/github'
|
|
209
|
-
}
|
|
210
|
-
],
|
|
211
225
|
'@cmflow/cli/semantic/docker/publish'
|
|
212
226
|
]
|
|
213
227
|
});
|
|
214
228
|
```
|
|
215
229
|
|
|
216
|
-
### Clean docker tags
|
|
230
|
+
### Publish & Clean docker tags
|
|
217
231
|
|
|
218
232
|
```js
|
|
219
233
|
import { defineConfig } from '@cmflow/cli'
|
|
220
234
|
|
|
221
235
|
export default defineConfig({
|
|
222
236
|
success: [
|
|
223
|
-
|
|
224
|
-
'@cmflow/cli/semantic/success',
|
|
225
|
-
{
|
|
226
|
-
runAfter: '@semantic-release/github' // only run if the conditional rule is true
|
|
227
|
-
}
|
|
228
|
-
],
|
|
229
|
-
'@cmflow/cli/semantic/docker/publish'
|
|
237
|
+
'@cmflow/cli/semantic/docker/success'
|
|
230
238
|
]
|
|
231
|
-
})
|
|
239
|
+
})
|
|
232
240
|
```
|
|
233
241
|
|
|
234
242
|
### Configure CI
|
package/package.json
CHANGED
package/release.config.mjs
CHANGED
|
@@ -31,7 +31,7 @@ export default defineConfig({
|
|
|
31
31
|
]
|
|
32
32
|
],
|
|
33
33
|
prepare: ["./src/semantic/core/prepare/bump-version.js", "./src/semantic/core/prepare/commit.js"],
|
|
34
|
-
publish: ["./src/semantic/core/
|
|
34
|
+
publish: ["./src/semantic/core/sync-repository.js", "@semantic-release/github"],
|
|
35
35
|
success: ["@semantic-release/github"],
|
|
36
36
|
fail: ["@semantic-release/github"],
|
|
37
37
|
npmPublish: false
|
|
@@ -25,7 +25,12 @@ async function runAll(step, pluginConfig, context, defaultCondition) {
|
|
|
25
25
|
|
|
26
26
|
const condition = pluginConfig.when !== undefined ? pluginConfig.when(context) : defaultCondition;
|
|
27
27
|
|
|
28
|
-
if (condition
|
|
28
|
+
if (!condition) {
|
|
29
|
+
context.logger.info(`Skip step "${step}" of plugin(s) "${pluginConfig.run}"`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (pluginConfig.run) {
|
|
29
34
|
const tasks = [].concat(pluginConfig.run);
|
|
30
35
|
|
|
31
36
|
for (const task of tasks) {
|
|
@@ -34,7 +39,15 @@ async function runAll(step, pluginConfig, context, defaultCondition) {
|
|
|
34
39
|
const taskFunction = mod[step];
|
|
35
40
|
|
|
36
41
|
if (taskFunction) {
|
|
37
|
-
|
|
42
|
+
context.logger.log(` Start conditional step "${step}" of plugin "${task}"`);
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
await taskFunction(pluginConfig, context);
|
|
46
|
+
context.logger.success(` Completed conditional step "${step}" of plugin "${task}"`);
|
|
47
|
+
} catch (er) {
|
|
48
|
+
context.logger.fail(` Fail conditional step "${step}" of plugin "${task}"`);
|
|
49
|
+
throw er;
|
|
50
|
+
}
|
|
38
51
|
}
|
|
39
52
|
}
|
|
40
53
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getConfig } from "../../common/index.js";
|
|
2
|
+
|
|
3
|
+
export default async function exit(_, context) {
|
|
4
|
+
context.config = getConfig();
|
|
5
|
+
// avoid next semantic-release steps when is a prerelease or release branch with SKIP_GITHUB_PUBLISH
|
|
6
|
+
context.logger.success("Skip next semantic-release steps");
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getConfig, npm, yarn } from "
|
|
1
|
+
import { getConfig, npm, yarn } from "../../common/index.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @param pluginConfig {{command: string}}
|
|
5
5
|
* @param context
|
|
6
6
|
* @return {Promise<void>}
|
|
7
7
|
*/
|
|
8
|
-
export async function
|
|
8
|
+
export default async function runCommand(pluginConfig, context) {
|
|
9
9
|
context.config = getConfig();
|
|
10
10
|
const {
|
|
11
11
|
config: { HAS_YARN },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getConfig, git } from "
|
|
1
|
+
import { getConfig, git } from "../../common/index.js";
|
|
2
2
|
|
|
3
|
-
export async function
|
|
3
|
+
export default async function syncRepository(pluginConfig, context) {
|
|
4
4
|
context.config = getConfig();
|
|
5
5
|
|
|
6
6
|
const {
|
|
@@ -30,34 +30,8 @@ export function defineConfig(opts = {}) {
|
|
|
30
30
|
generateNotes: ["@cmflow/cli/semantic/generate-notes"],
|
|
31
31
|
prepare: [
|
|
32
32
|
"@cmflow/cli/semantic/prepare/bump-version",
|
|
33
|
-
// '@cmflow/cli/semantic/prepare/build',
|
|
34
|
-
// '@cmflow/cli/semantic/prepare/e2e',
|
|
35
33
|
"@cmflow/cli/semantif/prepare/post" // need to avoid semantic next step
|
|
36
34
|
],
|
|
37
|
-
publish: [
|
|
38
|
-
[
|
|
39
|
-
"@cmflow/cli/semantic/publish",
|
|
40
|
-
{
|
|
41
|
-
runAfter: opts.runAfter
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
],
|
|
45
|
-
success: [
|
|
46
|
-
[
|
|
47
|
-
"@cmflow/cli/semantic/success",
|
|
48
|
-
{
|
|
49
|
-
runAfter: opts.runAfter
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
],
|
|
53
|
-
fail: [
|
|
54
|
-
[
|
|
55
|
-
"@cmflow/cli/semantic/fail",
|
|
56
|
-
{
|
|
57
|
-
runAfter: opts.runAfter
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
],
|
|
61
35
|
releaseRules,
|
|
62
36
|
parserOpts: {
|
|
63
37
|
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES"]
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { getConfig } from "../../../common/index.js";
|
|
2
|
-
|
|
3
|
-
export async function prepare(pluginConfig, context) {
|
|
4
|
-
context.config = getConfig();
|
|
5
|
-
// avoid next semantic-release steps when is a prerelease or release branch with SKIP_GITHUB_PUBLISH
|
|
6
|
-
process.exit(0);
|
|
7
|
-
}
|