@@ -7,8 +7,23 @@ import _glob from "glob";
7
7
import util from "util" ;
8
8
import chalk from "chalk" ;
9
9
import fsExtra from "fs-extra" ;
10
- import { Debouncer , Deferred , exec , getDiffTool , getDirSize , memoize , needsUpdate , readJson } from "./scripts/build/utils.mjs" ;
11
- import { localBaseline , localRwcBaseline , refBaseline , refRwcBaseline , runConsoleTests } from "./scripts/build/tests.mjs" ;
10
+ import {
11
+ Debouncer ,
12
+ Deferred ,
13
+ exec ,
14
+ getDiffTool ,
15
+ getDirSize ,
16
+ memoize ,
17
+ needsUpdate ,
18
+ readJson ,
19
+ } from "./scripts/build/utils.mjs" ;
20
+ import {
21
+ localBaseline ,
22
+ localRwcBaseline ,
23
+ refBaseline ,
24
+ refRwcBaseline ,
25
+ runConsoleTests ,
26
+ } from "./scripts/build/tests.mjs" ;
12
27
import { buildProject , cleanProject , watchProject } from "./scripts/build/projects.mjs" ;
13
28
import { localizationDirectories } from "./scripts/build/localization.mjs" ;
14
29
import cmdLineOptions from "./scripts/build/options.mjs" ;
@@ -110,7 +125,12 @@ const localize = task({
110
125
dependencies : [ generateDiagnostics ] ,
111
126
run : async ( ) => {
112
127
if ( needsUpdate ( diagnosticMessagesGeneratedJson , generatedLCGFile ) ) {
113
- await exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ;
128
+ await exec ( process . execPath , [
129
+ "scripts/generateLocalizedDiagnosticMessages.mjs" ,
130
+ "src/loc/lcl" ,
131
+ "built/local" ,
132
+ diagnosticMessagesGeneratedJson ,
133
+ ] , { ignoreExitCode : true } ) ;
114
134
}
115
135
} ,
116
136
} ) ;
@@ -289,7 +309,10 @@ function entrypointBuildTask(options) {
289
309
const outDir = path . dirname ( options . output ) ;
290
310
await fs . promises . mkdir ( outDir , { recursive : true } ) ;
291
311
const moduleSpecifier = path . relative ( outDir , options . builtEntrypoint ) ;
292
- await fs . promises . writeFile ( options . output , `module.exports = require("./${ moduleSpecifier . replace ( / [ \\ / ] / g, "/" ) } ")` ) ;
312
+ await fs . promises . writeFile (
313
+ options . output ,
314
+ `module.exports = require("./${ moduleSpecifier . replace ( / [ \\ / ] / g, "/" ) } ")` ,
315
+ ) ;
293
316
} ,
294
317
} ) ;
295
318
@@ -313,13 +336,19 @@ function entrypointBuildTask(options) {
313
336
const watch = task ( {
314
337
name : `watch-${ options . name } ` ,
315
338
hiddenFromTaskList : true , // This is best effort.
316
- dependencies : ( options . buildDeps ?? [ ] ) . concat ( options . mainDeps ?? [ ] ) . concat ( cmdLineOptions . bundle ? [ ] : [ shim ] ) ,
339
+ dependencies : ( options . buildDeps ?? [ ] ) . concat ( options . mainDeps ?? [ ] ) . concat (
340
+ cmdLineOptions . bundle ? [ ] : [ shim ] ,
341
+ ) ,
317
342
run : ( ) => {
318
343
// These watch functions return promises that resolve once watch mode has started,
319
344
// allowing them to operate as regular tasks, while creating unresolved promises
320
345
// in the background that keep the process running after all tasks have exited.
321
346
if ( ! printedWatchWarning ) {
322
- console . error ( chalk . yellowBright ( "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ) ) ;
347
+ console . error (
348
+ chalk . yellowBright (
349
+ "Warning: watch mode is incomplete and may not work as expected. Use at your own risk." ,
350
+ ) ,
351
+ ) ;
323
352
printedWatchWarning = true ;
324
353
}
325
354
@@ -363,7 +392,12 @@ export const dtsServices = task({
363
392
description : "Bundles typescript.d.ts" ,
364
393
dependencies : [ buildServices ] ,
365
394
run : async ( ) => {
366
- if ( needsUpdate ( "./built/local/typescript/tsconfig.tsbuildinfo" , [ "./built/local/typescript.d.ts" , "./built/local/typescript.internal.d.ts" ] ) ) {
395
+ if (
396
+ needsUpdate ( "./built/local/typescript/tsconfig.tsbuildinfo" , [
397
+ "./built/local/typescript.d.ts" ,
398
+ "./built/local/typescript.internal.d.ts" ,
399
+ ] )
400
+ ) {
367
401
await runDtsBundler ( "./built/local/typescript/typescript.d.ts" , "./built/local/typescript.d.ts" ) ;
368
402
}
369
403
} ,
@@ -412,8 +446,16 @@ export const dtsLssl = task({
412
446
description : "Bundles tsserverlibrary.d.ts" ,
413
447
dependencies : [ buildLssl ] ,
414
448
run : async ( ) => {
415
- if ( needsUpdate ( "./built/local/tsserverlibrary/tsconfig.tsbuildinfo" , [ "./built/local/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.internal.d.ts" ] ) ) {
416
- await runDtsBundler ( "./built/local/tsserverlibrary/tsserverlibrary.d.ts" , "./built/local/tsserverlibrary.d.ts" ) ;
449
+ if (
450
+ needsUpdate ( "./built/local/tsserverlibrary/tsconfig.tsbuildinfo" , [
451
+ "./built/local/tsserverlibrary.d.ts" ,
452
+ "./built/local/tsserverlibrary.internal.d.ts" ,
453
+ ] )
454
+ ) {
455
+ await runDtsBundler (
456
+ "./built/local/tsserverlibrary/tsserverlibrary.d.ts" ,
457
+ "./built/local/tsserverlibrary.d.ts" ,
458
+ ) ;
417
459
}
418
460
} ,
419
461
} ) ;
@@ -536,7 +578,13 @@ export const watchOtherOutputs = task({
536
578
name : "watch-other-outputs" ,
537
579
description : "Builds miscelaneous scripts and documents distributed with the LKG" ,
538
580
hiddenFromTaskList : true ,
539
- dependencies : [ watchCancellationToken , watchTypingsInstaller , watchWatchGuard , generateTypesMap , copyBuiltLocalDiagnosticMessages ] ,
581
+ dependencies : [
582
+ watchCancellationToken ,
583
+ watchTypingsInstaller ,
584
+ watchWatchGuard ,
585
+ generateTypesMap ,
586
+ copyBuiltLocalDiagnosticMessages ,
587
+ ] ,
540
588
} ) ;
541
589
542
590
export const local = task ( {
@@ -614,7 +662,10 @@ export const runTestsAndWatch = task({
614
662
if ( ! token . signaled ) {
615
663
running = true ;
616
664
try {
617
- await runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , { token, watching : true } ) ;
665
+ await runConsoleTests ( testRunner , "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , {
666
+ token,
667
+ watching : true ,
668
+ } ) ;
618
669
}
619
670
catch {
620
671
// ignore
@@ -773,7 +824,10 @@ export const updateSublime = task({
773
824
dependencies : [ tsserver ] ,
774
825
run : async ( ) => {
775
826
for ( const file of [ "built/local/tsserver.js" , "built/local/tsserver.js.map" ] ) {
776
- await fs . promises . copyFile ( file , path . resolve ( "../TypeScript-Sublime-Plugin/tsserver/" , path . basename ( file ) ) ) ;
827
+ await fs . promises . copyFile (
828
+ file ,
829
+ path . resolve ( "../TypeScript-Sublime-Plugin/tsserver/" , path . basename ( file ) ) ,
830
+ ) ;
777
831
}
778
832
} ,
779
833
} ) ;
@@ -809,7 +863,10 @@ export const produceLKG = task({
809
863
. concat ( localizationTargets )
810
864
. filter ( f => ! fs . existsSync ( f ) ) ;
811
865
if ( missingFiles . length > 0 ) {
812
- 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" ) ) ;
866
+ throw new Error (
867
+ "Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
868
+ + missingFiles . join ( "\n" ) ,
869
+ ) ;
813
870
}
814
871
const sizeBefore = getDirSize ( "lib" ) ;
815
872
await exec ( process . execPath , [ "scripts/produceLKG.mjs" ] ) ;
@@ -841,19 +898,37 @@ export const clean = task({
841
898
export const configureNightly = task ( {
842
899
name : "configure-nightly" ,
843
900
description : "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing" ,
844
- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "dev" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
901
+ run : ( ) =>
902
+ exec ( process . execPath , [
903
+ "scripts/configurePrerelease.mjs" ,
904
+ "dev" ,
905
+ "package.json" ,
906
+ "src/compiler/corePublic.ts" ,
907
+ ] ) ,
845
908
} ) ;
846
909
847
910
export const configureInsiders = task ( {
848
911
name : "configure-insiders" ,
849
912
description : "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing" ,
850
- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "insiders" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
913
+ run : ( ) =>
914
+ exec ( process . execPath , [
915
+ "scripts/configurePrerelease.mjs" ,
916
+ "insiders" ,
917
+ "package.json" ,
918
+ "src/compiler/corePublic.ts" ,
919
+ ] ) ,
851
920
} ) ;
852
921
853
922
export const configureExperimental = task ( {
854
923
name : "configure-experimental" ,
855
924
description : "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing" ,
856
- run : ( ) => exec ( process . execPath , [ "scripts/configurePrerelease.mjs" , "experimental" , "package.json" , "src/compiler/corePublic.ts" ] ) ,
925
+ run : ( ) =>
926
+ exec ( process . execPath , [
927
+ "scripts/configurePrerelease.mjs" ,
928
+ "experimental" ,
929
+ "package.json" ,
930
+ "src/compiler/corePublic.ts" ,
931
+ ] ) ,
857
932
} ) ;
858
933
859
934
export const help = task ( {
0 commit comments