From 635caa9ad04a7ac8ffd639f0dad71da17eb8c343 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 15 Aug 2017 09:16:19 -0400 Subject: [PATCH] preprocess dist for self hosted --- build.ps1 | 2 +- build.sh | 2 +- gulpfile.js | 15 +++++++++++---- src/index.html | 2 ++ src/js/analytics.js | 4 +++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/build.ps1 b/build.ps1 index b75d046fce..5bfd6feb2f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -6,7 +6,7 @@ echo "`nBuilding app" echo "npm version $(npm --version)" echo "gulp version $(gulp --version)" npm install -gulp dist +gulp dist:selfHosted echo "`nBuilding docker image" docker --version diff --git a/build.sh b/build.sh index ebbec0bd5d..bbb1e48fe9 100644 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ echo -e "\nBuilding app" echo -e "npm version $(npm --version)" echo -e "gulp version $(gulp --version)" npm install -gulp dist +gulp dist:selfHosted echo -e "\nBuilding docker image" docker --version diff --git a/gulpfile.js b/gulpfile.js index df84dc36bd..43efb1ebd7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -74,6 +74,7 @@ gulp.task('min:js', ['clean:js'], function () { '!' + paths.jsDir + 'duo.js', '!' + paths.jsDir + 'settings.js' ], { base: '.' }) + .pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } })) .pipe(concat(paths.concatJsDest)) .pipe(uglify()) .pipe(gulp.dest('.')); @@ -369,7 +370,7 @@ gulp.task('dist:css', function () { paths.cssDir + '**/*.css', '!' + paths.cssDir + '**/*.min.css' ]) - .pipe(preprocess({ context: { cacheTag: randomString } })) + .pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } })) .pipe(cssmin()) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest(paths.dist + 'css')); @@ -385,7 +386,7 @@ gulp.task('dist:js:app', function () { ]); merge(mainStream, config()) - .pipe(preprocess({ context: { cacheTag: randomString } })) + .pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } })) .pipe(concat(paths.dist + '/js/app.min.js')) .pipe(ngAnnotate()) .pipe(uglify()) @@ -399,7 +400,7 @@ gulp.task('dist:js:fallback', function () { ]); merge(mainStream) - .pipe(preprocess({ context: { cacheTag: randomString } })) + .pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } })) .pipe(uglify()) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest(paths.dist + 'js')); @@ -437,7 +438,7 @@ gulp.task('dist:preprocess', function () { .src([ paths.dist + '/**/*.html' ], { base: '.' }) - .pipe(preprocess({ context: { cacheTag: randomString } })) + .pipe(preprocess({ context: { cacheTag: randomString, selfHosted: selfHosted } })) .pipe(gulp.dest('.')); }); @@ -449,6 +450,12 @@ gulp.task('dist', ['build'], function (cb) { cb); }); +var selfHosted = false; +gulp.task('dist:selfHosted', function (cb) { + selfHosted = true; + return runSequence('dist', cb); +}); + gulp.task('deploy', ['dist'], function () { return gulp.src(paths.dist + '**/*') .pipe(ghPages({ cacheDir: paths.dist + '.publish' })); diff --git a/src/index.html b/src/index.html index 7c7be586d1..c2c051f8bb 100644 --- a/src/index.html +++ b/src/index.html @@ -53,8 +53,10 @@ bitwarden.com Password Manager +