Skip to content

Commit

Permalink
Merge pull request #17 from lswith/deps
Browse files Browse the repository at this point in the history
Update deps to Latest
  • Loading branch information
lswith committed Aug 19, 2020
2 parents df86bb1 + e8405ba commit d0c5604
Show file tree
Hide file tree
Showing 10 changed files with 4,914 additions and 2,754 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,7 +1,6 @@
language: node_js
cache: npm
node_js:
- 8
- 10
- 12

Expand Down
7,578 changes: 4,868 additions & 2,710 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions package.json
Expand Up @@ -15,6 +15,9 @@
"type": "git",
"url": "git+https://github.com/lswith/probot-require-label.git"
},
"engines": {
"node": 12
},
"files": [
"lib"
],
Expand All @@ -30,23 +33,23 @@
"dependencies": {
"joi": "^14.3.1",
"probot": "^9.13.0",
"probot-config-manager": "^1.1.1"
"probot-config-manager": "^1.2.0"
},
"devDependencies": {
"@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^9.1.2",
"@commitlint/travis-cli": "^9.1.2",
"@types/jest": "^24.9.1",
"@types/jest": "^26.0.0",
"@types/joi": "^14.3.4",
"@types/node": "^12.12.54",
"husky": "^4.2.5",
"jest": "^24.9.0",
"nodemon": "^1.19.4",
"prettier": "^1.19.1",
"semantic-release": "^15.14.0",
"jest": "^26.0.0",
"nodemon": "^2.0.0",
"prettier": "^2.0.0",
"semantic-release": "^17.0.0",
"smee-client": "^1.2.2",
"ts-jest": "^24.3.0",
"tslint": "^5.20.1",
"ts-jest": "^26.0.0",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.3.0",
"typescript": "^3.9.7"
Expand Down
4 changes: 2 additions & 2 deletions src/__test__/fakecontext.ts
Expand Up @@ -23,9 +23,9 @@ export class FakeContext extends Context<any> {
return {
debug: (y: any) => {
return;
}
},
};
}
},
};
}

Expand Down
16 changes: 8 additions & 8 deletions src/__test__/fakeissueapi.ts
Expand Up @@ -16,9 +16,9 @@ export class FakeIssueApi {
}) {
this.top.labelsAdded.push(...params.labels);
this.top.labels.push(...params.labels);
return new Promise(resolve => {
return new Promise((resolve) => {
resolve({
data: []
data: [],
});
});
}
Expand All @@ -30,12 +30,12 @@ export class FakeIssueApi {
name: string;
}) {
this.top.labelsRemoved.push(params.name);
this.top.labels = this.top.labels.filter(flabel => {
this.top.labels = this.top.labels.filter((flabel) => {
return flabel !== params.name;
});
return new Promise(resolve => {
return new Promise((resolve) => {
resolve({
data: []
data: [],
});
});
}
Expand All @@ -45,13 +45,13 @@ export class FakeIssueApi {
repo: string;
issue_number: number;
}) {
return new Promise(resolve => {
return new Promise((resolve) => {
const labels: ILabel[] = [];
this.top.labels.forEach(label => {
this.top.labels.forEach((label) => {
labels.push({ name: label });
});
resolve({
data: labels
data: labels,
});
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/__test__/handler.pulls.test.ts
Expand Up @@ -10,7 +10,7 @@ it("adds needs-area label to pull request when a label doesn't match area:.* on
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toContain("needs-area");
});
});
Expand All @@ -23,7 +23,7 @@ it("doesn't add needs-area label to the pull request when needs-area label is al
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["needs-area"]);
expect(github.labelsAdded).toEqual([]);
});
Expand All @@ -37,7 +37,7 @@ it("doesn't add needs-area label to the pull request when a label matching area/
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["area:test"]);
expect(github.labelsAdded).toEqual([]);
});
Expand All @@ -55,7 +55,7 @@ it("removes needs-area label on the pull request when a label matching area/.* e
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["area:test"]);
expect(github.labelsRemoved).toEqual(["needs-area"]);
});
Expand All @@ -73,7 +73,7 @@ it("doesn't remove needs-area label on then pull request when a label doesn't ma
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["test:test", "needs-area"]);
expect(github.labelsRemoved).toEqual([]);
});
Expand Down
10 changes: 5 additions & 5 deletions src/__test__/handler.test.ts
Expand Up @@ -10,7 +10,7 @@ it("adds needs-area label to Issue when a label doesn't match area:.* on the iss
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toContain("needs-area");
});
});
Expand All @@ -23,7 +23,7 @@ it("doesn't add needs-area label to the issue when needs-area label is already o
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["needs-area"]);
expect(github.labelsAdded).toEqual([]);
});
Expand All @@ -37,7 +37,7 @@ it("doesn't add needs-area label to the issue when a label matching area/.* is o
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["area:test"]);
expect(github.labelsAdded).toEqual([]);
});
Expand All @@ -55,7 +55,7 @@ it("removes needs-area label on the issue when a label matching area/.* exists o
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["area:test"]);
expect(github.labelsRemoved).toEqual(["needs-area"]);
});
Expand All @@ -73,7 +73,7 @@ it("doesn't remove needs-area label on then issue when a label doesn't match are
context,
[{ missingLabel: "needs-area", regex: "area:.*" }],
1
).then(resp => {
).then((resp) => {
expect(github.labels).toEqual(["test:test", "needs-area"]);
expect(github.labelsRemoved).toEqual([]);
});
Expand Down
12 changes: 6 additions & 6 deletions src/handler.ts
Expand Up @@ -3,7 +3,7 @@ import { hasMatchingLabel, hasMissingLabel, ILabel } from "./labels";
import { ILabelMatch } from "./models";

function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
return new Promise((resolve) => setTimeout(resolve, ms));
}

export async function handle(
Expand All @@ -25,7 +25,7 @@ export async function handle(
owner: owner,
repo: repo,
issue: issueNumber,
app: "probot-require-label"
app: "probot-require-label",
});

if (!context.payload.label) {
Expand All @@ -41,9 +41,9 @@ export async function handle(
.listLabelsOnIssue({
repo: repo,
owner: owner,
issue_number: issueNumber
issue_number: issueNumber,
})
.then(resp => {
.then((resp) => {
labels = resp.data;
})
.catch((err: any) => {
Expand All @@ -67,7 +67,7 @@ export async function handle(
owner: owner,
repo: repo,
issue_number: issueNumber,
labels: [l.missingLabel]
labels: [l.missingLabel],
})
.catch((err: any) => {
throw new Error(
Expand All @@ -87,7 +87,7 @@ export async function handle(
owner: owner,
repo: repo,
issue_number: issueNumber,
name: l.missingLabel
name: l.missingLabel,
})
.catch((err: any) => {
throw new Error(
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Expand Up @@ -12,7 +12,7 @@ module.exports = async (app: Application) => {
"pull_request.opened",
"pull_request.reopened",
"pull_request.labeled",
"pull_request.unlabeled"
"pull_request.unlabeled",
];
const configManager = new ConfigManager<IConfig>("relabel.yml", {}, schema);
app.log.info("probot-require-label loaded");
Expand All @@ -26,10 +26,10 @@ module.exports = async (app: Application) => {
owner: owner,
repo: repo,
issue: inumber,
app: "probot-require-label"
app: "probot-require-label",
});
logger.debug("Getting Config");
const config = await configManager.getConfig(context).catch(err => {
const config = await configManager.getConfig(context).catch((err) => {
logger.error(err);
return {} as IConfig;
});
Expand All @@ -45,14 +45,14 @@ module.exports = async (app: Application) => {
if (eventType) {
logger.debug("Config exists");
logger.debug(config);
await handle(context, eventType!, 30000).catch(err => {
await handle(context, eventType!, 30000).catch((err) => {
logger.warn(err);
});
logger.debug("Handled");
}
});

app.on("*", async context => {
app.on("*", async (context) => {
context.log.debug({ event: context.event, action: context.payload.action });
});
};
8 changes: 4 additions & 4 deletions src/models.ts
Expand Up @@ -27,19 +27,19 @@ export const schema = Joi.object().keys({
issues: Joi.array().items(
Joi.object().keys({
missingLabel: Joi.string(),
regex: Joi.string()
regex: Joi.string(),
})
),
pulls: Joi.array().items(
Joi.object().keys({
missingLabel: Joi.string(),
regex: Joi.string()
regex: Joi.string(),
})
),
requiredLabels: Joi.array().items(
Joi.object().keys({
missingLabel: Joi.string(),
regex: Joi.string()
regex: Joi.string(),
})
)
),
});

0 comments on commit d0c5604

Please sign in to comment.