append to monaco.d.ts from all plugins
This commit is contained in:
Родитель
99bc54b159
Коммит
3c8bc9b380
37
gulpfile.js
37
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);
|
||||
});
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче