Remove emitDeclarationOnly hack now that build mode supports it as a flag (#51795)

This commit is contained in:
Jake Bailey 2022-12-06 16:02:23 -08:00 committed by GitHub
parent 84e475c105
commit 4ac75fa2b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 34 deletions

View File

@ -7,8 +7,8 @@ import _glob from "glob";
import util from "util";
import chalk from "chalk";
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
import { cleanTestDirs, localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
import { cleanProject, buildProject as realBuildProject, watchProject } from "./scripts/build/projects.mjs";
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
import { localizationDirectories } from "./scripts/build/localization.mjs";
import cmdLineOptions from "./scripts/build/options.mjs";
import esbuild from "esbuild";
@ -28,37 +28,6 @@ const copyright = memoize(async () => {
});
// TODO(jakebailey): This is really gross. If the build is cancelled (i.e. Ctrl+C), the modification will persist.
// Waiting on: https://github.com/microsoft/TypeScript/issues/51164
let currentlyBuilding = 0;
let oldTsconfigBase;
/** @type {typeof realBuildProject} */
const buildProjectWithEmit = async (...args) => {
const tsconfigBasePath = "./src/tsconfig-base.json";
// Not using fs.promises here, to ensure we are synchronous until running the real build.
if (currentlyBuilding === 0) {
oldTsconfigBase = fs.readFileSync(tsconfigBasePath, "utf-8");
fs.writeFileSync(tsconfigBasePath, oldTsconfigBase.replace(`"emitDeclarationOnly": true,`, `"emitDeclarationOnly": false, // DO NOT COMMIT`));
}
currentlyBuilding++;
await realBuildProject(...args);
currentlyBuilding--;
if (currentlyBuilding === 0) {
fs.writeFileSync(tsconfigBasePath, oldTsconfigBase);
}
};
const buildProject = cmdLineOptions.bundle ? realBuildProject : buildProjectWithEmit;
export const buildScripts = task({
name: "scripts",
description: "Builds files in the 'scripts' folder.",

View File

@ -35,7 +35,7 @@ const execTsc = (/** @type {string[]} */ ...args) =>
"-b", ...args],
{ hidePrompt: true });
const projectBuilder = new ProjectQueue((projects) => execTsc(...projects));
const projectBuilder = new ProjectQueue((projects) => execTsc(...(cmdLineOptions.bundle ? [] : ["--emitDeclarationOnly", "false"]), ...projects));
/**
* @param {string} project