1
- import childProcess from "child_process" ;
2
1
import fs from "fs-extra" ;
3
2
import path from "path" ;
4
3
import glob from "glob" ;
5
4
import url from "url" ;
5
+ import del from "del" ;
6
6
7
7
const __filename = url . fileURLToPath ( new URL ( import . meta. url ) ) ;
8
8
const __dirname = path . dirname ( __filename ) ;
@@ -14,12 +14,13 @@ const copyright = fs.readFileSync(path.join(__dirname, "../CopyrightNotice.txt")
14
14
15
15
async function produceLKG ( ) {
16
16
console . log ( `Building LKG from ${ source } to ${ dest } ` ) ;
17
+ await del ( `${ dest . replace ( / \\ / g, "/" ) } /**` , { ignore : [ "**/README.md" ] } ) ;
18
+ await fs . mkdirp ( dest ) ;
17
19
await copyLibFiles ( ) ;
18
20
await copyLocalizedDiagnostics ( ) ;
19
21
await copyTypesMap ( ) ;
20
22
await copyScriptOutputs ( ) ;
21
23
await copyDeclarationOutputs ( ) ;
22
- await buildProtocol ( ) ;
23
24
await writeGitAttributes ( ) ;
24
25
}
25
26
@@ -46,20 +47,6 @@ async function copyTypesMap() {
46
47
await copyFromBuiltLocal ( "typesMap.json" ) ; // Cannot accommodate copyright header
47
48
}
48
49
49
- async function buildProtocol ( ) {
50
- const protocolScript = path . join ( __dirname , "buildProtocol.mjs" ) ;
51
- if ( ! fs . existsSync ( protocolScript ) ) {
52
- throw new Error ( `Expected protocol script ${ protocolScript } to exist` ) ;
53
- }
54
-
55
- const protocolInput = path . join ( __dirname , "../src/server/protocol.ts" ) ;
56
- const protocolServices = path . join ( source , "typescriptServices.d.ts" ) ;
57
- const protocolOutput = path . join ( dest , "protocol.d.ts" ) ;
58
-
59
- console . log ( `Building ${ protocolOutput } ...` ) ;
60
- await exec ( protocolScript , [ protocolInput , protocolServices , protocolOutput ] ) ;
61
- }
62
-
63
50
async function copyScriptOutputs ( ) {
64
51
await copyWithCopyright ( "cancellationToken.js" ) ;
65
52
await copyWithCopyright ( "tsc.release.js" , "tsc.js" ) ;
@@ -109,16 +96,6 @@ async function copyFilesWithGlob(pattern) {
109
96
console . log ( `Copied ${ files . length } files matching pattern ${ pattern } ` ) ;
110
97
}
111
98
112
- /**
113
- * @param {string } path
114
- * @param {string[] } args
115
- */
116
- async function exec ( path , args = [ ] ) {
117
- const cmdLine = [ "node" , path , ...args ] . join ( " " ) ;
118
- console . log ( cmdLine ) ;
119
- childProcess . execSync ( cmdLine ) ;
120
- }
121
-
122
99
process . on ( "unhandledRejection" , err => {
123
100
throw err ;
124
101
} ) ;
0 commit comments