Skip to content

Commit 8b828d8

Browse files
authored
Upgrade Dependencies (#28)
* Run npm audit * Update dependencies * Upgrade commander * Run lint-fix
1 parent 59916b1 commit 8b828d8

File tree

4 files changed

+3266
-1299
lines changed

4 files changed

+3266
-1299
lines changed

bin/markdown-to-jira

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const InputParser = require("../src/InputParser");
1414
const packageDetails = require(path.join(__dirname, "..", "package.json"));
1515

1616
let jira;
17+
let opts;
1718

1819
(async () => {
1920
// Allow for command line arguments
@@ -30,11 +31,13 @@ let jira;
3031
.option("-v, --verbose", "Show requests being made")
3132
.parse(process.argv);
3233

34+
opts = program.opts();
35+
3336
// Read the config file if it exists
3437
let credentials = {};
3538
try {
3639
credentials = await new Credentials("~/.atlassian/credentials").get(
37-
program.credentials
40+
opts.credentials
3841
);
3942
} catch (e) {
4043
console.log("Missing Credentials");
@@ -67,10 +70,10 @@ let jira;
6770
});
6871

6972
// A bit of a hack, but the endpoint isn't available in the SDK
70-
jira.fetchUsers = async function(list) {
73+
jira.fetchUsers = async function (list) {
7174
const users = {};
7275

73-
for (let user of list){
76+
for (let user of list) {
7477
const results = await this.doRequest(
7578
this.makeRequestHeader(
7679
this.makeUri({
@@ -83,7 +86,7 @@ let jira;
8386
)
8487
);
8588

86-
if (results.length != 1){
89+
if (results.length != 1) {
8790
throw new Error("Could not identify a single user for " + user);
8891
}
8992

@@ -93,17 +96,16 @@ let jira;
9396
return users;
9497
};
9598

96-
9799
let content = "";
98100

99101
// Is there a filename? If so read the content from there
100-
if (program.file) {
101-
content = fs.readFileSync(program.file);
102+
if (opts.file) {
103+
content = fs.readFileSync(opts.file);
102104
}
103105

104106
// If a string was provided, use that instead
105-
if (program.string) {
106-
content = "- " + program.string;
107+
if (opts.string) {
108+
content = "- " + opts.string;
107109
}
108110

109111
// Otherwise show an error
@@ -164,7 +166,7 @@ let jira;
164166

165167
for (t of tickets) {
166168
let parent = await createIssue(
167-
program.dry,
169+
opts.dry,
168170
credentials.project,
169171
t.title,
170172
t.description,
@@ -182,7 +184,7 @@ let jira;
182184
// If there are any children, create tickets using the parent key generated above
183185
for (c of t.children) {
184186
let child = await createIssue(
185-
program.dry,
187+
opts.dry,
186188
credentials.project,
187189
c.title,
188190
c.description,
@@ -237,8 +239,8 @@ function createIssue(
237239
}
238240

239241
// If we're in dry run mode, resolve early with a generated ID
240-
if (program.dry) {
241-
if (program.verbose) {
242+
if (opts.dry) {
243+
if (opts.verbose) {
242244
console.log(util.inspect(request.fields, false, 5));
243245
}
244246
let generatedKey = project + "-9999";

0 commit comments

Comments
 (0)