mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 03:09:39 -06:00
Remove emitDeclarationOnly hack now that build mode supports it as a flag (#51795)
This commit is contained in:
parent
84e475c105
commit
4ac75fa2b6
@ -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.",
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user