Skip to content

Commit

Permalink
Merge pull request #54 from bradgarropy/bugs
Browse files Browse the repository at this point in the history
🐞 bugs
  • Loading branch information
bradgarropy committed Jan 22, 2020
2 parents 1d31efd + 74f47c3 commit fc68978
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "labman",
"version": "0.9.1",
"version": "0.9.2",
"description": "πŸ‘¨πŸΌβ€πŸ”¬ github label manager cli",
"keywords": [
"github",
Expand Down
4 changes: 1 addition & 3 deletions src/cli/default.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const conf = require("conf")
const config = require("../config")
const {repoAutocomplete} = require("../utils")
const {
errorTokenNotFound,
Expand All @@ -14,8 +14,6 @@ const {
createLabels,
} = require("../github")

const config = new conf()

const command = "* <source> <destination> [labels...]"
const description = "Copy issue labels from one repo to another"

Expand Down
4 changes: 1 addition & 3 deletions src/cli/login.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const conf = require("conf")
const chalk = require("chalk")
const config = require("../config")
const {validToken} = require("../github")
const {errorLoginFailed} = require("../errors")

const config = new conf()

const command = "login <username> <token>"
const description = "Persist GitHub credentials"

Expand Down
4 changes: 1 addition & 3 deletions src/cli/logout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const conf = require("conf")
const chalk = require("chalk")

const config = new conf()
const config = require("../config")

const command = "logout"
const description = "Remove GitHub credentials"
Expand Down
10 changes: 10 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const conf = require("conf")
const {name} = require("../package.json")

const options = {
projectName: name,
}

const config = new conf(options)

module.exports = config
4 changes: 1 addition & 3 deletions src/tests/cli/default.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const conf = require("conf")
const config = require("../../config")
const {handler: logoutHandler} = require("../../cli/logout")
const {handler: defaultHandler} = require("../../cli/default")
const {
Expand All @@ -19,8 +19,6 @@ jest.mock("../../github")

beforeEach(() => logoutHandler())

const config = new conf()

describe("default", () => {
test("token not found", async () => {
const args = {
Expand Down
4 changes: 1 addition & 3 deletions src/tests/cli/login.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const conf = require("conf")
const config = require("../../config")
const {validToken} = require("../../github")
const {errorLoginFailed} = require("../../errors")
const {handler: loginHandler} = require("../../cli/login")
Expand All @@ -9,8 +9,6 @@ jest.mock("../../github")

beforeEach(() => logoutHandler())

const config = new conf()

describe("login", () => {
test("valid token", async () => {
validToken.mockImplementation(() => true)
Expand Down
4 changes: 1 addition & 3 deletions src/tests/cli/logout.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const conf = require("conf")
const config = require("../../config")
const {handler} = require("../../cli/logout")

const config = new conf()

describe("logout", () => {
test("logout", () => {
const stored = {
Expand Down
8 changes: 8 additions & 0 deletions src/tests/config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const config = require("../config")
const {name} = require("../../package.json")

describe("config", () => {
test("config", () => {
expect(config).toHaveProperty("path", expect.stringContaining(name))
})
})
4 changes: 1 addition & 3 deletions src/tests/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const conf = require("conf")
const config = require("../config")
const {repoPath, repoObject, repoAutocomplete} = require("../utils")

const config = new conf()

describe("repo path", () => {
test("object", () => {
const object = {
Expand Down
3 changes: 1 addition & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const conf = require("conf")
const config = require("./config")

const repoPath = object => {
const {owner, repo} = object
Expand Down Expand Up @@ -34,7 +34,6 @@ const repoAutocomplete = repo => {
return repo
}

const config = new conf()
const owner = config.get("username")

const autocompleted = `${owner}/${repo}`
Expand Down

0 comments on commit fc68978

Please sign in to comment.