@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "0.65.3",
3
+ "version": "0.65.6",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -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 { getConfig, git } from '../common'
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 [mergeBranch(context)]
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
- // eslint-disable-next-line no-console
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
- // 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`)
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.start('Checkout production branch')
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.success(`Current branch: ${PRODUCTION_BRANCH}`)
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.start(`Merge ${branch.name} into ${PRODUCTION_BRANCH} branch`)
38
+ logger.info(`Merge ${branch.name} into ${PRODUCTION_BRANCH} branch`)
39
39
  git.merge('--no-ff', '-m', `${branch.name}`, branch.name)
40
- logger.success(`${branch.name} merged into ${PRODUCTION_BRANCH} branch`)
40
+ logger.info(`${branch.name} merged into ${PRODUCTION_BRANCH} branch`)
41
41
 
42
42
  setGHToken(context)
43
43
 
44
- logger.start(`Push ${PRODUCTION_BRANCH} branch`)
44
+ logger.info(`Push ${PRODUCTION_BRANCH} branch`)
45
45
  await git.push(ORIGIN, PRODUCTION_BRANCH)
46
- logger.success(`${PRODUCTION_BRANCH} branch pushed`)
46
+ logger.info(`${PRODUCTION_BRANCH} branch pushed`)
47
47
 
48
- logger.start(`Remove ${ORIGIN}/${branch.name} branch`)
48
+ logger.info(`Remove ${ORIGIN}/${branch.name} branch`)
49
49
  await git.push(ORIGIN, ':' + branch.name)
50
- logger.success(`${ORIGIN}/${branch.name} branch correctly removed`)
50
+ logger.info(`${ORIGIN}/${branch.name} branch correctly removed`)
51
51
  }
52
52
 
53
53
  export function mergeBranch (context) {
@@ -26,7 +26,7 @@ class NpmCli extends Cli {
26
26
  * @returns {Promise<unknown>}
27
27
  */
28
28
  restore () {
29
- return super.run('install', '--no-package-lock', '--no-production')
29
+ return super.run('ci')
30
30
  }
31
31
  }
32
32
 
@@ -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
- ...getConfig(),
20
+ ...config,
21
+ branch: { name: config.BRANCH_NAME },
22
+ config,
23
+ logger: console,
20
24
  verbose: commander.verbose
21
25
  }
22
26