From 2f875ac89c9401bc31922ee08ef05fe9792e3bf6 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 17 Jun 2016 08:40:48 +0200 Subject: [PATCH] Begin working on website --- gulpfile.js | 32 ++++++++++++++++++++++++++++++++ package.json | 5 +++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 9c2b6bb1..e16a3c79 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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'); + })) + ); + +}); \ No newline at end of file diff --git a/package.json b/package.json index 3a626818..0a4a5b2b 100644 --- a/package.json +++ b/package.json @@ -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" } }