@cmflow/cli 1.0.16 → 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 +2 -2
- package/package.json +1 -1
- package/src/commands/start.js +26 -2
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
package/src/commands/start.js
CHANGED
|
@@ -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
|
-
|
|
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 [
|