Skip to content

Commit 78478a4

Browse files
committed
resolve conflicts
2 parents af6d2e5 + 8892d56 commit 78478a4

File tree

15 files changed

+6239
-925
lines changed

15 files changed

+6239
-925
lines changed

.jshintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/plugins/jquery.ajax.js

gulpfile.js

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ var source = require('vinyl-source-stream');
88
var connect = require('gulp-connect');
99
var notify = require('gulp-notify');
1010

11+
var uglify = require('gulp-uglify');
12+
var pump = require('pump');
13+
14+
var fs = require('fs');
15+
var builder = require('jquery-custom');
16+
1117
gulp.task('build', function () {
1218
var isDevelopment = process.env.NODE_ENV === 'develop',
1319
browserifyOpts = {
@@ -18,12 +24,21 @@ gulp.task('build', function () {
1824
return browserify('./src/qbMain.js', browserifyOpts)
1925
.bundle()
2026
.on('error', function(error) {
21-
notify('Failed when create a bundle <%= error.message %>')
27+
notify('Failed when create a bundle <%= error.message %>');
2228
this.emit('end');
2329
})
2430
.pipe(source('quickblox.min.js'))
25-
.pipe(notify('Build task is finished.'))
26-
.pipe(gulp.dest('./'));
31+
.pipe(gulp.dest('./'))
32+
.pipe(notify('Build task is finished.'));
33+
});
34+
35+
gulp.task('minify', function () {
36+
pump([
37+
gulp.src('./quickblox.min.js'),
38+
uglify(),
39+
notify('Minify task is finished.'),
40+
gulp.dest('./')
41+
]);
2742
});
2843

2944
gulp.task('connect', function() {
@@ -33,6 +48,62 @@ gulp.task('connect', function() {
3348
});
3449
});
3550

51+
gulp.task('generate-build_version', function() {
52+
var fs = require('fs');
53+
const configPath = './src/qbConfig.js';
54+
55+
function incBuildNumber(foundedString, p1, buildNumber, p2) {
56+
var oldBuildNumber = +buildNumber;
57+
58+
return p1 + (oldBuildNumber + 1) + p2;
59+
}
60+
61+
fs.readFile(configPath, 'utf8', function (error, config) {
62+
if (error) {
63+
throw new Error(error);
64+
}
65+
var result = config.replace(/(buildNumber:\s\')(\d{4})(')/g, incBuildNumber);
66+
67+
fs.writeFile(configPath, result, 'utf8', function (error) {
68+
if (error) {
69+
throw new Error(error);
70+
}
71+
});
72+
});
73+
});
74+
75+
gulp.task('jquery', function () {
76+
return builder({
77+
flags: [
78+
'-deprecated',
79+
'-dimensions',
80+
'-effects',
81+
'-event',
82+
'-event/alias',
83+
'-event/focusin',
84+
'-event/trigger',
85+
'-offset',
86+
'-wrap',
87+
'-core/ready',
88+
'-exports/global',
89+
'-sizzle'
90+
],
91+
}, function (err, compiledContent) {
92+
if (err){
93+
notify('Can\'t build jquery lib.');
94+
return console.error(err);
95+
}
96+
97+
fs.writeFile('./src/plugins/jquery.ajax.js', compiledContent, function (err) {
98+
if (err){
99+
notify('Can\'t build jquery lib.');
100+
return console.error(err);
101+
}
102+
notify('Jquery task is finished.');
103+
})
104+
})
105+
});
106+
36107
gulp.task('watch', function () {
37108
gulp.watch(['./src/**/*.js'], ['build']);
38109
});

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@
5252
"gulp": "^3.9.1",
5353
"gulp-connect": "^5.0.0",
5454
"gulp-notify": "^2.2.0",
55+
"gulp-uglify": "^2.0.0",
5556
"jaguarjs-jsdoc": "^1.0.1",
56-
"jasmine": "^2.4.1",
5757
"jsdoc": "^3.4.3",
58+
"jasmine": "^2.4.1",
59+
"jquery-custom": "^1.1.1",
5860
"jshint": "^2.9.3",
5961
"jshint-stylish": "^2.2.1",
62+
"pump": "^1.0.1",
6063
"vinyl-source-stream": "^1.1.0"
6164
},
6265
"autoupdate": {
@@ -76,9 +79,8 @@
7679
"scripts": {
7780
"setDependencies": "npm i && npm install -g gulp-cli && npm install -g jasmine",
7881
"lint": "jshint src --reporter=node_modules/jshint-stylish",
79-
"build": "npm run lint && gulp build && npm run doc",
82+
"build": "npm run lint && gulp generate-build_version && gulp build && gulp minify && npm run doc",
8083
"develop": "cross-env NODE_ENV=develop gulp",
81-
"start": "gulp connect",
82-
"doc": "rm -r doc || mkdir doc && jsdoc -c ./jsdoc.conf.json"
84+
"start": "gulp connect"
8385
}
8486
}

0 commit comments

Comments
 (0)