bjira 0.0.14 → 0.0.15
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 +1 -1
- package/src/create.js +13 -0
package/package.json
CHANGED
package/src/create.js
CHANGED
|
@@ -33,6 +33,8 @@ class Create extends Command {
|
|
|
33
33
|
}
|
|
34
34
|
})));
|
|
35
35
|
|
|
36
|
+
const meta = await jira.spin('Retrieving issue metadata...',
|
|
37
|
+
jira.apiRequest(`/issue/createmeta?projectKeys=${project.key}&issuetypeNames=${issueType.name}&expand=projects.issuetypes.fields`));
|
|
36
38
|
const newIssue = {
|
|
37
39
|
fields: {
|
|
38
40
|
project: {
|
|
@@ -52,6 +54,17 @@ class Create extends Command {
|
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
const issueFields = meta.projects.find(p => p.key === project.key)
|
|
58
|
+
.issuetypes.find(i => i.name === issueType.name).fields;
|
|
59
|
+
const requiredFields = Object.keys(issueFields).filter(
|
|
60
|
+
key => issueFields[key].required &&
|
|
61
|
+
Field.isSupported(issueFields[key].schema.type) &&
|
|
62
|
+
!["summary", "description", "project"].includes(key)).map(key => issueFields[key]);
|
|
63
|
+
|
|
64
|
+
for (const field of requiredFields) {
|
|
65
|
+
newIssue.fields[field.key] = await Ask.askString(`${field.name}:`);
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
if (issueType.name !== 'Epic' &&
|
|
56
69
|
await Ask.askBoolean('Do you want to set a parent epic?')) {
|
|
57
70
|
const result = await Query.runQuery(jira, `project = "${project.key}" and type = "epic"`, 999999);
|