Skip to content

Commit 45124b1

Browse files
committed
Merge branch 'main' into gabritto/issue52813
2 parents 3a2d005 + 377fe1f commit 45124b1

File tree

2,459 files changed

+15267
-798998
lines changed

Some content is hidden

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

2,459 files changed

+15267
-798998
lines changed

.github/workflows/accept-baselines-fix-lints.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
run: |
1616
git config user.email "[email protected]"
1717
git config user.name "TypeScript Bot"
18-
npm install
19-
git rm -r --quiet tests/baselines/reference :^tests/baselines/reference/docker :^tests/baselines/reference/user
18+
npm ci
19+
git rm -r --quiet tests/baselines/reference
2020
npx hereby runtests-parallel --ci --fix || true
2121
npx hereby baseline-accept
2222
git add ./src

.github/workflows/ci.yml

+48-37
Original file line numberDiff line numberDiff line change
@@ -92,65 +92,76 @@ jobs:
9292

9393
steps:
9494
- uses: actions/checkout@v3
95+
9596
- uses: actions/setup-node@v3
9697
with:
9798
node-version: "*"
9899
check-latest: true
100+
- run: |
101+
corepack enable npm
102+
npm --version
103+
99104
- run: npm ci
100105

101106
- run: npx hereby lkg
102107
- run: |
103108
npm pack
104109
mv typescript*.tgz typescript.tgz
105-
echo "PACKAGE=$PWD/typescript.tgz" >> $GITHUB_ENV
110+
echo "package=$PWD/typescript.tgz" >> "$GITHUB_OUTPUT"
111+
id: pack
106112
107113
- name: Smoke test
108114
run: |
109115
cd "$(mktemp -d)"
110116
npm init --yes
111-
npm install $PACKAGE tslib
117+
npm install ${{ steps.pack.outputs.package }}
112118
113119
echo "Testing tsc..."
114120
npx tsc --version
115121
116122
echo "Testing tsserver..."
117123
echo '{"seq": 1, "command": "status"}' | npx tsserver
118124
119-
cat > smoke.js << 'EOF'
120-
console.log(`Testing ${process.argv[2]}...`);
121-
const { __importDefault, __importStar } = require("tslib");
122-
const ts = require(process.argv[2]);
123-
124-
// See: https://github.com/microsoft/TypeScript/pull/51474#issuecomment-1310871623
125-
const fns = [
126-
[() => ts.version, true],
127-
[() => ts.default.version, false],
128-
[() => __importDefault(ts).version, false],
129-
[() => __importDefault(ts).default.version, true],
130-
[() => __importStar(ts).version, true],
131-
[() => __importStar(ts).default.version, true],
132-
];
133-
134-
for (const [fn, shouldSucceed] of fns) {
135-
let success = false;
136-
try {
137-
success = !!fn();
138-
}
139-
catch {}
140-
const status = success ? "succeeded" : "failed";
141-
if (success === shouldSucceed) {
142-
console.log(`${fn.toString()} ${status} as expected.`);
143-
}
144-
else {
145-
console.log(`${fn.toString()} unexpectedly ${status}.`);
146-
process.exitCode = 1;
147-
}
148-
}
149-
console.log("ok");
150-
EOF
151-
152-
node ./smoke.js typescript
153-
node ./smoke.js typescript/lib/tsserverlibrary
125+
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript
126+
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript/lib/tsserverlibrary
127+
128+
package-size:
129+
runs-on: ubuntu-latest
130+
if: github.event_name == 'pull_request'
131+
132+
steps:
133+
- uses: actions/checkout@v3
134+
with:
135+
path: pr
136+
137+
- uses: actions/checkout@v3
138+
with:
139+
path: base
140+
ref: ${{ github.base_ref }}
141+
142+
- uses: actions/setup-node@v3
143+
with:
144+
node-version: "*"
145+
check-latest: true
146+
- run: |
147+
corepack enable npm
148+
npm --version
149+
150+
- run: npm ci
151+
working-directory: ./pr
152+
153+
- run: npm ci
154+
working-directory: ./base
155+
156+
- run: npx hereby lkg
157+
working-directory: ./pr
158+
159+
- run: npx hereby lkg
160+
working-directory: ./base
161+
162+
- run: |
163+
echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info."
164+
node ./pr/scripts/checkPackageSize.mjs ./base ./pr >> $GITHUB_STEP_SUMMARY
154165
155166
misc:
156167
runs-on: ubuntu-latest

.github/workflows/new-release-branch.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010

1111
steps:
1212
- uses: actions/setup-node@v3
13+
- run: |
14+
corepack enable npm
15+
npm --version
1316
- uses: actions/checkout@v3
1417
with:
1518
fetch-depth: 5

.github/workflows/nightly.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
with:
2020
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
2121
registry-url: https://registry.npmjs.org/
22+
- run: |
23+
corepack enable npm
24+
npm --version
2225
- name: Setup and publish nightly
2326
run: |
2427
npm whoami

.github/workflows/release-branch-artifact.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
- uses: actions/setup-node@v3
15+
- run: |
16+
corepack enable npm
17+
npm --version
1518
- name: npm install and test
1619
run: |
1720
npm ci

.github/workflows/set-version.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
- uses: actions/checkout@v3
1414
with:
1515
ref: ${{ github.event.client_payload.branch_name }}
16+
- run: |
17+
corepack enable npm
18+
npm --version
1619
# notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists
1720
# do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the
1821
# `version` identifier no longer match the regex it uses

.github/workflows/update-package-lock.yaml

+14-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,23 @@ jobs:
1919
- uses: actions/setup-node@v3
2020
with:
2121
node-version: 16
22+
- run: |
23+
corepack enable npm
24+
npm --version
2225
23-
- name: Configure git and update package-lock.json
26+
- name: Update package-lock.json and push
2427
run: |
25-
git config user.email "[email protected]"
26-
git config user.name "TypeScript Bot"
2728
rm package-lock.json
28-
npm install --package-lock-only --ignore-scripts # This is a no-op if package-lock.json is present.
29+
npm install
2930
git add -f package-lock.json
30-
if git commit -m "Update package-lock.json"; then
31+
32+
if git diff --exit-code --name-only package-lock.json; then
33+
echo "No change."
34+
else
35+
npm test
36+
npx hereby lkg
37+
git config user.email "[email protected]"
38+
git config user.name "TypeScript Bot"
39+
git commit -m "Update package-lock.json"
3140
git push
3241
fi

.gitignore

+2-24
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ node_modules/
22
.node_modules/
33
built/*
44
tests/cases/rwc/*
5-
tests/cases/test262/*
65
tests/cases/perf/*
76
!tests/cases/webharness/compilerToString.js
87
test-args.txt
@@ -14,7 +13,6 @@ tests/baselines/local.old/*
1413
tests/services/baselines/local/*
1514
tests/baselines/prototyping/local/*
1615
tests/baselines/rwc/*
17-
tests/baselines/test262/*
1816
tests/baselines/reference/projectOutput/*
1917
tests/baselines/local/projectOutput/*
2018
tests/baselines/reference/testresults.tap
@@ -34,7 +32,6 @@ tests/webTestServer.js.map
3432
tests/webhost/*.d.ts
3533
tests/webhost/webtsc.js
3634
tests/cases/**/*.js
37-
!tests/cases/docker/*.js/
3835
tests/cases/**/*.js.map
3936
*.config
4037
scripts/eslint/built/
@@ -59,29 +56,10 @@ internal/
5956
yarn.lock
6057
yarn-error.log
6158
.parallelperf.*
62-
tests/cases/user/*/package-lock.json
63-
tests/cases/user/*/node_modules/
64-
tests/cases/user/*/**/*.js
65-
tests/cases/user/*/**/*.js.map
66-
tests/cases/user/*/**/*.d.ts
67-
!tests/cases/user/zone.js/
68-
!tests/cases/user/bignumber.js/
69-
!tests/cases/user/discord.js/
7059
tests/baselines/reference/dt
7160
.failed-tests
7261
TEST-results.xml
7362
package-lock.json
74-
tests/cases/user/npm/npm
75-
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
76-
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
77-
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
78-
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
79-
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
80-
tests/cases/user/create-react-app/create-react-app
81-
tests/cases/user/fp-ts/fp-ts
82-
tests/cases/user/webpack/webpack
83-
tests/cases/user/puppeteer/puppeteer
84-
tests/cases/user/axios-src/axios-src
85-
tests/cases/user/prettier/prettier
8663
.eslintcache
87-
*v8.log
64+
*v8.log
65+
lib/

.vscode/settings.template.json

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Rename this file 'settings.json' or merge its
22
// contents into your existing settings.
33
{
4-
// To use the last-known-good (LKG) compiler version:
5-
// "typescript.tsdk": "lib"
6-
74
// To use the locally built compiler, after 'npm run build':
85
// "typescript.tsdk": "built/local"
96

.vscode/tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"label": "tsc: watch ./src",
2626
"type": "shell",
2727
"command": "node",
28-
"args": ["${workspaceFolder}/lib/tsc.js", "--build", "${workspaceFolder}/src", "--watch"],
28+
"args": ["${workspaceFolder}/node_modules/typescript/lib/tsc.js", "--build", "${workspaceFolder}/src", "--watch"],
2929
"group": "build",
3030
"isBackground": true,
3131
"problemMatcher": [

CONTRIBUTING.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ hereby tests # Build the test infrastructure using the built compile
8181
hereby runtests # Run tests using the built compiler and test infrastructure.
8282
# You can override the specific suite runner used or specify a test for this command.
8383
# Use --tests=<testPath> for a specific test and/or --runner=<runnerName> for a specific suite.
84-
# Valid runners include conformance, compiler, fourslash, project, user, and docker
85-
# The user and docker runners are extended test suite runners - the user runner
86-
# works on disk in the tests/cases/user directory, while the docker runner works in containers.
87-
# You'll need to have the docker executable in your system path for the docker runner to work.
84+
# Valid runners include conformance, compiler, fourslash, and project
8885
hereby runtests-parallel # Like runtests, but split across multiple threads. Uses a number of threads equal to the system
8986
# core count by default. Use --workers=<number> to adjust this.
9087
hereby baseline-accept # This replaces the baseline test results with the results obtained from hereby runtests.

Herebyfile.mjs

+2-18
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import del from "del";
66
import esbuild from "esbuild";
77
import { EventEmitter } from "events";
88
import fs from "fs";
9-
import fsExtra from "fs-extra";
109
import _glob from "glob";
1110
import { task } from "hereby";
1211
import path from "path";
@@ -16,7 +15,7 @@ import { localizationDirectories } from "./scripts/build/localization.mjs";
1615
import cmdLineOptions from "./scripts/build/options.mjs";
1716
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
1817
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
19-
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
18+
import { Debouncer, Deferred, exec, getDiffTool, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
2019

2120
const glob = util.promisify(_glob);
2221

@@ -833,12 +832,8 @@ export const produceLKG = task({
833832
if (missingFiles.length > 0) {
834833
throw new Error("Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n" + missingFiles.join("\n"));
835834
}
836-
const sizeBefore = getDirSize("lib");
835+
837836
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
838-
const sizeAfter = getDirSize("lib");
839-
if (sizeAfter > (sizeBefore * 1.10)) {
840-
throw new Error("The lib folder increased by 10% or more. This likely indicates a bug.");
841-
}
842837
}
843838
});
844839

@@ -884,14 +879,3 @@ export const help = task({
884879
hiddenFromTaskList: true,
885880
run: () => exec("hereby", ["--tasks"], { hidePrompt: true }),
886881
});
887-
888-
export const bumpLkgToNightly = task({
889-
name: "bump-lkg-to-nightly",
890-
description: "Bumps typescript in package.json to the latest nightly and copies it to LKG.",
891-
run: async () => {
892-
await exec("npm", ["install", "--save-dev", "--save-exact", "typescript@next"]);
893-
await fs.promises.rm("lib", { recursive: true, force: true });
894-
await fsExtra.copy("node_modules/typescript/lib", "lib");
895-
await fs.promises.writeFile("lib/.gitattributes", "* text eol=lf");
896-
}
897-
});

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Find others who are using TypeScript at [our community page](https://www.typescr
1717
For the latest stable version:
1818

1919
```bash
20-
npm install -g typescript
20+
npm install -D typescript
2121
```
2222

2323
For our nightly builds:
2424

2525
```bash
26-
npm install -g typescript@next
26+
npm install -D typescript@next
2727
```
2828

2929
## Contribute

0 commit comments

Comments
 (0)