Chromium Code Reviews| Index: web/apps/gulp-common.js |
| diff --git a/web/apps/gulp-common.js b/web/apps/gulp-common.js |
| index be7fc0d95b7ca09408a412ef8dfb32322721c9c7..ebd87ef7b437ba13f0b3b2e40c0d319101646ab0 100644 |
| --- a/web/apps/gulp-common.js |
| +++ b/web/apps/gulp-common.js |
| @@ -109,12 +109,16 @@ exports.setup_common = function(gulp) { |
| }; |
| // Project-specific tasks. |
| -exports.setup = function(gulp, config) { |
| - var APP = path.basename(config.dir); |
| +exports.setup = function(gulp, appDir, config) { |
| + var APP = path.basename(appDir); |
| var DIST = path.join(exports.out, 'dist', APP); |
| + console.log("APP:", APP) |
| var layout = { |
| app: APP, |
| + dir: process.cwd(), |
| + web: '../..', |
| + inc: './inc', |
| distPath: DIST, |
| // NOTE: Takes vararg via "arguments". |
| @@ -160,7 +164,7 @@ exports.setup = function(gulp, config) { |
| var optimizeHtmlTask = function(src, dest) { |
| var assets = $.useref.assets({ |
| - searchPath: ['.tmp', config.dir] |
| + searchPath: ['.tmp', '.'] |
| }); |
| return gulp.src(src) |
| @@ -190,21 +194,20 @@ exports.setup = function(gulp, config) { |
| // Transpiles "inc/*/*.ts" and deposits the result alongside their source |
| // "ts" files. |
| gulp.task('ts', function() { |
| - // Transpile each TypeScript module independently into JavaScript. |
| - var tsconfigPath = path.join(exports.incDir, 'tsconfig.json'); |
| - |
| // Compile the files in "scripts-ts/*.ts" into a single out file. |
| - var scriptsTs = path.join(config.dir, 'scripts-ts'); |
| - var tsProj = ts.createProject(tsconfigPath, { |
| + var appTsDir = path.join(layout.inc, 'apps', layout.app); |
| + var tsProj = ts.createProject(path.join(layout.inc, 'tsconfig.json'), { |
| typeRoots: [path.join(exports.base, 'node_modules', '@types')], |
| - outFile: 'main.js', |
| + outFile: path.join(appTsDir, 'main.js'), |
| }); |
| - return gulp.src('*.ts', {cwd: scriptsTs, exclude: ['*_test.ts']}) |
| + return gulp.src(path.join(layout.inc, 'apps', layout.app, '*.ts'), { |
| + exclude: ['*_test.ts'], |
| + }) |
| .pipe(sourcemaps.init()) |
| - .pipe(tsProj()) |
| - .pipe(sourcemaps.write('.')) |
| - .pipe(gulp.dest(scriptsTs)); |
| + .pipe(tsProj()) |
| + .pipe(sourcemaps.write('.')) |
| + .pipe(gulp.dest(layout.inc)) |
| }); |
| // Compile and automatically prefix stylesheets |
| @@ -294,6 +297,9 @@ exports.setup = function(gulp, config) { |
| // Watch files for changes & reload |
| gulp.task('serve', ['default'], function() { |
| + console.log("CURRENT WORKING DIRECTORY MAYBE CHANGE TO APP DIR:", process.cwd()); |
|
Ryan Tseng
2017/07/28 13:48:40
???
dnj
2017/07/28 13:50:36
oops.
|
| + //process.chdir(layout.dir); |
|
Ryan Tseng
2017/07/28 13:48:40
This supposed to be here?
dnj
2017/07/28 13:50:36
nope, thanks for catching.
|
| + |
| browserSync({ |
| port: 5000, |
| ui: { |