@cmflow/cli 0.71.6 → 0.73.1

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.71.6",
3
+ "version": "0.73.1",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -104,7 +104,6 @@ export function getConfig () {
104
104
  REF_COMMIT,
105
105
  GH_TOKEN,
106
106
  HEROKU_APP,
107
- SKIP_DEPLOY,
108
107
  SKIP_GITHUB_PUBLISH,
109
108
  GITHUB_PAGES_PATH,
110
109
  REPOSITORY_URL,
@@ -154,13 +153,15 @@ export function getConfig () {
154
153
  } = process.env
155
154
  return DOCKER_REPOSITORY || `${OWNER || owner}/${PROJECT_NAME || projectName}`
156
155
  },
156
+ get SKIP_DEPLOY () {
157
+ return toBool(process.env.SKIP_DEPLOY)
158
+ },
157
159
  DOCKER_HUB_ID,
158
160
  DOCKER_HUB_PWD,
159
161
  HEROKU_APP,
160
162
  REF_COMMIT,
161
163
  GH_TOKEN,
162
164
  REPOSITORY_URL: get(pkg, 'repository.url', get(pkg, 'repository', REPOSITORY_URL)),
163
- SKIP_DEPLOY,
164
165
  SKIP_GITHUB_PUBLISH,
165
166
  GITHUB_PAGES_PATH,
166
167
  GIT_USER_NAME,
@@ -77,12 +77,16 @@ export async function prepare (pluginConfig, context) {
77
77
  logger.info('Start build task')
78
78
  await pkgManager.run('build')
79
79
  logger.info('Build task finished with success...')
80
+ } else {
81
+ logger.info('Skipping build task')
80
82
  }
81
83
 
82
84
  if (HAS_E2E && !SKIP_DEPLOY) {
83
85
  logger.info('Start test_e2e task')
84
86
  await pkgManager.run(E2E_CMD || 'test_e2e')
85
87
  logger.info('test_e2e task finished with success...')
88
+ } else {
89
+ logger.info('Skipping test_e2e task')
86
90
  }
87
91
 
88
92
  if (!SKIP_GITHUB_PUBLISH) {
@@ -2,26 +2,34 @@ import { docker } from '../../common'
2
2
  import { heroku } from '../../common/cli/heroku'
3
3
 
4
4
  export async function dockerPublish (context) {
5
- const { config: { DEPLOY_ON_DOCKER, DEPLOY_ON_HEROKU, SKIP_DEPLOY } } = context
5
+ const { logger, config: { DEPLOY_ON_DOCKER, DEPLOY_ON_HEROKU, SKIP_DEPLOY } } = context
6
6
 
7
7
  if (!SKIP_DEPLOY) {
8
8
  if (DEPLOY_ON_DOCKER) {
9
9
  await deployOnDockerHub(context)
10
+ } else {
11
+ logger.info('Skip docker publish')
10
12
  }
11
13
 
12
14
  if (DEPLOY_ON_HEROKU) {
13
15
  await deployOnHeroku(context)
16
+ } else {
17
+ logger.info('Skip heroku publish')
14
18
  }
19
+ } else {
20
+ logger.info('Skip docker/heroku publish')
15
21
  }
16
22
  }
17
23
 
18
24
  export async function deployOnDockerHub (context) {
19
- const { config: { PRODUCTION_BRANCH, DOCKER_REPOSITORY, DOCKER_HUB_ID, DOCKER_HUB_PWD } } = context
25
+ const { logger, config: { PRODUCTION_BRANCH, DOCKER_REPOSITORY, DOCKER_HUB_ID, DOCKER_HUB_PWD } } = context
20
26
 
21
27
  docker.login('-u', DOCKER_HUB_ID, '-p', DOCKER_HUB_PWD)
22
28
 
23
29
  const image = PRODUCTION_BRANCH === context.branch.name ? `${DOCKER_REPOSITORY}:${context.nextRelease.version}` : `${DOCKER_REPOSITORY}:${context.branch.name}`
24
-
30
+ logger.info('context.branch.name : ', context.branch.name)
31
+ logger.info('context.nextRelease.version : ', context.nextRelease && context.nextRelease.version)
32
+ logger.info('PRODUCTION_BRANCH : ', PRODUCTION_BRANCH)
25
33
  docker.tag(`${DOCKER_REPOSITORY}:latest`, image)
26
34
 
27
35
  await docker.push(image)
@@ -6,6 +6,10 @@ jest.mock('../../common')
6
6
  describe('dockerPublish', () => {
7
7
  it('should publish docker image', async () => {
8
8
  const context = {
9
+ logger: {
10
+ info: jest.fn(),
11
+ warn: jest.fn()
12
+ },
9
13
  branch: {
10
14
  name: 'branch-name'
11
15
  },
@@ -25,6 +29,10 @@ describe('dockerPublish', () => {
25
29
  })
26
30
  it('should do nothing', async () => {
27
31
  const context = {
32
+ logger: {
33
+ info: jest.fn(),
34
+ warn: jest.fn()
35
+ },
28
36
  branch: {
29
37
  name: 'branch-name'
30
38
  },