@@ -128,6 +128,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
128
128
}
129
129
130
130
var useDebugMode = false ;
131
+ var generateDeclarations = false ;
131
132
var host = ( process . env . host || process . env . TYPESCRIPT_HOST || "node" ) ;
132
133
var compilerFilename = "tsc.js" ;
133
134
/* Compiles a file from a list of sources
@@ -142,6 +143,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
142
143
file ( outFile , prereqs , function ( ) {
143
144
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory ;
144
145
var options = "-removeComments --module commonjs -noImplicitAny " ; //" -propagateEnumConstants "
146
+ if ( generateDeclarations ) {
147
+ options += "--declaration " ;
148
+ }
145
149
146
150
var cmd = host + " " + dir + compilerFilename + " " + options + " " ;
147
151
if ( useDebugMode ) {
@@ -250,7 +254,7 @@ task("local", ["generate-diagnostics", "lib", tscFile, servicesFile]);
250
254
// Local target to build the compiler and services
251
255
desc ( "Emit debug mode files with sourcemaps" ) ;
252
256
task ( "debug" , function ( ) {
253
- useDebugMode = true ;
257
+ useDebugMode = true ;
254
258
} ) ;
255
259
256
260
@@ -264,6 +268,12 @@ task("clean", function() {
264
268
jake . rmRf ( builtDirectory ) ;
265
269
} ) ;
266
270
271
+ // generate declarations for compiler and services
272
+ desc ( "Generate declarations for compiler and services" ) ;
273
+ task ( "declaration" , function ( ) {
274
+ generateDeclarations = true ;
275
+ } ) ;
276
+
267
277
// Generate Markdown spec
268
278
var word2mdJs = path . join ( scriptsDirectory , "word2md.js" ) ;
269
279
var word2mdTs = path . join ( scriptsDirectory , "word2md.ts" ) ;
@@ -283,12 +293,12 @@ compileFile(word2mdJs,
283
293
// The generated spec.md; built for the 'generate-spec' task
284
294
file ( specMd , [ word2mdJs , specWord ] , function ( ) {
285
295
jake . cpR ( headerMd , specMd , { silent : true } ) ;
286
- var specWordFullPath = path . resolve ( specWord ) ;
296
+ var specWordFullPath = path . resolve ( specWord ) ;
287
297
var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" >>' + specMd ;
288
- console . log ( cmd ) ;
289
- child_process . exec ( cmd , function ( ) {
290
- complete ( ) ;
291
- } ) ;
298
+ console . log ( cmd ) ;
299
+ child_process . exec ( cmd , function ( ) {
300
+ complete ( ) ;
301
+ } ) ;
292
302
} , { async : true } )
293
303
294
304
0 commit comments