Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lib folder (LKG) and use node_modules for building #52226

Merged
merged 20 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ tests/cases/user/puppeteer/puppeteer
tests/cases/user/axios-src/axios-src
tests/cases/user/prettier/prettier
.eslintcache
*v8.log
*v8.log
lib/
3 changes: 0 additions & 3 deletions .vscode/settings.template.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Rename this file 'settings.json' or merge its
// contents into your existing settings.
{
// To use the last-known-good (LKG) compiler version:
// "typescript.tsdk": "lib"

// To use the locally built compiler, after 'npm run build':
// "typescript.tsdk": "built/local"

Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"label": "tsc: watch ./src",
"type": "shell",
"command": "node",
"args": ["${workspaceFolder}/lib/tsc.js", "--build", "${workspaceFolder}/src", "--watch"],
"args": ["${workspaceFolder}/node_modules/tsc.js", "--build", "${workspaceFolder}/src", "--watch"],
"group": "build",
"isBackground": true,
"problemMatcher": [
Expand Down
28 changes: 12 additions & 16 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import del from "del";
import esbuild from "esbuild";
import { EventEmitter } from "events";
import fs from "fs";
import fsExtra from "fs-extra";
import _glob from "glob";
import { task } from "hereby";
import path from "path";
Expand Down Expand Up @@ -833,11 +832,19 @@ export const produceLKG = task({
if (missingFiles.length > 0) {
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"));
}
const sizeBefore = getDirSize("lib");

/** @type {number | undefined} */
let sizeBefore;
if (fs.existsSync("lib")) {
sizeBefore = getDirSize("lib");
}
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
const sizeAfter = getDirSize("lib");
if (sizeAfter > (sizeBefore * 1.10)) {
throw new Error("The lib folder increased by 10% or more. This likely indicates a bug.");

if (sizeBefore !== undefined) {
const sizeAfter = getDirSize("lib");
if (sizeAfter > (sizeBefore * 1.10)) {
throw new Error("The lib folder increased by 10% or more. This likely indicates a bug.");
}
}
jakebailey marked this conversation as resolved.
Show resolved Hide resolved
}
});
Expand Down Expand Up @@ -884,14 +891,3 @@ export const help = task({
hiddenFromTaskList: true,
run: () => exec("hereby", ["--tasks"], { hidePrompt: true }),
});

export const bumpLkgToNightly = task({
name: "bump-lkg-to-nightly",
description: "Bumps typescript in package.json to the latest nightly and copies it to LKG.",
run: async () => {
await exec("npm", ["install", "--save-dev", "--save-exact", "typescript@next"]);
await fs.promises.rm("lib", { recursive: true, force: true });
await fsExtra.copy("node_modules/typescript/lib", "lib");
await fs.promises.writeFile("lib/.gitattributes", "* text eol=lf");
}
});
1 change: 0 additions & 1 deletion lib/.gitattributes

This file was deleted.

5 changes: 0 additions & 5 deletions lib/README.md

This file was deleted.

91 changes: 0 additions & 91 deletions lib/cancellationToken.js

This file was deleted.

Loading