Pablo Terradillos
11 years ago
18 changed files with 212 additions and 81 deletions
@ -0,0 +1,86 @@
@@ -0,0 +1,86 @@
|
||||
var gulp = require('gulp'); |
||||
var es = require('event-stream'); |
||||
var pj = require('./package.json'); |
||||
var $ = require('gulp-load-plugins')(); |
||||
var concat = require('gulp-concat'); |
||||
|
||||
// The generated file is being created at src
|
||||
// so it can be fetched by usemin.
|
||||
gulp.task('templates', function() { |
||||
return gulp.src('app/partials/*.html') |
||||
.pipe($.angularTemplatecache('partials.js', { |
||||
root: 'partials', |
||||
module: 'partials', |
||||
standalone: true |
||||
})) |
||||
.pipe(gulp.dest('app/js')); |
||||
}); |
||||
|
||||
gulp.task('copy', function() { |
||||
return es.concat( |
||||
gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js', 'app/img/**/*', '!app/img/screenshot*']) |
||||
.pipe(gulp.dest('dist')), |
||||
gulp.src('app/vendor/console-polyfill/console-polyfill.js') |
||||
.pipe(gulp.dest('dist/vendor/console-polyfill')), |
||||
gulp.src('app/js/lib/mtproto.js') |
||||
.pipe(gulp.dest('dist/js/lib')), |
||||
gulp.src('app/js/lib/config.js') |
||||
.pipe(gulp.dest('dist/js/lib')), |
||||
gulp.src('app/vendor/jsbn/jsbn_combined.js') |
||||
.pipe(gulp.dest('dist/vendor/jsbn')), |
||||
gulp.src('app/vendor/cryptoJS/crypto.js') |
||||
.pipe(gulp.dest('dist/vendor/cryptoJS')) |
||||
); |
||||
}); |
||||
|
||||
gulp.task('update-version-manifests', function() { |
||||
return gulp.src(['app/manifest.webapp', 'app/manifest.json']) |
||||
.pipe($.replace(/"version": ".*",/, '"version": "' + pj.version + '",')) |
||||
.pipe(gulp.dest('app')); |
||||
}); |
||||
|
||||
gulp.task('update-version-settings', function() { |
||||
return gulp.src('app/partials/settings_modal.html') |
||||
.pipe($.replace(/<span class="settings_version">alpha .*<\/span>/, '<span class="settings_version">alpha ' + pj.version + '<\/span>')) |
||||
.pipe(gulp.dest('app/partials')); |
||||
}); |
||||
|
||||
gulp.task('update-version-comments', function() { |
||||
return gulp.src('app/**/*') |
||||
.pipe($.grepStream('Webogram v')) |
||||
.pipe($.replace(/Webogram v[0-9.]*/, 'Webogram v' + pj.version)) |
||||
.pipe(gulp.dest('app')); |
||||
}); |
||||
|
||||
gulp.task('usemin', ['templates'], function() { |
||||
return gulp.src('app/index.html') |
||||
.pipe($.usemin({ |
||||
html: [$.minifyHtml({empty: true})], |
||||
js: ['concat', $.rev()], |
||||
css: [$.minifyCss(), 'concat'] |
||||
})) |
||||
.pipe(gulp.dest('dist')); |
||||
}); |
||||
|
||||
gulp.task('clean', function() { |
||||
return gulp.src('dist').pipe($.clean()); |
||||
}); |
||||
|
||||
gulp.task('compress-dist', function() { |
||||
return es.concat( |
||||
gulp.src('dist/*') |
||||
.pipe($.zip('webogram_v' + pj.version + '.zip')) |
||||
.pipe(gulp.dest('package')), |
||||
gulp.src('package/*.zip') |
||||
.pipe(gulp.dest('.')), |
||||
gulp.src('package/**/*').pipe($.clean()) |
||||
); |
||||
}); |
||||
|
||||
gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']); |
||||
gulp.task('build', ['clean', 'templates', 'usemin', 'copy']); |
||||
gulp.task('package', ['build', 'compress-dist']); |
||||
|
||||
gulp.task('default', function() { |
||||
gulp.start('build'); |
||||
}); |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
{ |
||||
"name": "webogram", |
||||
"version": "0.0.1", |
||||
"description": "UNOFFICIAL Telegram Web App.", |
||||
"main": "server.js", |
||||
"scripts": { |
||||
"start": "node server.js" |
||||
}, |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "https://github.com/zhukov/webogram.git" |
||||
}, |
||||
"author": "zhukov", |
||||
"license": "GPL", |
||||
"bugs": { |
||||
"url": "https://github.com/zhukov/webogram/issues" |
||||
}, |
||||
"homepage": "http://zhukov.github.io/webogram", |
||||
"devDependencies": { |
||||
"gulp": "~3.5.5", |
||||
"gulp-angular-templatecache": "^1.1.0", |
||||
"gulp-load-plugins": "^0.4.0", |
||||
"gulp-usemin": "^0.3.3", |
||||
"gulp-uglify": "^0.2.1", |
||||
"gulp-rev": "^0.3.0", |
||||
"gulp-minify-css": "^0.3.0", |
||||
"gulp-minify-html": "^0.1.1", |
||||
"gulp-imagemin": "^0.1.5", |
||||
"gulp-clean": "^0.2.4", |
||||
"gulp-replace": "^0.2.0", |
||||
"gulp-concat": "^2.1.7", |
||||
"gulp-grep-stream": "0.0.2", |
||||
"event-stream": "^3.1.0", |
||||
"gulp-zip": "^0.1.2" |
||||
} |
||||
} |
Loading…
Reference in new issue