Skip to content

Commit d6b3a11

Browse files
committed
Merge branch 'master' into spreadArraysES5
2 parents 66323c2 + bc7f3db commit d6b3a11

File tree

826 files changed

+54283
-7731
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

826 files changed

+54283
-7731
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ scripts/ior.js
4444
scripts/authors.js
4545
scripts/configurePrerelease.js
4646
scripts/open-user-pr.js
47+
scripts/open-cherry-pick-pr.js
4748
scripts/processDiagnosticMessages.d.ts
4849
scripts/processDiagnosticMessages.js
4950
scripts/produceLKG.js

README.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
2-
[![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs)
3-
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
4-
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
51

62
# TypeScript
73

84
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
[![Build Status](https://travis-ci.org/microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
6+
[![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs)
7+
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
8+
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
9+
10+
911

10-
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescriptlang).
12+
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
1113

1214
## Installing
1315

@@ -28,14 +30,14 @@ npm install -g typescript@next
2830
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
2931
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
3032
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
31-
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
33+
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
3234
* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter.
3335
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
3436
* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true),
3537
[pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)).
3638

37-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
38-
the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected])
39+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
40+
the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected])
3941
with any additional questions or comments.
4042

4143
## Documentation
@@ -71,17 +73,17 @@ npm install
7173
Use one of the following to build and test:
7274

7375
```
74-
gulp local # Build the compiler into built/local
75-
gulp clean # Delete the built compiler
76+
gulp local # Build the compiler into built/local
77+
gulp clean # Delete the built compiler
7678
gulp LKG # Replace the last known good with the built one.
7779
# Bootstrapping step to be executed when the built compiler reaches a stable state.
78-
gulp tests # Build the test infrastructure using the built compiler.
79-
gulp runtests # Run tests using the built compiler and test infrastructure.
80-
# You can override the host or specify a test for this command.
81-
# Use --host=<hostName> or --tests=<testPath>.
80+
gulp tests # Build the test infrastructure using the built compiler.
81+
gulp runtests # Run tests using the built compiler and test infrastructure.
82+
# You can override the host or specify a test for this command.
83+
# Use --host=<hostName> or --tests=<testPath>.
8284
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
8385
gulp lint # Runs tslint on the TypeScript source.
84-
gulp help # List the above commands.
86+
gulp help # List the above commands.
8587
```
8688

8789

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "https://www.typescriptlang.org/",
5-
"version": "3.5.0",
5+
"version": "3.6.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [
@@ -48,11 +48,13 @@
4848
"@types/mocha": "latest",
4949
"@types/ms": "latest",
5050
"@types/node": "8.5.5",
51+
"@types/node-fetch": "^2.3.4",
5152
"@types/q": "latest",
5253
"@types/source-map-support": "latest",
5354
"@types/through2": "latest",
5455
"@types/travis-fold": "latest",
5556
"@types/xml2js": "^0.4.0",
57+
"azure-devops-node-api": "^8.0.0",
5658
"browser-resolve": "^1.11.2",
5759
"browserify": "latest",
5860
"chai": "latest",
@@ -74,6 +76,7 @@
7476
"mocha": "latest",
7577
"mocha-fivemat-progress-reporter": "latest",
7678
"ms": "latest",
79+
"node-fetch": "^2.6.0",
7780
"plugin-error": "latest",
7881
"pretty-hrtime": "^1.0.3",
7982
"prex": "^0.4.3",

scripts/open-cherry-pick-pr.ts

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/// <reference lib="esnext.asynciterable" />
2+
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
3+
/// <reference types="node" />
4+
5+
import Octokit = require("@octokit/rest");
6+
const {runSequence} = require("./run-sequence");
7+
import fs = require("fs");
8+
import path = require("path");
9+
10+
const userName = process.env.GH_USERNAME;
11+
const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "RyanCavanaugh"];
12+
const branchName = `pick/${process.env.SOURCE_ISSUE}/${process.env.TARGET_BRANCH}`;
13+
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;
14+
15+
async function main() {
16+
if (!process.env.TARGET_BRANCH) {
17+
throw new Error("Target branch not specified");
18+
}
19+
if (!process.env.SOURCE_ISSUE) {
20+
throw new Error("Source issue not specified");
21+
}
22+
const currentSha = runSequence([
23+
["git", ["rev-parse", "HEAD"]]
24+
]);
25+
const currentAuthor = runSequence([
26+
["git", ["log", "-1", `--pretty="%aN <%aE>"`]]
27+
]);
28+
runSequence([
29+
["git", ["fetch", "origin", "master"]]
30+
]);
31+
let logText = runSequence([
32+
["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]]
33+
]);
34+
logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}
35+
36+
Component commits:
37+
${logText.trim()}`
38+
const logpath = path.join(__dirname, "../", "logmessage.txt");
39+
runSequence([
40+
["git", ["checkout", "-b", "temp-branch"]],
41+
["git", ["reset", "origin/master", "--soft"]]
42+
]);
43+
fs.writeFileSync(logpath, logText);
44+
runSequence([
45+
["git", ["commit", "-F", logpath, `--author="${currentAuthor.trim()}"`]]
46+
]);
47+
fs.unlinkSync(logpath);
48+
const squashSha = runSequence([
49+
["git", ["rev-parse", "HEAD"]]
50+
]);
51+
runSequence([
52+
["git", ["checkout", process.env.TARGET_BRANCH]], // checkout the target branch
53+
["git", ["checkout", "-b", branchName]], // create a new branch
54+
["git", ["cherry-pick", squashSha.trim()]], //
55+
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
56+
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
57+
]);
58+
59+
const gh = new Octokit();
60+
gh.authenticate({
61+
type: "token",
62+
token: process.argv[2]
63+
});
64+
const r = await gh.pulls.create({
65+
owner: "Microsoft",
66+
repo: "TypeScript",
67+
maintainer_can_modify: true,
68+
title: `🤖 Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}`,
69+
head: `${userName}:${branchName}`,
70+
base: process.env.TARGET_BRANCH,
71+
body:
72+
`This cherry-pick was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE}
73+
Please review the diff and merge if no changes are unexpected.
74+
You can view the cherry-pick log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary).
75+
76+
cc ${reviewers.map(r => "@" + r).join(" ")}`,
77+
});
78+
const num = r.data.number;
79+
console.log(`Pull request ${num} created.`);
80+
81+
await gh.issues.createComment({
82+
number: +process.env.SOURCE_ISSUE,
83+
owner: "Microsoft",
84+
repo: "TypeScript",
85+
body: `Hey @${process.env.REQUESTING_USER}, I've opened #${num} for you.`
86+
});
87+
}
88+
89+
main().catch(async e => {
90+
console.error(e);
91+
process.exitCode = 1;
92+
if (process.env.SOURCE_ISSUE) {
93+
const gh = new Octokit();
94+
gh.authenticate({
95+
type: "token",
96+
token: process.argv[2]
97+
});
98+
await gh.issues.createComment({
99+
number: +process.env.SOURCE_ISSUE,
100+
owner: "Microsoft",
101+
repo: "TypeScript",
102+
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.`
103+
});
104+
}
105+
});

scripts/open-user-pr.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function padNum(number: number) {
99
}
1010

1111
const userName = process.env.GH_USERNAME;
12-
const reviewers = process.env.requesting_user ? [process.env.requesting_user] : ["weswigham", "sandersn", "RyanCavanaugh"];
12+
const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "sandersn", "RyanCavanaugh"];
1313
const now = new Date();
1414
const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`;
1515
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;
@@ -36,14 +36,14 @@ gh.pulls.create({
3636
head: `${userName}:${branchName}`,
3737
base: process.env.TARGET_BRANCH || "master",
3838
body:
39-
`${process.env.source_issue ? `This test run was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.source_issue} `+"\n" : ""}Please review the diff and merge if no changes are unexpected.
39+
`${process.env.SOURCE_ISSUE ? `This test run was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE} `+"\n" : ""}Please review the diff and merge if no changes are unexpected.
4040
You can view the build log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary).
4141
4242
cc ${reviewers.map(r => "@" + r).join(" ")}`,
4343
}).then(async r => {
4444
const num = r.data.number;
4545
console.log(`Pull request ${num} created.`);
46-
if (!process.env.source_issue) {
46+
if (!process.env.SOURCE_ISSUE) {
4747
await gh.pulls.createReviewRequest({
4848
owner: process.env.TARGET_FORK,
4949
repo: "TypeScript",
@@ -53,7 +53,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
5353
}
5454
else {
5555
await gh.issues.createComment({
56-
number: +process.env.source_issue,
56+
number: +process.env.SOURCE_ISSUE,
5757
owner: "Microsoft",
5858
repo: "TypeScript",
5959
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}).`

scripts/post-vsts-artifact-comment.js

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// @ts-check
2+
/// <reference lib="esnext.asynciterable" />
3+
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
4+
const Octokit = require("@octokit/rest");
5+
const ado = require("azure-devops-node-api");
6+
const { default: fetch } = require("node-fetch");
7+
8+
async function main() {
9+
if (!process.env.SOURCE_ISSUE) {
10+
throw new Error("No source issue specified");
11+
}
12+
if (!process.env.BUILD_BUILDID) {
13+
throw new Error("No build ID specified");
14+
}
15+
// The pipelines API does _not_ make getting the direct URL to a specific file _within_ an artifact trivial
16+
const cli = new ado.WebApi("https://typescript.visualstudio.com/defaultcollection", ado.getHandlerFromToken("")); // Empty token, anon auth
17+
const build = await cli.getBuildApi();
18+
const artifact = await build.getArtifact("typescript", +process.env.BUILD_BUILDID, "tgz");
19+
const updatedUrl = new URL(artifact.resource.url);
20+
updatedUrl.search = `artifactName=tgz&fileId=${artifact.resource.data}&fileName=manifest`;
21+
const resp = await (await fetch(`${updatedUrl}`)).json();
22+
const file = resp.items[0];
23+
const tgzUrl = new URL(artifact.resource.url);
24+
tgzUrl.search = `artifactName=tgz&fileId=${file.blob.id}&fileName=${file.path}`;
25+
const link = "" + tgzUrl;
26+
const gh = new Octokit();
27+
gh.authenticate({
28+
type: "token",
29+
token: process.argv[2]
30+
});
31+
await gh.issues.createComment({
32+
number: +process.env.SOURCE_ISSUE,
33+
owner: "Microsoft",
34+
repo: "TypeScript",
35+
body: `Hey @${process.env.REQUESTING_USER}, I've packed this into [an installable tgz](${link}). You can install it for testing by referencing it in your \`package.json\` like so:
36+
\`\`\`
37+
{
38+
"devDependencies": {
39+
"typescript": "${link}"
40+
}
41+
}
42+
\`\`\`
43+
and then running \`npm install\`.
44+
`
45+
});
46+
}
47+
48+
main().catch(async e => {
49+
console.error(e);
50+
process.exitCode = 1;
51+
if (process.env.SOURCE_ISSUE) {
52+
const gh = new Octokit();
53+
gh.authenticate({
54+
type: "token",
55+
token: process.argv[2]
56+
});
57+
await gh.issues.createComment({
58+
number: +process.env.SOURCE_ISSUE,
59+
owner: "Microsoft",
60+
repo: "TypeScript",
61+
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)).`
62+
});
63+
}
64+
});

scripts/run-sequence.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ const cp = require("child_process");
55
* @param {[string, string[]][]} tasks
66
* @param {cp.SpawnSyncOptions} opts
77
*/
8-
function runSequence(tasks, opts = { timeout: 100000, shell: true, stdio: "inherit" }) {
8+
function runSequence(tasks, opts = { timeout: 100000, shell: true }) {
99
let lastResult;
1010
for (const task of tasks) {
1111
console.log(`${task[0]} ${task[1].join(" ")}`);
1212
const result = cp.spawnSync(task[0], task[1], opts);
1313
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
14+
console.log(result.stdout && result.stdout.toString());
1415
lastResult = result;
1516
}
1617
return lastResult && lastResult.stdout && lastResult.stdout.toString();

0 commit comments

Comments
 (0)