Skip to content

Commit 37df8fa

Browse files
Merge branch 'main' into tsconfig-informed-module-specifier-endings
2 parents e5426d0 + 2378c0b commit 37df8fa

20 files changed

+455
-74
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
run: |
1616
git config user.email "[email protected]"
1717
git config user.name "TypeScript Bot"
18-
npm install
18+
npm ci
1919
git rm -r --quiet tests/baselines/reference
2020
npx hereby runtests-parallel --ci --fix || true
2121
npx hereby baseline-accept

.github/workflows/ci.yml

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,18 @@ jobs:
8989

9090
smoke:
9191
runs-on: ubuntu-latest
92-
defaults:
93-
run:
94-
working-directory: ./pr
9592

9693
steps:
9794
- uses: actions/checkout@v3
98-
with:
99-
path: pr
100-
101-
- uses: actions/checkout@v3
102-
with:
103-
path: base
104-
ref: ${{ github.base_ref }}
105-
if: github.event_name == 'pull_request'
10695

10796
- uses: actions/setup-node@v3
10897
with:
10998
node-version: "*"
11099
check-latest: true
100+
- run: |
101+
corepack enable npm
102+
npm --version
111103
112-
# Pre-build the base branch so we can check lib folder size changes.
113-
# Note that github.sha points to a merge commit, meaning we're testing
114-
# the base branch versus the base branch with the PR applied.
115-
- name: Build base LKG
116-
if: github.event_name == 'pull_request'
117-
run: |
118-
npm ci
119-
npx hereby lkg
120-
rm -rf $GITHUB_WORKSPACE/pr/lib
121-
mv ./lib $GITHUB_WORKSPACE/pr/
122-
working-directory: ./base
123-
124104
- run: npm ci
125105

126106
- run: npx hereby lkg
@@ -177,6 +157,44 @@ jobs:
177157
node ./smoke.js typescript
178158
node ./smoke.js typescript/lib/tsserverlibrary
179159
160+
package-size:
161+
runs-on: ubuntu-latest
162+
if: github.event_name == 'pull_request'
163+
164+
steps:
165+
- uses: actions/checkout@v3
166+
with:
167+
path: pr
168+
169+
- uses: actions/checkout@v3
170+
with:
171+
path: base
172+
ref: ${{ github.base_ref }}
173+
174+
- uses: actions/setup-node@v3
175+
with:
176+
node-version: "*"
177+
check-latest: true
178+
- run: |
179+
corepack enable npm
180+
npm --version
181+
182+
- run: npm ci
183+
working-directory: ./pr
184+
185+
- run: npm ci
186+
working-directory: ./base
187+
188+
- run: npx hereby lkg
189+
working-directory: ./pr
190+
191+
- run: npx hereby lkg
192+
working-directory: ./base
193+
194+
- run: |
195+
echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info."
196+
node ./pr/scripts/checkPackageSize.mjs ./base ./pr >> $GITHUB_STEP_SUMMARY
197+
180198
misc:
181199
runs-on: ubuntu-latest
182200

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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 14 additions & 5 deletions
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

Herebyfile.mjs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { localizationDirectories } from "./scripts/build/localization.mjs";
1515
import cmdLineOptions from "./scripts/build/options.mjs";
1616
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
1717
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
18-
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";
1919

2020
const glob = util.promisify(_glob);
2121

@@ -833,19 +833,7 @@ export const produceLKG = task({
833833
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"));
834834
}
835835

836-
/** @type {number | undefined} */
837-
let sizeBefore;
838-
if (fs.existsSync("lib")) {
839-
sizeBefore = getDirSize("lib");
840-
}
841836
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
842-
843-
if (sizeBefore !== undefined) {
844-
const sizeAfter = getDirSize("lib");
845-
if (sizeAfter > (sizeBefore * 1.10)) {
846-
throw new Error("The lib folder increased by 10% or more. This likely indicates a bug.");
847-
}
848-
}
849837
}
850838
});
851839

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"ms": "^2.1.3",
7979
"node-fetch": "^3.2.10",
8080
"source-map-support": "^0.5.21",
81-
"typescript": "5.0.0-dev.20230112",
81+
"typescript": "5.0.1-rc",
8282
"which": "^2.0.2"
8383
},
8484
"overrides": {

scripts/build/utils.mjs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import chalk from "chalk";
44
import { spawn } from "child_process";
55
import fs from "fs";
66
import JSONC from "jsonc-parser";
7-
import path from "path";
87
import which from "which";
98

109
/**
@@ -140,24 +139,6 @@ export function getDiffTool() {
140139
return program;
141140
}
142141

143-
/**
144-
* Find the size of a directory recursively.
145-
* Symbolic links can cause a loop.
146-
* @param {string} root
147-
* @returns {number} bytes
148-
*/
149-
export function getDirSize(root) {
150-
const stats = fs.lstatSync(root);
151-
152-
if (!stats.isDirectory()) {
153-
return stats.size;
154-
}
155-
156-
return fs.readdirSync(root)
157-
.map(file => getDirSize(path.join(root, file)))
158-
.reduce((acc, num) => acc + num, 0);
159-
}
160-
161142
/**
162143
* @template T
163144
*/

0 commit comments

Comments
 (0)