Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Re-up deps #498

Merged
merged 4 commits into from
May 13, 2024
Merged
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
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
node-version: '20.x'
- run: npm install
- run: npm run lint
# - run: npx knip
- run: npx knip
test:
runs-on: ubuntu-latest
steps:
Expand All @@ -22,3 +22,9 @@ jobs:
- run: npm install
- run: npm run build
- run: npm test
- run: npm prune --production
- run: |
export BOT_AUTH_TOKEN=secret
for i in dist/functions/*.js; do
node $i;
done
5,463 changes: 2,906 additions & 2,557 deletions package-lock.json

Large diffs are not rendered by default.

59 changes: 31 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,40 @@
"url": "https://github.com/DefinitelyTyped/dt-mergebot/issues"
},
"license": "MIT",
"engines": {
"node": ">=18"
},
"dependencies": {
"@apollo/client": "latest",
"@azure/functions": "^4.0.0-alpha.1",
"@apollo/client": "^3.10.3",
"@azure/functions": "^4.4.0",
"@definitelytyped/old-header-parser": "npm:@definitelytyped/header-parser@0.0.178",
"@definitelytyped/utils": "^0.1.5",
"@octokit/webhooks": "^9.5.1",
"dayjs": "^1.10.3",
"fast-json-patch": "^3.0.0-1",
"fs-extra": "^9.0.1",
"@definitelytyped/utils": "^0.1.6",
"@octokit/webhooks-methods": "^4.1.0",
"dayjs": "^1.11.11",
"fast-json-patch": "^3.1.1",
"graphql": "15.8.0",
"node-fetch": "^2.6.1",
"prettyjson": "^1.2.1",
"yargs": "^17.0.1"
"prettyjson": "^1.2.5",
"yargs": "^17.7.2"
},
"devDependencies": {
"@endemolshinegroup/cosmiconfig-typescript-loader": "^3.0.2",
"@octokit/graphql-schema": "^10.11.0",
"@types/fs-extra": "^4.0.11",
"@types/jest": "^29.5.1",
"@types/node": "18.x",
"@types/node-fetch": "^2.5.7",
"@types/prettyjson": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"apollo": "latest",
"azure-functions-core-tools": "^4.x",
"eslint": "^8.51.0",
"eslint-plugin-unicorn": "^48.0.1",
"jest": "^29.5.0",
"@octokit/graphql-schema": "^14.58.0",
"@octokit/webhooks-types": "^7.5.1",
"@types/jest": "^29.5.12",
"@types/node": "^18.19.33",
"@types/prettyjson": "^0.0.33",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"apollo": "^2.34.0",
"azure-functions-core-tools": "^4.0.5700",
"eslint": "^8.57.0",
"eslint-plugin-unicorn": "^52.0.0",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"jest-file-snapshot": "^0.5.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
"knip": "^5.15.1",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"
},
"overrides": {
"apollo": {
Expand All @@ -59,7 +61,7 @@
"prepublishOnly": "npm run build",
"build": "tsc",
"watch": "tsc --watch",
"graphql-schema": "npx apollo client:codegen schema --target typescript --globalTypesFile=src/queries/schema/graphql-global-types.ts",
"graphql-schema": "apollo client:codegen schema --target typescript --globalTypesFile=src/queries/schema/graphql-global-types.ts",
"create-fixture": "npm run build && node dist/commands/create-fixture.js",
"update-test-data": "npm run build && node dist/commands/update-test-data.js",
"update-all-fixtures": "npm run build && node dist/commands/update-all-fixtures.js",
Expand All @@ -74,5 +76,6 @@
"/node_modules/",
"/dist/"
]
}
},
"packageManager": "npm@10.7.0+sha256.f443ed4364ea11ac5cf7cae7fb4731278c64dd6839093f8a46eabde0430e0fcd"
}
4 changes: 2 additions & 2 deletions src/_tests/fixturedActions.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ApolloQueryResult } from "@apollo/client/core";
import { readdirSync, readJsonSync } from "fs-extra";
import { readdirSync } from "fs";
import { join } from "path";
import { toMatchFile } from "jest-file-snapshot";
import { process } from "../compute-pr-actions";
import { deriveStateForPR } from "../pr-info";
import { PR } from "../queries/schema/PR";
import { scrubDiagnosticDetails } from "../util/util";
import { readJsonSync, scrubDiagnosticDetails } from "../util/util";
import * as cachedQueries from "./cachedQueries.json";
jest.mock("../util/cachedQueries", () => ({
getProjectBoardColumns: jest.fn(() => cachedQueries.getProjectBoardColumns),
Expand Down
5 changes: 3 additions & 2 deletions src/commands/create-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import * as computeActions from "../compute-pr-actions";
import { getPRInfo } from "../queries/pr-query";
import { deriveStateForPR } from "../pr-info";
import { ApolloQueryResult } from "@apollo/client/core";
import { writeFileSync, mkdirSync, existsSync, readJsonSync } from "fs-extra";
import { writeFileSync, mkdirSync, existsSync } from "fs";
import { join } from "path";
import { PR } from "../queries/schema/PR";
import { fetchFile } from "../util/fetchFile";
import { getMonthlyDownloadCount } from "../util/npm";
import { scrubDiagnosticDetails } from "../util/util";
import { readJsonSync, scrubDiagnosticDetails } from "../util/util";
import { executePrActions } from "../execute-pr-actions";


export default async function main(directory: string, overwriteInfo: boolean) {
const writeJsonSync = (file: string, json: unknown) =>
writeFileSync(file, scrubDiagnosticDetails(JSON.stringify(json, undefined, 2) + "\n"));
Expand Down
1 change: 0 additions & 1 deletion src/functions/discussions-trigger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { app, InvocationContext } from "@azure/functions";
import fetch from "node-fetch";
import { gql, MutationOptions } from "@apollo/client/core";
import type { Discussion, DiscussionWebhook } from "../types/discussions";
import { canHandleRequest, extractNPMReference } from "../discussions";
Expand Down
1 change: 0 additions & 1 deletion src/graphql-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fetch from "node-fetch";
import { ApolloClient, gql, HttpLink, InMemoryCache, MutationOptions, TypedDocumentNode } from "@apollo/client/core";
import { print } from "graphql";
import * as schema from "@octokit/graphql-schema/schema";
Expand Down
2 changes: 0 additions & 2 deletions src/util/io.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import fetch from "node-fetch";

export async function fetchText(url: string): Promise<string> {
const response = await fetch(url);
return response.text();
Expand Down
5 changes: 5 additions & 0 deletions src/util/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as crypto from "crypto";
import { readFileSync } from "fs";

export function noNullish<T>(arr: ReadonlyArray<T | null | undefined> | null | undefined): T[] {
if (arr == null) return [];
Expand Down Expand Up @@ -73,3 +74,7 @@ export function txt(strs: TemplateStringsArray, ...xs: any) {
.trim().replace(/(^|\n) *([^\s])/g, (_m, pfx, sfx) =>
sfx === "|" ? pfx : pfx ? " " + sfx : sfx);
}

export function readJsonSync(file: string) {
return JSON.parse(readFileSync(file, "utf8"));
}
1 change: 0 additions & 1 deletion src/util/verify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { verify } from "@octokit/webhooks-methods";
import type { InvocationContext } from "@azure/functions";
import type { Headers } from "undici";

export async function httpLog(context: InvocationContext, headers: Headers, body: any) {
const githubId = headers.get("x-github-delivery");
Expand Down