* chore: update some deps

* chore: update husky lint hooks
This commit is contained in:
Shelley Vohr 2021-04-21 10:07:26 +02:00 коммит произвёл GitHub
Родитель d7d8bc370d
Коммит 500f6d7a27
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 2704 добавлений и 2455 удалений

1
.husky/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
_

4
.husky/pre-commit Executable file
Просмотреть файл

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

Просмотреть файл

@ -12,7 +12,8 @@
"prettier:write": "prettier --write \"src/**/*.ts\"",
"lint": "prettier --check \"src/**/*.ts\"",
"test": "jest --testPathIgnorePatterns=/working/ --testPathIgnorePatterns=/node_modules/",
"postinstall": "tsc"
"postinstall": "tsc",
"prepare": "husky install"
},
"dependencies": {
"@octokit/rest": "^16.35.2",
@ -30,30 +31,23 @@
"@types/bunyan": "^1.8.5",
"@types/express": "^4.17.2",
"@types/fs-extra": "^5.0.1",
"@types/jest": "^23.3.5",
"@types/jest": "^26.0.22",
"@types/node": "^10.17.9",
"@types/node-fetch": "^2.5.4",
"@types/sinon": "^5.0.5",
"husky": "^4.3.0",
"jest": "^23.6.0",
"husky": "^6.0.0",
"jest": "^26.6.3",
"lint-staged": "^10.4.2",
"prettier": "^2.0.5",
"sinon": "^7.5.0",
"smee-client": "^1.0.1",
"ts-jest": "^23.10.4",
"ts-jest": "^26.5.5",
"tslint": "^5.20.1",
"tslint-config-airbnb": "^5.11.2",
"typescript": "^3.7.3"
"typescript": "^4.2.4"
},
"lint-staged": {
"**/*.ts": [
"prettier --write **/*.ts"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
"**/*.ts": "prettier --write **/*.ts"
},
"engines": {
"node": ">= 7.7.0",

Просмотреть файл

@ -10,10 +10,7 @@ import { labelToTargetBranch, labelExistsOnPR } from './utils/label-utils';
import { CHECK_PREFIX, SKIP_CHECK_LABEL } from './constants';
import { getEnvVar } from './utils/env-util';
import { PRChange, PRStatus, BackportPurpose, CheckRunStatus } from './enums';
import {
ChecksListForRefResponseCheckRunsItem,
PullsGetResponse,
} from '@octokit/rest';
import { Octokit } from '@octokit/rest';
import {
backportToLabel,
backportToBranch,
@ -25,7 +22,7 @@ import { updateBackportValidityCheck } from './utils/checks-util';
const probotHandler = async (robot: Application) => {
const handleClosedPRLabels = async (
context: Context,
pr: PullsGetResponse,
pr: Octokit.PullsGetResponse,
change: PRChange,
) => {
for (const label of pr.labels) {
@ -38,7 +35,10 @@ const probotHandler = async (robot: Application) => {
}
};
const backportAllLabels = (context: Context, pr: PullsGetResponse) => {
const backportAllLabels = (
context: Context,
pr: Octokit.PullsGetResponse,
) => {
for (const label of pr.labels) {
context.payload.pull_request = context.payload.pull_request || pr;
backportToLabel(robot, context, label);
@ -47,7 +47,7 @@ const probotHandler = async (robot: Application) => {
const handleTropBackportClosed = async (
context: Context,
pr: PullsGetResponse,
pr: Octokit.PullsGetResponse,
change: PRChange,
) => {
const closeType = change === PRChange.MERGE ? 'merged' : 'closed';
@ -66,7 +66,7 @@ const probotHandler = async (robot: Application) => {
}
};
const runCheck = async (context: Context, pr: PullsGetResponse) => {
const runCheck = async (context: Context, pr: Octokit.PullsGetResponse) => {
const allChecks = await context.github.checks.listForRef(
context.repo({
ref: pr.head.sha,
@ -176,16 +176,16 @@ const probotHandler = async (robot: Application) => {
if (pr.base.ref !== 'master') {
if (!checkRun) {
robot.log(`Queueing new check run for #${pr.number}`);
checkRun = ((
await context.github.checks.create(
context.repo({
name: VALID_BACKPORT_CHECK_NAME,
head_sha: pr.head.sha,
status: 'queued' as 'queued',
details_url: 'https://github.com/electron/trop',
}),
)
).data as any) as ChecksListForRefResponseCheckRunsItem;
const response = await context.github.checks.create(
context.repo({
name: VALID_BACKPORT_CHECK_NAME,
head_sha: pr.head.sha,
status: 'queued' as 'queued',
details_url: 'https://github.com/electron/trop',
}),
);
checkRun = (response.data as any) as Octokit.ChecksListForRefResponseCheckRunsItem;
}
// If a branch is targeting something that isn't master it might not be a backport;
@ -330,7 +330,7 @@ const probotHandler = async (robot: Application) => {
// Backport pull requests to labeled targets when PR is merged.
robot.on('pull_request.closed', async (context: Context) => {
const pr: PullsGetResponse = context.payload.pull_request;
const pr: Octokit.PullsGetResponse = context.payload.pull_request;
const oldPRNumbers = getPRNumbersFromPRBody(pr, true);
if (pr.merged) {
if (oldPRNumbers.length > 0) {

Просмотреть файл

@ -1,4 +1,4 @@
import { PullsGetResponse } from '@octokit/rest';
import { Octokit } from '@octokit/rest';
import { Context } from 'probot';
import { BackportPurpose } from './enums';
@ -29,7 +29,7 @@ export interface TryBackportOptions {
context?: Context;
repoAccessToken: string;
purpose: BackportPurpose;
pr: PullsGetResponse;
pr: Octokit.PullsGetResponse;
dir: string;
slug: string;
targetBranch: string;

Просмотреть файл

@ -3,7 +3,7 @@ import { PRStatus, BackportPurpose, LogLevel } from '../enums';
import * as labelUtils from '../utils/label-utils';
import { log } from '../utils/log-util';
import { backportImpl } from '../utils';
import { PullsGetResponseLabelsItem } from '@octokit/rest';
import { Octokit } from '@octokit/rest';
/**
* Performs a backport to a specified label representing a branch.
@ -15,7 +15,7 @@ import { PullsGetResponseLabelsItem } from '@octokit/rest';
export const backportToLabel = async (
robot: Application,
context: Context,
label: PullsGetResponseLabelsItem,
label: Octokit.PullsGetResponseLabelsItem,
) => {
log(
'backportToLabel',

Просмотреть файл

@ -1,11 +1,5 @@
import { Application, Context } from 'probot';
import {
PullsGetResponse,
ChecksListForRefResponseCheckRunsItem,
PullsGetResponseBase,
ChecksUpdateParams,
PullsListCommitsResponseItem,
} from '@octokit/rest';
import { Octokit } from '@octokit/rest';
import fetch from 'node-fetch';
import * as fs from 'fs-extra';
import { IQueue } from 'queue';
@ -36,7 +30,7 @@ const { parse: parseDiff } = require('what-the-diff');
export const labelClosedPR = async (
context: Context,
pr: PullsGetResponse,
pr: Octokit.PullsGetResponse,
targetBranch: String,
change: PRChange,
) => {
@ -77,7 +71,7 @@ const tryBackportAllCommits = async (opts: TryBackportOptions) => {
await opts.context!.github.pulls.listCommits(
opts.context!.repo({ pull_number: opts.pr.number }),
)
).data.map((commit: PullsListCommitsResponseItem) => commit.sha);
).data.map((commit: Octokit.PullsListCommitsResponseItem) => commit.sha);
if (commits.length === 0) {
log(
@ -226,7 +220,7 @@ export const isAuthorizedUser = async (context: Context, username: string) => {
};
export const getPRNumbersFromPRBody = (
pr: PullsGetResponse,
pr: Octokit.PullsGetResponse,
checkNotBot = false,
) => {
const backportNumbers: number[] = [];
@ -263,7 +257,7 @@ export const getPRNumbersFromPRBody = (
*/
const getOriginalBackportNumber = async (
context: Context,
pr: PullsGetResponse,
pr: Octokit.PullsGetResponse,
) => {
let originalPR = pr;
let match: RegExpExecArray | null;
@ -290,7 +284,7 @@ const getOriginalBackportNumber = async (
export const isSemverMinorPR = async (
context: Context,
pr: PullsGetResponse,
pr: Octokit.PullsGetResponse,
) => {
log(
'isSemverMinorPR',
@ -328,7 +322,7 @@ const checkUserHasWriteAccess = async (context: Context, user: string) => {
const createBackportComment = async (
context: Context,
pr: PullsGetResponse,
pr: Octokit.PullsGetResponse,
) => {
const prNumber = await getOriginalBackportNumber(context, pr);
@ -387,7 +381,7 @@ export const backportImpl = async (
}
}
const base: PullsGetResponseBase = context.payload.pull_request.base;
const base: Octokit.PullsGetResponseBase = context.payload.pull_request.base;
const slug = `${base.repo.owner.login}/${base.repo.name}`;
const bp = `backport from PR #${context.payload.pull_request.number} to "${targetBranch}"`;
log('backportImpl', LogLevel.INFO, `Queuing ${bp} for "${slug}"`);
@ -401,7 +395,7 @@ export const backportImpl = async (
);
return allChecks.data.check_runs.find(
(run: ChecksListForRefResponseCheckRunsItem) => {
(run: Octokit.ChecksListForRefResponseCheckRunsItem) => {
return run.name === `${CHECK_PREFIX}${targetBranch}`;
},
);
@ -428,7 +422,7 @@ export const backportImpl = async (
const repoAccessToken = await getRepoToken(robot, context);
const pr: PullsGetResponse = context.payload.pull_request;
const pr: Octokit.PullsGetResponse = context.payload.pull_request;
// Set up empty repo on master.
const { dir } = await initRepo({
@ -662,7 +656,7 @@ export const backportImpl = async (
const checkRun = await getCheckRun();
if (checkRun) {
const mdSep = '``````````````````````````````';
const updateOpts: ChecksUpdateParams = context.repo({
const updateOpts: Octokit.ChecksUpdateParams = context.repo({
check_run_id: checkRun.id,
name: checkRun.name,
conclusion: 'neutral' as 'neutral',

Просмотреть файл

@ -1,10 +1,10 @@
import { Context } from 'probot';
import { CheckRunStatus } from '../enums';
import { ChecksListForRefResponseCheckRunsItem } from '@octokit/rest';
import { Octokit } from '@octokit/rest';
export async function updateBackportValidityCheck(
context: Context,
checkRun: ChecksListForRefResponseCheckRunsItem,
checkRun: Octokit.ChecksListForRefResponseCheckRunsItem,
statusItems: {
conclusion: CheckRunStatus;
title: string;

Просмотреть файл

@ -1,5 +1,5 @@
import { Context } from 'probot';
import { PullsGetResponseLabelsItem } from '@octokit/rest';
import { Octokit } from '@octokit/rest';
import { log } from './log-util';
import { LogLevel } from '../enums';
@ -41,7 +41,7 @@ export const removeLabel = async (
};
export const labelToTargetBranch = (
label: PullsGetResponseLabelsItem,
label: Octokit.PullsGetResponseLabelsItem,
prefix: string,
) => {
return label.name.replace(prefix, '');

5050
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу