-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into spreadArraysES5
- Loading branch information
Showing
826 changed files
with
54,283 additions
and
7,731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
@@ -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 | ||
|
@@ -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. | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.` | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)).` | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.