@cmflow/cli 1.0.15 → 1.1.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/bin/cm-start.js CHANGED
@@ -6,8 +6,8 @@ import { commands, runCommand } from '../src/index.js'
6
6
  const options = {}
7
7
 
8
8
  commander
9
- .usage('cmstart [branchName]')
10
- .arguments('[branchName]')
9
+ .usage('cmstart [jiraId] [branchName]')
10
+ .arguments('[jiraId] [branchName]')
11
11
  .alias('cm start')
12
12
  .option('-v, --verbose', 'Enable verbose log', (v, t) => t + 1, 0)
13
13
  .action((branchName) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "1.0.15",
3
+ "version": "1.1.0",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "listr": "0.14.3",
42
42
  "lodash": "4.17.21",
43
43
  "rxjs": "7.8.1",
44
- "semantic-release": "24.0.0",
44
+ "semantic-release": "23.1.1",
45
45
  "semver": "7.3.7",
46
46
  "split": "1.0.1"
47
47
  },
@@ -49,20 +49,19 @@
49
49
  "eslint": "8.53.0",
50
50
  "eslint-config-standard": "17.1.0",
51
51
  "eslint-plugin-import": "2.29.0",
52
- "eslint-plugin-n": "16.3.0",
53
52
  "eslint-plugin-node": "11.1.0",
54
53
  "eslint-plugin-promise": "6.1.1",
55
54
  "eslint-plugin-standard": "5.0.0",
55
+ "eslint-plugin-n": "16.3.0",
56
56
  "husky": "4.3.6",
57
57
  "jest": "^29.7.0",
58
58
  "jest-junit": "^11.0.1",
59
59
  "lint-staged": "10.5.3"
60
60
  },
61
61
  "peerDependencies": {
62
- "conventional-changelog-writer": "^8.0.0",
63
- "@semantic-release/commit-analyzer": "^13.0.0",
62
+ "@semantic-release/commit-analyzer": "^11.1.0",
64
63
  "@semantic-release/github": "^10.1.1",
65
- "@semantic-release/release-notes-generator": "^14.0.1"
64
+ "@semantic-release/release-notes-generator": "^12.1.0"
66
65
  },
67
66
  "peerDependenciesMeta": {
68
67
  "@semantic-release/commit-analyzer": {
@@ -18,10 +18,21 @@ export class Start extends Fetch {
18
18
  .map(({ type }) => type)
19
19
  .find((t) => options.branchName.startsWith(`${t}-`))
20
20
 
21
+ if (!options.branchName && options.jiraId) {
22
+ options.branchName = options.jiraId
23
+ }
24
+
25
+ if (options.branchName.startsWith('CMAB-')) {
26
+ const [, key, ...rest] = options.branchName.split('-')
27
+ options.jiraId = `CMAB-${key}`
28
+ options.branchName = rest.join('-')
29
+ }
30
+
21
31
  return {
22
32
  ...context,
23
33
  useYarn: context.HAS_YARN,
24
34
  origin: context.ORIGIN,
35
+ jiraId: options.jiraId,
25
36
  branchName: options.branchName,
26
37
  type
27
38
  }
@@ -29,13 +40,20 @@ export class Start extends Fetch {
29
40
 
30
41
  prompt (context) {
31
42
  return [
43
+ {
44
+ type: 'input',
45
+ name: 'jiraId',
46
+ message: 'What is the Jira ID ? (leave blank to skip)',
47
+ default: context.jiraId,
48
+ when: !context.jiraId
49
+ },
32
50
  {
33
51
  type: 'list',
34
52
  name: 'type',
35
53
  message: 'Choose the type of your branch:',
36
54
  choices: ['fix', 'feat', 'chore', 'docs', 'tech'],
37
55
  default: context.type,
38
- when: !context.type
56
+ when: !context.type && !context.jiraId
39
57
  },
40
58
  {
41
59
  type: 'input',
@@ -62,7 +80,13 @@ export class Start extends Fetch {
62
80
 
63
81
  getTasks (context) {
64
82
  context.branchName = sanitize(context.branchName)
65
- context.featureBranch = context.branchName.includes(context.type + '-') ? context.branchName : `${context.type}-${context.branchName}`
83
+
84
+ context.featureBranch = context.jiraId
85
+ ? `${context.jiraId}-${context.branchName}`
86
+ : context.branchName.includes(context.type + '-')
87
+ ? context.branchName
88
+ : `${context.type}-${context.branchName}`
89
+
66
90
  context.fromBranch = context.fromBranch || context.PRODUCTION_BRANCH
67
91
 
68
92
  return [