diff --git a/package.json b/package.json index fbccb4810dc59..53c251e1f1abe 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,7 @@ "mocha-fivemat-progress-reporter": "latest", "ms": "latest", "node-fetch": "^2.6.0", + "playwright": "latest", "plugin-error": "latest", "pretty-hrtime": "^1.0.3", "prex": "^0.4.3", @@ -96,7 +97,6 @@ "through2": "latest", "travis-fold": "latest", "typescript": "next", - "playwright": "latest", "vinyl": "latest", "vinyl-sourcemaps-apply": "latest", "xml2js": "^0.4.19" diff --git a/scripts/open-cherry-pick-pr.ts b/scripts/open-cherry-pick-pr.ts index 8df271b6bfc4a..b5ded8d80d468 100644 --- a/scripts/open-cherry-pick-pr.ts +++ b/scripts/open-cherry-pick-pr.ts @@ -27,10 +27,8 @@ async function main() { ["git", ["log", "-1", `--pretty="%aN <%aE>"`]] ]); - const gh = new Octokit(); - gh.authenticate({ - type: "token", - token: process.argv[2] + const gh = new Octokit({ + auth: process.argv[2] }); const inputPR = (await gh.pulls.get({ pull_number: +process.env.SOURCE_ISSUE, owner: "microsoft", repo: "TypeScript" })).data; @@ -101,7 +99,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`, console.log(`Pull request ${num} created.`); await gh.issues.createComment({ - number: +process.env.SOURCE_ISSUE, + issue_number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", body: `Hey @${process.env.REQUESTING_USER}, I've opened #${num} for you.` @@ -112,13 +110,11 @@ main().catch(async e => { console.error(e); process.exitCode = 1; if (process.env.SOURCE_ISSUE) { - const gh = new Octokit(); - gh.authenticate({ - type: "token", - token: process.argv[2] + const gh = new Octokit({ + auth: process.argv[2] }); await gh.issues.createComment({ - number: +process.env.SOURCE_ISSUE, + issue_number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", body: `Hey @${process.env.REQUESTING_USER}, I couldn't open a PR with the cherry-pick. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)). You may need to squash and pick this PR into ${process.env.TARGET_BRANCH} manually.` diff --git a/scripts/open-user-pr.ts b/scripts/open-user-pr.ts index 171cd10f171a6..9ec5b3b49a23e 100644 --- a/scripts/open-user-pr.ts +++ b/scripts/open-user-pr.ts @@ -1,7 +1,7 @@ /// /// // Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally -import Octokit = require("@octokit/rest"); +import { Octokit } from "@octokit/rest"; import {runSequence} from "./run-sequence"; function padNum(num: number) { @@ -24,10 +24,8 @@ runSequence([ ["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch ]); -const gh = new Octokit(); -gh.authenticate({ - type: "token", - token: process.argv[2] +const gh = new Octokit({ + auth: process.argv[2] }); gh.pulls.create({ owner: process.env.TARGET_FORK!, @@ -54,7 +52,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`, } else { await gh.issues.createComment({ - number: +process.env.SOURCE_ISSUE, + issue_number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", body: `The user suite test run you requested has finished and _failed_. I've opened a [PR with the baseline diff from master](${r.data.html_url}).` diff --git a/scripts/perf-result-post.js b/scripts/perf-result-post.js index d7b651113e11a..79d90d40c5aab 100644 --- a/scripts/perf-result-post.js +++ b/scripts/perf-result-post.js @@ -1,7 +1,7 @@ // @ts-check /// // Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally -const Octokit = require("@octokit/rest"); +const { Octokit } = require("@octokit/rest"); const fs = require("fs"); const requester = process.env.requesting_user; @@ -12,13 +12,11 @@ const outputTableText = fs.readFileSync(process.argv[3], { encoding: "utf8" }); console.log(`Fragment contents: ${outputTableText}`); -const gh = new Octokit(); -gh.authenticate({ - type: "token", - token: process.argv[2] +const gh = new Octokit({ + auth: process.argv[2] }); gh.issues.createComment({ - number: +source, + issue_number: +source, owner: "Microsoft", repo: "TypeScript", body: `@${requester} diff --git a/scripts/post-vsts-artifact-comment.js b/scripts/post-vsts-artifact-comment.js index d4de2b7c5009a..076d5a753067d 100644 --- a/scripts/post-vsts-artifact-comment.js +++ b/scripts/post-vsts-artifact-comment.js @@ -1,7 +1,7 @@ // @ts-check /// // Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally -const Octokit = require("@octokit/rest"); +const { Octokit } = require("@octokit/rest"); const ado = require("azure-devops-node-api"); const { default: fetch } = require("node-fetch"); @@ -23,10 +23,8 @@ async function main() { const tgzUrl = new URL(artifact.resource.url); tgzUrl.search = `artifactName=tgz&fileId=${file.blob.id}&fileName=${file.path}`; const link = "" + tgzUrl; - const gh = new Octokit(); - gh.authenticate({ - type: "token", - token: process.argv[2] + const gh = new Octokit({ + auth: process.argv[2] }); // Please keep the strings "an installable tgz" and "packed" in this message, as well as the devDependencies section, @@ -57,13 +55,11 @@ main().catch(async e => { console.error(e); process.exitCode = 1; if (process.env.SOURCE_ISSUE) { - const gh = new Octokit(); - gh.authenticate({ - type: "token", - token: process.argv[2] + const gh = new Octokit({ + auth: process.argv[2] }); await gh.issues.createComment({ - number: +process.env.SOURCE_ISSUE, + issue_number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", body: `Hey @${process.env.REQUESTING_USER}, something went wrong when looking for the build artifact. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)).` diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index 3c25e2f2dc6fc..94a101cc2b80f 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -1,6 +1,6 @@ // @ts-check /// -const Octokit = require("@octokit/rest"); +const { Octokit } = require("@octokit/rest"); const { runSequence } = require("./run-sequence"); // The first is used by bot-based kickoffs, the second by automatic triggers @@ -76,7 +76,8 @@ async function main() { ]); // Merge each branch into `experimental` (which, if there is a conflict, we now know is from inter-experiment conflict) - for (const branch of prnums) { + for (const branchnum of prnums) { + const branch = "" + branchnum; // Find the merge base const mergeBase = runSequence([ ["git", ["merge-base", branch, "experimental"]],