Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(928)

Unified Diff: web/apps/gulp-common.js

Issue 2985273002: [web] Restructure and fix builds. (Closed)
Patch Set: clean Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « web/.gitignore ('k') | web/apps/logdog-app/elements/logdog-app/logdog-app.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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: {
« no previous file with comments | « web/.gitignore ('k') | web/apps/logdog-app/elements/logdog-app/logdog-app.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698