@cmflow/cli 2.0.0-alpha.13 → 2.0.0-alpha.15

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.
Binary file
package/README.md CHANGED
@@ -89,16 +89,15 @@ 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/publish/sync-repository',
92
+ '@cmflow/cli/semantic/core/sync-repository',
93
93
  '@semantic-release/github'
94
94
  ] // only run if the conditional rule is true
95
95
  }
96
96
  ],
97
97
  [
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
98
+ '@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
99
  {
100
- when: (context) => context.branch.type !== 'release',
101
- run: '@cmflow/cli/semantic/core/publish/exit'
100
+ when: (context) => context.nextRelease.channel === 'prerelease'
102
101
  }
103
102
  ]
104
103
  ],
@@ -172,6 +171,26 @@ Example:
172
171
  }
173
172
  }
174
173
  ```
174
+ Then:
175
+
176
+ ```javascript
177
+ export default defineConfig({
178
+ prepare: [
179
+ [
180
+ '@cmflow/cli/semantic/core/run',
181
+ {
182
+ command: 'build'
183
+ }
184
+ ],
185
+ [
186
+ '@cmflow/cli/semantic/core/run',
187
+ {
188
+ command: 'test_e2e'
189
+ }
190
+ ]
191
+ ]
192
+ })
193
+ ```
175
194
 
176
195
  ### Generate release.info file
177
196
 
@@ -202,33 +221,21 @@ import { defineConfig } from '@cmflow/cli'
202
221
 
203
222
  export default defineConfig({
204
223
  publish: [
205
- [
206
- '@cmflow/cli/semantic/conditional',
207
- {
208
- run: '@semantic-release/github'
209
- }
210
- ],
211
224
  '@cmflow/cli/semantic/docker/publish'
212
225
  ]
213
226
  });
214
227
  ```
215
228
 
216
- ### Clean docker tags
229
+ ### Publish & Clean docker tags
217
230
 
218
231
  ```js
219
232
  import { defineConfig } from '@cmflow/cli'
220
233
 
221
234
  export default defineConfig({
222
235
  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'
236
+ '@cmflow/cli/semantic/docker/success'
230
237
  ]
231
- });
238
+ })
232
239
  ```
233
240
 
234
241
  ### Configure CI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "2.0.0-alpha.13",
3
+ "version": "2.0.0-alpha.15",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -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/publish/sync-repository.js", "@semantic-release/github"],
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
@@ -0,0 +1,14 @@
1
+ import { getConfig } from "../../common/index.js";
2
+
3
+ export default async function exit(_, context) {
4
+ context.config = getConfig();
5
+ const condition = pluginConfig.when !== undefined ? pluginConfig.when(context) : true;
6
+
7
+ if (condition) {
8
+ // avoid next semantic-release steps when is a prerelease or release branch with SKIP_GITHUB_PUBLISH
9
+ context.logger.success("Skip next semantic-release steps");
10
+ process.exit(0);
11
+ } else {
12
+ context.logger.success("Continue next semantic-release steps");
13
+ }
14
+ }
@@ -1,11 +1,11 @@
1
- import { getConfig, npm, yarn } from "../../../common/index.js";
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 prepare(pluginConfig, context) {
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 "../../../common/index.js";
1
+ import { getConfig, git } from "../../common/index.js";
2
2
 
3
- export async function publish(pluginConfig, context) {
3
+ export default async function syncRepository(pluginConfig, context) {
4
4
  context.config = getConfig();
5
5
 
6
6
  const {
@@ -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
- }