Skip to content

Commit 024fa67

Browse files
authored
Add version and build version (#174)
Make the property QB.version public; Added the property QB.versionBuild, also as public; Added the gulp generate-build_version task and added in npm run build; Show in samples (chat, webrtc) v.{version}.{versionBuild};
1 parent 676a0a6 commit 024fa67

File tree

12 files changed

+294
-235
lines changed

12 files changed

+294
-235
lines changed

gulpfile.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,30 @@ gulp.task('connect', function() {
3333
});
3434
});
3535

36+
gulp.task('generate-build_version', function() {
37+
var fs = require('fs');
38+
const configPath = './src/qbConfig.js';
39+
40+
function incBuildNumber(foundedString, p1, buildNumber, p2) {
41+
var oldBuildNumber = +buildNumber;
42+
43+
return p1 + (oldBuildNumber + 1) + p2;
44+
}
45+
46+
fs.readFile(configPath, 'utf8', function (error, config) {
47+
if (error) {
48+
throw new Error(error);
49+
}
50+
var result = config.replace(/(buildNumber:\s\')(\d{4})(')/g, incBuildNumber);
51+
52+
fs.writeFile(configPath, result, 'utf8', function (error) {
53+
if (error) {
54+
throw new Error(error);
55+
}
56+
});
57+
});
58+
});
59+
3660
gulp.task('watch', function () {
3761
gulp.watch(['./src/**/*.js'], ['build']);
3862
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"scripts": {
7575
"setDependencies": "npm i && npm install -g gulp-cli && npm install -g jasmine",
7676
"lint": "jshint src --reporter=node_modules/jshint-stylish",
77-
"build": "npm run lint && gulp build",
77+
"build": "npm run lint && gulp generate-build_version && gulp build",
7878
"develop": "cross-env NODE_ENV=develop gulp",
7979
"start": "gulp connect"
8080
}

0 commit comments

Comments
 (0)