Skip to content

Commit 8eed2ca

Browse files
authored
Consistently respect --no-typecheck flag in build (#51575)
1 parent 7b85cd6 commit 8eed2ca

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// https://github.com/microsoft/vscode/issues/93001
1515
"label": "gulp: tests",
1616
"type": "npm",
17-
"script": "build:tests",
17+
"script": "build:tests -- --no-typecheck",
1818
"group": "build",
1919
"hide": true,
2020
"problemMatcher": [
@@ -44,7 +44,7 @@
4444
{
4545
"label": "npm: build:tests",
4646
"type": "npm",
47-
"script": "build:tests",
47+
"script": "build:tests -- --no-typecheck",
4848
"group": "build",
4949
"problemMatcher": [
5050
"$tsc"

Herebyfile.mjs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,21 @@ function entrypointBuildTask(options) {
328328
},
329329
});
330330

331+
const mainDeps = options.mainDeps?.slice(0) ?? [];
332+
if (cmdLineOptions.bundle) {
333+
mainDeps.push(bundle);
334+
if (cmdLineOptions.typecheck) {
335+
mainDeps.push(build);
336+
}
337+
}
338+
else {
339+
mainDeps.push(build, shim);
340+
}
341+
331342
const main = task({
332343
name: options.name,
333344
description: options.description,
334-
dependencies: (options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [bundle] : [build, shim]),
345+
dependencies: mainDeps,
335346
});
336347

337348
const watch = task({
@@ -358,7 +369,7 @@ function entrypointBuildTask(options) {
358369
}
359370

360371

361-
const { main: tsc, build: buildTsc, watch: watchTsc } = entrypointBuildTask({
372+
const { main: tsc, watch: watchTsc } = entrypointBuildTask({
362373
name: "tsc",
363374
description: "Builds the command-line compiler",
364375
buildDeps: [generateDiagnostics],
@@ -396,7 +407,7 @@ export const dtsServices = task({
396407
});
397408

398409

399-
const { main: tsserver, build: buildTsserver, watch: watchTsserver } = entrypointBuildTask({
410+
const { main: tsserver, watch: watchTsserver } = entrypointBuildTask({
400411
name: "tsserver",
401412
description: "Builds the language server",
402413
buildDeps: [generateDiagnostics],
@@ -414,15 +425,10 @@ const { main: tsserver, build: buildTsserver, watch: watchTsserver } = entrypoin
414425
export { tsserver, watchTsserver };
415426

416427

417-
const buildMin = task({
418-
name: "build-min",
419-
dependencies: [buildTsc, buildTsserver],
420-
});
421-
422428
export const min = task({
423429
name: "min",
424430
description: "Builds only tsc and tsserver",
425-
dependencies: [tsc, tsserver].concat(cmdLineOptions.typecheck ? [buildMin] : []),
431+
dependencies: [tsc, tsserver],
426432
});
427433

428434
export const watchMin = task({
@@ -591,15 +597,10 @@ export const watchOtherOutputs = task({
591597
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
592598
});
593599

594-
const buildLocal = task({
595-
name: "build-local",
596-
dependencies: [buildTsc, buildTsserver, buildServices, buildLssl]
597-
});
598-
599600
export const local = task({
600601
name: "local",
601602
description: "Builds the full compiler and services",
602-
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts].concat(cmdLineOptions.typecheck ? [buildLocal] : []),
603+
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts],
603604
});
604605
export default local;
605606

@@ -610,7 +611,7 @@ export const watchLocal = task({
610611
dependencies: [localize, watchTsc, watchTsserver, watchServices, watchLssl, watchOtherOutputs, dts, watchSrc],
611612
});
612613

613-
const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts, buildSrc] : []);
614+
const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts] : []);
614615

615616
export const runTests = task({
616617
name: "runtests",

scripts/build/options.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ if (options.built) {
5151
options.lkg = false;
5252
}
5353

54+
if (!options.bundle && !options.typecheck) {
55+
throw new Error("--no-typecheck cannot be passed when bundling is disabled");
56+
}
57+
5458
export default options;
5559

5660

0 commit comments

Comments
 (0)