Skip to content

Commit

Permalink
Merge pull request #331 from lewisl9029/dev-inject-prod-flag
Browse files Browse the repository at this point in the history
Injecting prod flag and disabling logging. Closes #329
  • Loading branch information
lewisl9029 committed Sep 13, 2015
2 parents 809ce9d + eb0fdc9 commit 0e22dd4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
window.console.debug = function () {};
};
// need to brute force this since telehash v2 has no config option for logging
// disableLogging();
if (window.tocProd) {
disableLogging();
}

//TODO: optimize spinner removal timing
// Record time here
Expand Down
2 changes: 1 addition & 1 deletion app/services/state/state-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default /*@ngInject*/ function state(
cloud: {}
},
{
// immutable: false
immutable: !$window.tocProd
});

// baobab update events are batched, so this approach is reasonably performant
Expand Down
12 changes: 12 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var jshint = require('gulp-jshint');
var header = require('gulp-header');
var htmlhint = require('gulp-htmlhint');
var scsslint = require('gulp-scsslint');
var jsbeautifier = require('gulp-jsbeautifier');
Expand Down Expand Up @@ -90,6 +91,7 @@ gulp.task('build', function build(done) {
'clean-build',
'uncache-jspm',
['build-js', 'build-html', 'build-asset'],
'inject-js',
// 'cache-jspm',
done
);
Expand Down Expand Up @@ -136,6 +138,16 @@ gulp.task('build-js', ['build-jspm'], function buildJs() {
.pipe(gulp.dest(basePaths.prod));
});

gulp.task('inject-js', function injectJs() {
return gulp.src([
basePaths.prod + 'initialize.js',
], {
base: basePaths.prod
})
.pipe(gulpif(argv.prod, header('window.tocProd=true;')))
.pipe(gulp.dest(basePaths.prod));
});

gulp.task('build-jspm', ['bundle-jspm'], function buildJspm() {
return gulp.src(basePaths.prod + 'app.js')
.pipe(gulpif(argv.prod, ngAnnotate()))
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"chai": "^3.2.0",
"del": "^2.0.1",
"gulp": "^3.9.0",
"gulp-header": "^1.7.1",
"gulp-htmlhint": "^0.3.0",
"gulp-if": "^1.2.5",
"gulp-jsbeautifier": "^1.0.1",
Expand Down Expand Up @@ -153,4 +154,4 @@
"locator": "android"
}
]
}
}

0 comments on commit 0e22dd4

Please sign in to comment.