Skip to content

Commit

Permalink
Merge branch 'master' into spreadArraysES5
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Jun 11, 2019
2 parents 66323c2 + bc7f3db commit d6b3a11
Show file tree
Hide file tree
Showing 826 changed files with 54,283 additions and 7,731 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ scripts/ior.js
scripts/authors.js
scripts/configurePrerelease.js
scripts/open-user-pr.js
scripts/open-cherry-pick-pr.js
scripts/processDiagnosticMessages.d.ts
scripts/processDiagnosticMessages.js
scripts/produceLKG.js
Expand Down
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
[![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)
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)

# TypeScript

[![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)
[![Build Status](https://travis-ci.org/microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
[![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)
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)



[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).
[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).

## Installing

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

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

## Documentation
Expand Down Expand Up @@ -71,17 +73,17 @@ npm install
Use one of the following to build and test:

```
gulp local # Build the compiler into built/local
gulp clean # Delete the built compiler
gulp local # Build the compiler into built/local
gulp clean # Delete the built compiler
gulp LKG # Replace the last known good with the built one.
# Bootstrapping step to be executed when the built compiler reaches a stable state.
gulp tests # Build the test infrastructure using the built compiler.
gulp runtests # Run tests using the built compiler and test infrastructure.
# You can override the host or specify a test for this command.
# Use --host=<hostName> or --tests=<testPath>.
gulp tests # Build the test infrastructure using the built compiler.
gulp runtests # Run tests using the built compiler and test infrastructure.
# You can override the host or specify a test for this command.
# Use --host=<hostName> or --tests=<testPath>.
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
gulp lint # Runs tslint on the TypeScript source.
gulp help # List the above commands.
gulp help # List the above commands.
```


Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "3.5.0",
"version": "3.6.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
Expand Down Expand Up @@ -48,11 +48,13 @@
"@types/mocha": "latest",
"@types/ms": "latest",
"@types/node": "8.5.5",
"@types/node-fetch": "^2.3.4",
"@types/q": "latest",
"@types/source-map-support": "latest",
"@types/through2": "latest",
"@types/travis-fold": "latest",
"@types/xml2js": "^0.4.0",
"azure-devops-node-api": "^8.0.0",
"browser-resolve": "^1.11.2",
"browserify": "latest",
"chai": "latest",
Expand All @@ -74,6 +76,7 @@
"mocha": "latest",
"mocha-fivemat-progress-reporter": "latest",
"ms": "latest",
"node-fetch": "^2.6.0",
"plugin-error": "latest",
"pretty-hrtime": "^1.0.3",
"prex": "^0.4.3",
Expand Down
105 changes: 105 additions & 0 deletions scripts/open-cherry-pick-pr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
/// <reference types="node" />

import Octokit = require("@octokit/rest");
const {runSequence} = require("./run-sequence");
import fs = require("fs");
import path = require("path");

const userName = process.env.GH_USERNAME;
const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "RyanCavanaugh"];
const branchName = `pick/${process.env.SOURCE_ISSUE}/${process.env.TARGET_BRANCH}`;
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;

async function main() {
if (!process.env.TARGET_BRANCH) {
throw new Error("Target branch not specified");
}
if (!process.env.SOURCE_ISSUE) {
throw new Error("Source issue not specified");
}
const currentSha = runSequence([
["git", ["rev-parse", "HEAD"]]
]);
const currentAuthor = runSequence([
["git", ["log", "-1", `--pretty="%aN <%aE>"`]]
]);
runSequence([
["git", ["fetch", "origin", "master"]]
]);
let logText = runSequence([
["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]]
]);
logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}
Component commits:
${logText.trim()}`
const logpath = path.join(__dirname, "../", "logmessage.txt");
runSequence([
["git", ["checkout", "-b", "temp-branch"]],
["git", ["reset", "origin/master", "--soft"]]
]);
fs.writeFileSync(logpath, logText);
runSequence([
["git", ["commit", "-F", logpath, `--author="${currentAuthor.trim()}"`]]
]);
fs.unlinkSync(logpath);
const squashSha = runSequence([
["git", ["rev-parse", "HEAD"]]
]);
runSequence([
["git", ["checkout", process.env.TARGET_BRANCH]], // checkout the target branch
["git", ["checkout", "-b", branchName]], // create a new branch
["git", ["cherry-pick", squashSha.trim()]], //
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
]);

const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
});
const r = await gh.pulls.create({
owner: "Microsoft",
repo: "TypeScript",
maintainer_can_modify: true,
title: `🤖 Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}`,
head: `${userName}:${branchName}`,
base: process.env.TARGET_BRANCH,
body:
`This cherry-pick was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE}
Please review the diff and merge if no changes are unexpected.
You can view the cherry-pick log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary).
cc ${reviewers.map(r => "@" + r).join(" ")}`,
});
const num = r.data.number;
console.log(`Pull request ${num} created.`);

await gh.issues.createComment({
number: +process.env.SOURCE_ISSUE,
owner: "Microsoft",
repo: "TypeScript",
body: `Hey @${process.env.REQUESTING_USER}, I've opened #${num} for you.`
});
}

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]
});
await gh.issues.createComment({
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.`
});
}
});
8 changes: 4 additions & 4 deletions scripts/open-user-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function padNum(number: number) {
}

const userName = process.env.GH_USERNAME;
const reviewers = process.env.requesting_user ? [process.env.requesting_user] : ["weswigham", "sandersn", "RyanCavanaugh"];
const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "sandersn", "RyanCavanaugh"];
const now = new Date();
const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`;
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;
Expand All @@ -36,14 +36,14 @@ gh.pulls.create({
head: `${userName}:${branchName}`,
base: process.env.TARGET_BRANCH || "master",
body:
`${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.
`${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.
You can view the build log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary).
cc ${reviewers.map(r => "@" + r).join(" ")}`,
}).then(async r => {
const num = r.data.number;
console.log(`Pull request ${num} created.`);
if (!process.env.source_issue) {
if (!process.env.SOURCE_ISSUE) {
await gh.pulls.createReviewRequest({
owner: process.env.TARGET_FORK,
repo: "TypeScript",
Expand All @@ -53,7 +53,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
}
else {
await gh.issues.createComment({
number: +process.env.source_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}).`
Expand Down
64 changes: 64 additions & 0 deletions scripts/post-vsts-artifact-comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// @ts-check
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
const Octokit = require("@octokit/rest");
const ado = require("azure-devops-node-api");
const { default: fetch } = require("node-fetch");

async function main() {
if (!process.env.SOURCE_ISSUE) {
throw new Error("No source issue specified");
}
if (!process.env.BUILD_BUILDID) {
throw new Error("No build ID specified");
}
// The pipelines API does _not_ make getting the direct URL to a specific file _within_ an artifact trivial
const cli = new ado.WebApi("https://typescript.visualstudio.com/defaultcollection", ado.getHandlerFromToken("")); // Empty token, anon auth
const build = await cli.getBuildApi();
const artifact = await build.getArtifact("typescript", +process.env.BUILD_BUILDID, "tgz");
const updatedUrl = new URL(artifact.resource.url);
updatedUrl.search = `artifactName=tgz&fileId=${artifact.resource.data}&fileName=manifest`;
const resp = await (await fetch(`${updatedUrl}`)).json();
const file = resp.items[0];
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]
});
await gh.issues.createComment({
number: +process.env.SOURCE_ISSUE,
owner: "Microsoft",
repo: "TypeScript",
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:
\`\`\`
{
"devDependencies": {
"typescript": "${link}"
}
}
\`\`\`
and then running \`npm install\`.
`
});
}

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]
});
await gh.issues.createComment({
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)).`
});
}
});
3 changes: 2 additions & 1 deletion scripts/run-sequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ const cp = require("child_process");
* @param {[string, string[]][]} tasks
* @param {cp.SpawnSyncOptions} opts
*/
function runSequence(tasks, opts = { timeout: 100000, shell: true, stdio: "inherit" }) {
function runSequence(tasks, opts = { timeout: 100000, shell: true }) {
let lastResult;
for (const task of tasks) {
console.log(`${task[0]} ${task[1].join(" ")}`);
const result = cp.spawnSync(task[0], task[1], opts);
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
console.log(result.stdout && result.stdout.toString());
lastResult = result;
}
return lastResult && lastResult.stdout && lastResult.stdout.toString();
Expand Down
Loading

0 comments on commit d6b3a11

Please sign in to comment.