@cmflow/cli 0.65.3 → 0.65.6
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
package/src/commands/merge.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import figures from 'figures'
|
|
3
3
|
import { mergeBranch } from './tasks/merge-branch'
|
|
4
|
-
import {
|
|
4
|
+
import { configureGitWorkspace, git } from '../common'
|
|
5
5
|
|
|
6
6
|
export class Merge {
|
|
7
|
-
mapContext (commander, context) {
|
|
8
|
-
return {
|
|
9
|
-
...context,
|
|
10
|
-
config: getConfig()
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
getTasks (context) {
|
|
15
8
|
const { RELEASE_CANDIDATE_TAG } = context
|
|
16
9
|
this.lastCommitMessage = git.getLastCommitMsg()
|
|
17
10
|
if (this.lastCommitMessage.includes(RELEASE_CANDIDATE_TAG)) {
|
|
18
|
-
return [
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
title: 'Configure workspace',
|
|
14
|
+
task: () => configureGitWorkspace(context)
|
|
15
|
+
},
|
|
16
|
+
mergeBranch(context)
|
|
17
|
+
]
|
|
19
18
|
}
|
|
20
19
|
return []
|
|
21
20
|
}
|
|
@@ -23,11 +22,10 @@ export class Merge {
|
|
|
23
22
|
success (context) {
|
|
24
23
|
const { RELEASE_CANDIDATE_TAG } = context
|
|
25
24
|
if (this.lastCommitMessage.includes(RELEASE_CANDIDATE_TAG)) {
|
|
26
|
-
|
|
27
|
-
console.log(chalk.green(figures.tick), 'Branch', chalk.green(context.BRANCH_NAME), `merged into ${context.PRODUCTION_BRANCH}`)
|
|
25
|
+
context.logger.info(chalk.green(figures.tick), 'Branch', chalk.green(context.BRANCH_NAME), `merged into ${context.PRODUCTION_BRANCH}`)
|
|
28
26
|
} else {
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
context.logger.info(chalk.green(figures.tick), 'Merge branch', chalk.green(context.BRANCH_NAME), `into ${context.PRODUCTION_BRANCH} not required`)
|
|
28
|
+
context.logger.info(chalk.green(figures.tick), 'Last commit message : ', chalk.green(this.lastCommitMessage), `does not contains ${RELEASE_CANDIDATE_TAG}`)
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
31
|
}
|
|
@@ -23,31 +23,31 @@ async function gitMep (context) {
|
|
|
23
23
|
git.reset('--hard')
|
|
24
24
|
git.clean('-f', '-d').sync()
|
|
25
25
|
|
|
26
|
-
logger.
|
|
26
|
+
logger.info('Checkout production branch')
|
|
27
27
|
|
|
28
28
|
git.config('--replace-all', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*')
|
|
29
29
|
git.fetch().sync()
|
|
30
30
|
git.fetch('--tags').sync()
|
|
31
31
|
git.checkout('-qf', PRODUCTION_BRANCH).sync()
|
|
32
32
|
|
|
33
|
-
logger.
|
|
33
|
+
logger.info(`Current branch: ${PRODUCTION_BRANCH}`)
|
|
34
34
|
|
|
35
35
|
const building = git.getLastCommitMsg()
|
|
36
36
|
logger.info('Last commit message on production', building)
|
|
37
37
|
|
|
38
|
-
logger.
|
|
38
|
+
logger.info(`Merge ${branch.name} into ${PRODUCTION_BRANCH} branch`)
|
|
39
39
|
git.merge('--no-ff', '-m', `${branch.name}`, branch.name)
|
|
40
|
-
logger.
|
|
40
|
+
logger.info(`${branch.name} merged into ${PRODUCTION_BRANCH} branch`)
|
|
41
41
|
|
|
42
42
|
setGHToken(context)
|
|
43
43
|
|
|
44
|
-
logger.
|
|
44
|
+
logger.info(`Push ${PRODUCTION_BRANCH} branch`)
|
|
45
45
|
await git.push(ORIGIN, PRODUCTION_BRANCH)
|
|
46
|
-
logger.
|
|
46
|
+
logger.info(`${PRODUCTION_BRANCH} branch pushed`)
|
|
47
47
|
|
|
48
|
-
logger.
|
|
48
|
+
logger.info(`Remove ${ORIGIN}/${branch.name} branch`)
|
|
49
49
|
await git.push(ORIGIN, ':' + branch.name)
|
|
50
|
-
logger.
|
|
50
|
+
logger.info(`${ORIGIN}/${branch.name} branch correctly removed`)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export function mergeBranch (context) {
|
package/src/common/cli/npm.js
CHANGED
|
@@ -14,9 +14,13 @@ function createTasksRunner (tasks, ctx) {
|
|
|
14
14
|
|
|
15
15
|
export async function runCommand (klass, commander) {
|
|
16
16
|
try {
|
|
17
|
+
const config = getConfig()
|
|
17
18
|
let context = {
|
|
18
19
|
...getReleaseConfig(),
|
|
19
|
-
...
|
|
20
|
+
...config,
|
|
21
|
+
branch: { name: config.BRANCH_NAME },
|
|
22
|
+
config,
|
|
23
|
+
logger: console,
|
|
20
24
|
verbose: commander.verbose
|
|
21
25
|
}
|
|
22
26
|
|