Browse Source

Begin working on website

Alex Dima 9 years ago
parent
commit
2f875ac89c
2 changed files with 35 additions and 2 deletions
  1. 32 0
      gulpfile.js
  2. 3 2
      package.json

+ 32 - 0
gulpfile.js

@@ -5,6 +5,7 @@ var es = require('event-stream');
 var path = require('path');
 var path = require('path');
 var fs = require('fs');
 var fs = require('fs');
 var rimraf = require('rimraf');
 var rimraf = require('rimraf');
+var cp = require('child_process');
 
 
 var SAMPLES_MDOC_PATH = path.join(__dirname, 'website/playground/playground.mdoc');
 var SAMPLES_MDOC_PATH = path.join(__dirname, 'website/playground/playground.mdoc');
 var WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/samples');
 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);
 	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');
+		}))
+	);
+
+});

+ 3 - 2
package.json

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