Преглед изворни кода

Add VsCode Dev tools (still awaiting tsac watch and multi tasks)

sevan пре 8 година
родитељ
комит
17e94abfba
5 измењених фајлова са 66 додато и 14 уклоњено
  1. 1 0
      .gitignore
  2. 3 10
      .vscode/launch.json
  3. 1 1
      Playground/Program.cs
  4. 57 1
      Tools/Gulp/gulpfile.js
  5. 4 2
      Tools/Gulp/package.json

+ 1 - 0
.gitignore

@@ -130,3 +130,4 @@ node_modules
 .vscode
 /.vs
 /Playground/project.lock.json
+.tempChromeProfileForDebug

+ 3 - 10
.vscode/launch.json

@@ -2,20 +2,13 @@
     "version": "0.1.0",
     "configurations": [
         {
-            "name": "Launch playground (Edge)",
-            "type": "edge",
-            "request": "launch",
-            "url": "http://localhost/playground/index-local.html",
-            "webRoot": "${workspaceRoot}/",
-            "sourceMaps": true
-        },
-        {
             "name": "Launch playground (Chrome)",
             "type": "chrome",
             "request": "launch",
-            "url": "http://localhost/playground/index-local.html",
+            "url": "http://localhost:1338/Playground/index-local.html",
             "webRoot": "${workspaceRoot}/",
-            "sourceMaps": true
+            "sourceMaps": true,
+            "userDataDir": "${workspaceRoot}/.tempChromeProfileForDebug"
         }
     ]
 }

+ 1 - 1
Playground/Program.cs

@@ -6,7 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.FileProviders;
 using Microsoft.Extensions.Logging;
 
-namespace TestTestTest
+namespace BabylonJS.Playground
 {
     public class Startup
     {

+ 57 - 1
Tools/Gulp/gulpfile.js

@@ -9,15 +9,18 @@ var merge2 = require("merge2");
 var concat = require("gulp-concat");
 var rename = require("gulp-rename");
 var cleants = require('gulp-clean-ts-extends');
-var changed = require('gulp-changed');
+var changedInPlace = require('gulp-changed-in-place');
 var runSequence = require('run-sequence');
 var replace = require("gulp-replace");
 var uncommentShader = require("./gulp-removeShaderComments");
 var expect = require('gulp-expect-file');
 var optimisejs = require('gulp-optimize-js');
+var webserver = require('gulp-webserver');
+const path = require('path');
 
 var config = require("./config.json");
 
+var debug = require('gulp-debug');
 var includeShadersStream;
 var shadersStream;
 var workersStream;
@@ -203,3 +206,56 @@ gulp.task('watch', function () {
 gulp.task('watch-typescript', function () {
     gulp.watch(config.core.typescript, ["typescript-compile", "build"]);
 });
+
+
+/**
+ * Watch typescript task, will call the default typescript task if a typescript file is updated.
+ */
+var tsProject = typescript.createProject({
+            noExternalResolve: true,
+            target: 'ES5',
+            declarationFiles: true,
+            typescript: require('typescript'),
+            experimentalDecorators: true,
+            isolatedModules: false,
+
+        });
+
+gulp.task('run-watch-compile', function () {
+    var tsResult = gulp.src(config.core.typescript)
+        //.pipe(changedInPlace())
+        .pipe(sourcemaps.init())
+        .pipe(typescript(tsProject));
+
+    return merge2([
+        tsResult.dts
+            .pipe(concat(config.build.declarationFilename))
+            .pipe(gulp.dest(config.build.outputDirectory)),
+        tsResult.js
+            .pipe(replace('"use strict";', ''))
+            //.pipe(debug())
+            .pipe(sourcemaps.write("./", 
+            {
+                includeContent:false, 
+                sourceRoot: (filePath) => {
+                    var repeatCount = filePath.relative.split(path.sep).length - 1;
+                    return '../'.repeat(repeatCount); 
+                }
+            }))
+            .pipe(gulp.dest(config.build.srcOutputDirectory))
+    ])
+});
+
+gulp.task('run-watch', ['run-watch-compile'], function () {
+    return gulp.watch(config.core.typescript, ['run-watch-compile']);
+});
+
+gulp.task('run-webserver', function () {
+    gulp.src('../../.').pipe(webserver({
+      port: 1338,
+      livereload: false
+    }));
+});
+
+gulp.task('run', ['run-watch', 'run-webserver'], function () {
+});

+ 4 - 2
Tools/Gulp/package.json

@@ -18,11 +18,13 @@
     "merge2": "~0.3.5",
     "gulp-rename": "~1.2.2",
     "gulp-clean-ts-extends": "~0.1.1",
-    "gulp-changed": "~1.2.1",
+    "gulp-changed-in-place": "2.0.3",
     "run-sequence": "~1.1.0",
     "gulp-replace": "~0.5.3",
     "gulp-content-to-variable": "^0.1.0",
     "gulp-expect-file": "^0.0.7",
-    "gulp-optimize-js": "^1.0.2"
+    "gulp-optimize-js": "^1.0.2",
+    "gulp-webserver": "^0.9.1",
+    "gulp-debug": "^3.0.0"
   }
 }