diff --git a/gulpfile.js b/gulpfile.js index 428f0d2e..a17485e6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,6 +3,7 @@ var gulpLoadPlugins = require('gulp-load-plugins'); var browserSync = require('browser-sync'); var del = require('del'); var fs = require('fs'); +var git = require('git-rev-sync'); var $ = gulpLoadPlugins(); var reload = browserSync.reload; @@ -54,6 +55,8 @@ gulp.task('prepare-scripts', function () { return gulp.src([ 'src/scripts/**/*.js' ]).pipe($.plumber()) + .pipe($.injectVersion({replace: '${ARIANG_VERSION}'})) + .pipe($.replace(/\${ARIANG_BUILD_COMMIT}/g, git.short())) .pipe(gulp.dest('.tmp/scripts')) .pipe(reload({stream: true})); }); @@ -70,7 +73,6 @@ gulp.task('prepare-html', ['prepare-styles', 'prepare-scripts', 'prepare-views'] return gulp.src([ 'src/*.html' ]).pipe($.useref({searchPath: ['.tmp', 'src', '.']})) - .pipe($.injectVersion()) .pipe($.if('js/*.js', $.replace(/\/\/# sourceMappingURL=.*/g, ''))) .pipe($.if('css/*.css', $.replace(/\/\*# sourceMappingURL=.* \*\/$/g, ''))) .pipe($.if(['js/moment-with-locales-*.min.js', 'js/plugins.min.js', 'js/aria-ng.min.js'], $.uglify({preserveComments: 'license'}))) diff --git a/package-lock.json b/package-lock.json index cea89dc6..64f12b00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3986,6 +3986,17 @@ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, + "git-rev-sync": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/git-rev-sync/-/git-rev-sync-1.12.0.tgz", + "integrity": "sha1-RGhAbH5sO6TPRYeZnhrbKNnRr1U=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "graceful-fs": "4.1.11", + "shelljs": "0.7.7" + } + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -9656,6 +9667,17 @@ "jsonify": "~0.0.0" } }, + "shelljs": { + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.7.tgz", + "integrity": "sha1-svXHfvlxSPS09uImguELuoZnz/E=", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", diff --git a/package.json b/package.json index 6957ef01..cd420b4d 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "del": "^3.0.0", "eslint-config-angular": "^0.5.0", "eslint-plugin-angular": "^3.3.0", + "git-rev-sync": "^1.12.0", "gulp": "^3.9.1", "gulp-angular-templatecache": "^2.2.1", "gulp-autoprefixer": "^5.0.0", diff --git a/src/index.html b/src/index.html index 65094ff2..b080c312 100644 --- a/src/index.html +++ b/src/index.html @@ -50,7 +50,7 @@