@cmflow/cli 0.76.1 → 1.0.0

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.76.1",
3
+ "version": "1.0.0",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "has-yarn": "^2.1.0",
41
41
  "inquirer": "7.3.3",
42
42
  "listr": "0.14.3",
43
- "lodash": "4.17.20",
43
+ "lodash": "4.17.21",
44
44
  "rxjs": "6.6.3",
45
45
  "semantic-release": "22.0.7",
46
46
  "semver": "7.3.7",
@@ -60,9 +60,9 @@
60
60
  "lint-staged": "10.5.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@semantic-release/commit-analyzer": ">=9.0.2",
64
- "@semantic-release/github": ">=8.0.5",
65
- "@semantic-release/release-notes-generator": ">=9.0.1"
63
+ "@semantic-release/commit-analyzer": "^11.1.0",
64
+ "@semantic-release/github": "^9.2.1",
65
+ "@semantic-release/release-notes-generator": "^12.1.0"
66
66
  },
67
67
  "peerDependenciesMeta": {
68
68
  "@semantic-release/commit-analyzer": {
package/release.config.js CHANGED
@@ -1,9 +1,12 @@
1
+ import { getConfig } from './src/index.js'
2
+
1
3
  process.env.PRODUCTION_BRANCH = 'master'
2
4
  process.env.DEVELOP_BRANCH = 'master'
3
5
  process.env.DEPLOY_ON_DOCKER = 'false'
6
+ const config = getConfig()
4
7
 
5
8
  export default {
6
- branch: 'master',
9
+ branches: ['master', { name: config.BRANCH_NAME, prerelease: true }],
7
10
  plugins: [
8
11
  './semantic'
9
12
  ],
@@ -1,11 +1,14 @@
1
1
  import * as commitAnalyzerPlugins from '@semantic-release/commit-analyzer'
2
2
  import { calculateSnapshotVersion } from '../utils/calculate-snapshot-version.js'
3
3
 
4
- export function analyzeCommits (pluginConfig, context) {
4
+ export async function analyzeCommits (pluginConfig, context) {
5
5
  if (context.branch && context.branch.type !== 'prerelease') {
6
6
  return commitAnalyzerPlugins.analyzeCommits(pluginConfig, context)
7
7
  }
8
+ const analyzedCommits = await commitAnalyzerPlugins.analyzeCommits(pluginConfig, context)
9
+ context.nextRelease = context.nextRelease || {}
10
+ context.nextRelease.type = analyzedCommits
8
11
  context.nextRelease.version = calculateSnapshotVersion(context)
9
12
  context.lastRelease.version = null
10
- return 'patch' // always trigger patch for prerelease
13
+ return analyzedCommits
11
14
  }
@@ -1,7 +1,8 @@
1
1
  import semver from 'semver'
2
- import { git } from '../../common/index.js'
2
+ import { getConfig, git } from '../../common/index.js'
3
3
 
4
4
  export function calculateSnapshotVersion (context) {
5
+ context.config = getConfig()
5
6
  const { nextRelease: { type }, lastRelease, config: { REF_COMMIT } } = context
6
7
  const { major, minor, patch } = semver.parse(lastRelease.version)
7
8
 
@@ -1,27 +1,32 @@
1
1
  import { beforeEach, describe, expect, it, jest } from '@jest/globals'
2
2
 
3
- jest.unstable_mockModule('../../common', () => {
3
+ jest.unstable_mockModule('../../common/index.js', () => {
4
4
  return {
5
5
  git: {
6
6
  getCommitTag: jest.fn()
7
- }
7
+ },
8
+ getConfig: jest.fn()
8
9
  }
9
10
  })
10
- const { git } = await import('../../common/index.js')
11
+ const { git, getConfig } = await import('../../common/index.js')
11
12
  const { calculateSnapshotVersion } = await import('./calculate-snapshot-version.js')
12
13
 
13
14
  describe('calculateSnapshotVersion', () => {
14
15
  beforeEach(() => {
15
16
  git.getCommitTag.mockReturnValue('13246u')
17
+ getConfig.mockReturnValue({
18
+ DEPLOY_ON_DOCKER: true,
19
+ PRODUCTION_BRANCH: 'production',
20
+ DOCKER_REPOSITORY: 'owner',
21
+ DOCKER_HUB_ID: 'login',
22
+ DOCKER_HUB_PWD: 'password'
23
+ })
16
24
  })
17
25
  it('should return the snapshot version', () => {
18
26
  const context = {
19
27
  nextRelease: { type: 'patch' },
20
28
  lastRelease: {
21
29
  version: '1.0.0'
22
- },
23
- config: {
24
- REF_COMMIT: 'REF_COMMIT'
25
30
  }
26
31
  }
27
32