forked from sunriselink/TelegramApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (44 loc) · 1.34 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var version = require('./package.json').version;
var about = require('fs')
.readFileSync('./.files/about.txt', 'utf8')
.replace('{VERSION}', version);
gulp.task('clean', function () {
return gulp.src([
'example/js',
'dist/'
]).pipe($.clean({force: true}));
});
gulp.task('js', function () {
return gulp.src([
'node_modules/long/dist/long.min.js',
'node_modules/zlibjs/bin/gunzip.min.js',
'node_modules/rusha/rusha.min.js',
'node_modules/ioc-js/dist/ioc-js.min.js',
'src/vendor/**/*.js',
'src/js/**/*.js',
'src/telegramApi.js',
'src/IoC.js'
])
.pipe($.concat('telegramApi.js'))
.pipe($.replace(/<%TELEGRAM-API-VERSION%>/g, version))
.pipe($.wrapper({
header: about + '(function(){\n',
footer: '\n})();'
}))
.pipe(gulp.dest('dist'))
.pipe($.rename({suffix: '.min'}))
.pipe($.uglify())
.pipe($.wrapper({header: about}))
.pipe(gulp.dest('dist'));
});
gulp.task('copy', function () {
gulp.src('dist/**/*.js')
.pipe(gulp.dest('example/js'));
});
gulp.task('server', function () {
gulp.src('example')
.pipe($.webserver({open: true}));
});
gulp.task('build', ['clean', 'js']);