@cmflow/cli 0.65.2 → 0.65.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "0.65.2",
3
+ "version": "0.65.3",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
3
  import { mergeBranch } from './tasks/merge-branch'
4
- import { getConfig } from '../common'
4
+ import { getConfig, git } from '../common'
5
5
 
6
6
  export class Merge {
7
7
  mapContext (commander, context) {
@@ -12,13 +12,22 @@ export class Merge {
12
12
  }
13
13
 
14
14
  getTasks (context) {
15
- return [
16
- mergeBranch(context)
17
- ]
15
+ const { RELEASE_CANDIDATE_TAG } = context
16
+ this.lastCommitMessage = git.getLastCommitMsg()
17
+ if (this.lastCommitMessage.includes(RELEASE_CANDIDATE_TAG)) {
18
+ return [mergeBranch(context)]
19
+ }
20
+ return []
18
21
  }
19
22
 
20
23
  success (context) {
21
- // eslint-disable-next-line no-console
22
- console.log(chalk.green(figures.tick), 'Branch', chalk.green(context.BRANCH_NAME), `merged into ${context.PRODUCTION_BRANCH} if necessary`)
24
+ const { RELEASE_CANDIDATE_TAG } = context
25
+ if (this.lastCommitMessage.includes(RELEASE_CANDIDATE_TAG)) {
26
+ // eslint-disable-next-line no-console
27
+ console.log(chalk.green(figures.tick), 'Branch', chalk.green(context.BRANCH_NAME), `merged into ${context.PRODUCTION_BRANCH}`)
28
+ } else {
29
+ // eslint-disable-next-line no-console
30
+ console.log(chalk.green(figures.tick), 'Merge branch', chalk.green(context.BRANCH_NAME), `into ${context.PRODUCTION_BRANCH} not required`)
31
+ }
23
32
  }
24
33
  }
@@ -51,14 +51,11 @@ async function gitMep (context) {
51
51
  }
52
52
 
53
53
  export function mergeBranch (context) {
54
- const { BRANCH_NAME, RELEASE_CANDIDATE_TAG, PRODUCTION_BRANCH } = context
54
+ const { BRANCH_NAME, PRODUCTION_BRANCH } = context
55
55
  return ({
56
- title: `Merge ${BRANCH_NAME} into ${PRODUCTION_BRANCH} if necessary`,
56
+ title: `Merge ${BRANCH_NAME} into ${PRODUCTION_BRANCH}`,
57
57
  task: async () => {
58
- const lastCommitMessage = git.getLastCommitMsg()
59
- if (lastCommitMessage.includes(RELEASE_CANDIDATE_TAG)) {
60
- await gitMep(context)
61
- }
58
+ await gitMep(context)
62
59
  }
63
60
  })
64
61
  }