Begin working on website

This commit is contained in:
Alex Dima 2016-06-17 08:40:48 +02:00
parent 585767bf5e
commit 2f875ac89c
2 changed files with 35 additions and 2 deletions

View file

@ -5,6 +5,7 @@ var es = require('event-stream');
var path = require('path');
var fs = require('fs');
var rimraf = require('rimraf');
var cp = require('child_process');
var SAMPLES_MDOC_PATH = path.join(__dirname, 'website/playground/playground.mdoc');
var WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/samples');
@ -292,3 +293,34 @@ this.ALL_SAMPLES = ${JSON.stringify(allSamples)};`
fs.writeFileSync(path.join(WEBSITE_GENERATED_PATH, 'all.js'), content);
});
gulp.task('clean-website', function(cb) { rimraf('../monaco-editor-website', { maxBusyTries: 1 }, cb); });
gulp.task('website', ['clean-website', 'playground-samples'], function() {
return (
gulp.src('website/**/*')
.pipe(es.through(function(data) {
if (!data.contents || !/\.(js|html)$/.test(data.path)) {
return this.emit('data', data);
}
var contents = data.contents.toString();
contents = contents.replace(/\.\.\/release\/min/g, 'node_modules/monaco-editor/min');
// contents = contents.replace('© 2016 Microsoft', '© 2016 Microsoft [' + builtTime + ']');
data.contents = new Buffer(contents);
this.emit('data', data);
}))
.pipe(gulp.dest('../monaco-editor-website'))
.pipe(es.through(function(data) {
this.emit('data', data);
}, function() {
cp.execSync('npm install monaco-editor', {
cwd: path.join(__dirname, '../monaco-editor-website')
});
this.emit('end');
}))
);
});

View file

@ -7,7 +7,8 @@
"license": "MIT",
"scripts": {
"simpleserver": "node_modules/.bin/http-server -c-1 ../",
"release": "node_modules/.bin/gulp release"
"release": "node_modules/.bin/gulp release",
"website": "node_modules/.bin/gulp website"
},
"repository": {
"type": "git",
@ -19,7 +20,7 @@
"http-server": "^0.9.0",
"monaco-editor-core": "0.4.2",
"monaco-languages": "0.2.0",
"monaco-typescript": "0.2.0",
"monaco-typescript": "0.2.1",
"rimraf": "^2.5.2"
}
}