Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: minor code refactor #184

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bin/good-first-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

const cli = require('commander')
const chalk = require('chalk')
const opn = require('open')
const open = require('open')
const gfi = require('libgfi')

const packageJSON = require('../package.json')
const { description, version } = require('../package.json')
const log = require('../lib/log')
const prompt = require('../lib/prompt')
const projects = require('../data/projects.json')

cli
.version(packageJSON.version, '-v, --version')
.description(packageJSON.description)
.version(version, '-v, --version')
.description(description)
.arguments('[project]')
.option('-o, --open', 'Open in browser')
.option('-f, --first', 'Return first/top issue')
Expand Down Expand Up @@ -50,7 +50,7 @@ cli
console.log(output.toString())

if (cmd.open) {
opn(issues[key].url)
open(issues[key].url)
process.exitCode = 0
}
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions lib/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ module.exports = async function () {
name = `${projects[key].name}${projects[key].description ? ' - ' + projects[key].description : ''}`
return { value: key, name }
})
const a = await inquirer.prompt([
const { project } = await inquirer.prompt([
{
type: 'list',
name: 'project',
message: 'Choose a project:',
choices: projectNames
}
])
return a.project
return project
}
5 changes: 2 additions & 3 deletions tests/markdown.config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ function getProjectsFromReadme() {
startOfClosingTagIndex)

const regex = /\d+\.\|(.*)\|`(.*)`\|/gm;
var match = regex.exec(table)
let match = regex.exec(table)

const projects = {};
while (match != null) {
let project = match[2]
let name = match[1]
const [, name, project] = match
projects[project] = { name }

match = regex.exec(table)
Expand Down