From 3c8bc9b3808367c1f6ee2406b551b90cd6d6c4f3 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 16 Jun 2016 12:42:17 +0200 Subject: [PATCH] append to monaco.d.ts from all plugins --- gulpfile.js | 37 +++++++++++++++++++++++++++++-------- package.json | 6 +++--- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index ea704f0f..737a5f8b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -35,7 +35,7 @@ gulp.task('release', ['clean-release'], function() { 'node_modules/monaco-editor-core/monaco.d.ts', 'node_modules/monaco-editor-core/ThirdPartyNotices.txt', 'README.md' - ]).pipe(gulp.dest('release')) + ]).pipe(addPluginDTS()).pipe(gulp.dest('release')) ) }); @@ -48,13 +48,6 @@ function releaseOne(type) { ) } -function mergePluginsContribsIntoCore(coreStream) { - return ( - coreStream - .pipe(addPluginContribs()) - ); -} - function pluginStreams(destinationPath) { return es.merge( metadata.METADATA.PLUGINS.map(function(plugin) { @@ -127,3 +120,31 @@ function addPluginContribs() { this.emit('data', data); }); } + +/** + * Edit monaco.d.ts: + * - append monaco.d.ts from plugins + */ +function addPluginDTS() { + return es.through(function(data) { + if (!/monaco\.d\.ts$/.test(data.path)) { + this.emit('data', data); + return; + } + var contents = data.contents.toString(); + + var extraContent = []; + metadata.METADATA.PLUGINS.forEach(function(plugin) { + var dtsPath = path.join(plugin.path, 'monaco.d.ts'); + try { + extraContent.push(fs.readFileSync(dtsPath).toString()); + } catch (err) { + return; + } + }); + + contents += '\n' + extraContent.join('\n'); + data.contents = new Buffer(contents); + this.emit('data', data); + }); +} \ No newline at end of file diff --git a/package.json b/package.json index 1a774a1c..a069df43 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,9 @@ "event-stream": "^3.3.2", "gulp": "^3.9.1", "http-server": "^0.9.0", - "monaco-editor-core": "0.3.1", - "monaco-languages": "0.1.1", - "monaco-typescript": "0.1.1", + "monaco-editor-core": "0.4.0", + "monaco-languages": "0.2.0", + "monaco-typescript": "0.2.0", "rimraf": "^2.5.2" } }