Browse Source

Fixed gulp bugs

master
Igor Zhukov 11 years ago
parent
commit
e362ff26da
  1. 10
      .gitignore
  2. 2
      app/css/app.css
  3. 8
      app/index.html
  4. 8
      app/js/app.js
  5. 2
      app/js/background.js
  6. 2
      app/js/controllers.js
  7. 2
      app/js/directives.js
  8. 2
      app/js/filters.js
  9. 2
      app/js/lib/aes_worker.js
  10. 8
      app/js/lib/mtproto.js
  11. 4
      app/js/lib/pq_worker.js
  12. 6
      app/js/lib/sha1_worker.js
  13. 2
      app/js/services.js
  14. 2
      app/js/util.js
  15. 75
      gulpfile.js
  16. 2
      package.json

10
.gitignore vendored

@ -1,11 +1,11 @@
.DS_Store .DS_Store
.idea .idea
*.sublime-workspace
# Node.js package manager # Node.js package manager
/node_modules node_modules
/npm-debug.log npm-debug.log
dist dist
package_dist releases
webogram*.zip webogram*.zip
app/js/partials.js app/js/templates.js
*.sublime-workspace

2
app/css/app.css

@ -484,7 +484,7 @@ input[type="number"]::-webkit-inner-spin-button {
margin-right: -7px; margin-right: -7px;
} }
.im_dialogs_col .nano > .pane { .im_dialogs_col .nano > .pane {
background : rgba(0,0,0,.0); background : rgba(0,0,0,0.0);
width : 12px; width : 12px;
right: 0px; right: 0px;
-webkit-transition : .2s; -webkit-transition : .2s;

8
app/index.html

@ -44,13 +44,17 @@
<script type="text/javascript" src="js/lib/config.js"></script> <script type="text/javascript" src="js/lib/config.js"></script>
<script type="text/javascript" src="js/lib/mtproto.js"></script> <script type="text/javascript" src="js/lib/mtproto.js"></script>
<script type="text/javascript" src="js/util.js"></script> <script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/partials.js"></script>
<script type="text/javascript" src="js/app.js"></script> <script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/services.js"></script> <script type="text/javascript" src="js/services.js"></script>
<script type="text/javascript" src="js/controllers.js"></script> <script type="text/javascript" src="js/controllers.js"></script>
<script type="text/javascript" src="js/filters.js"></script> <script type="text/javascript" src="js/filters.js"></script>
<!--PRODUCTION_ONLY_BEGIN
<script type="text/javascript" src="js/templates.js"></script>
PRODUCTION_ONLY_END-->
<script type="text/javascript" src="js/directives.js"></script> <script type="text/javascript" src="js/directives.js"></script>
<!-- endbuild --> <!-- endbuild -->

8
app/js/app.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE
@ -30,10 +30,12 @@ angular.module('myApp', [
'ngAnimate', 'ngAnimate',
'ngSanitize', 'ngSanitize',
'ui.bootstrap', 'ui.bootstrap',
'partials', 'mtproto.services',
'myApp.filters', 'myApp.filters',
'myApp.services', 'myApp.services',
'mtproto.services', /*PRODUCTION_ONLY_BEGIN
'myApp.templates',
PRODUCTION_ONLY_END*/
'myApp.directives', 'myApp.directives',
'myApp.controllers' 'myApp.controllers'
]). ]).

2
app/js/background.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/controllers.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/directives.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/filters.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/lib/aes_worker.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE

8
app/js/lib/mtproto.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE
@ -1122,7 +1122,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu
console.log('PQ factorization start'); console.log('PQ factorization start');
if (!!window.Worker) { if (!!window.Worker) {
var worker = new Worker('js/lib/pq_worker.js?1'); var worker = new Worker('js/lib/pq_worker.js');
worker.onmessage = function (e) { worker.onmessage = function (e) {
auth.p = e.data[0]; auth.p = e.data[0];
@ -1416,7 +1416,7 @@ factory('MtpAesService', function ($q) {
}; };
} }
var worker = new Worker('js/lib/aes_worker.js?2'), var worker = new Worker('js/lib/aes_worker.js'),
taskID = 0, taskID = 0,
awaiting = {}; awaiting = {};
@ -1468,7 +1468,7 @@ factory('MtpSha1Service', function ($q) {
}; };
} }
var worker = new Worker('js/lib/sha1_worker.js?2'), var worker = new Worker('js/lib/sha1_worker.js'),
taskID = 0, taskID = 0,
awaiting = {}; awaiting = {};

4
app/js/lib/pq_worker.js

@ -1,12 +1,12 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE
*/ */
importScripts( importScripts(
'../../vendor/console-polyfill/console-polyfill.js?1', '../../vendor/console-polyfill/console-polyfill.js',
'mtproto.js', 'mtproto.js',
'../../vendor/jsbn/jsbn_combined.js' '../../vendor/jsbn/jsbn_combined.js'
); );

6
app/js/lib/sha1_worker.js

@ -1,14 +1,14 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE
*/ */
importScripts( importScripts(
'../../vendor/console-polyfill/console-polyfill.js?1', '../../vendor/console-polyfill/console-polyfill.js',
'mtproto.js', 'mtproto.js',
'../../vendor/cryptoJS/crypto.js?1' '../../vendor/cryptoJS/crypto.js'
); );
onmessage = function (e) { onmessage = function (e) {

2
app/js/services.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE

2
app/js/util.js

@ -1,5 +1,5 @@
/*! /*!
* Webogram v0.0.1 - messaging web application for MTProto * Webogram v0.0.19 - messaging web application for MTProto
* https://github.com/zhukov/webogram * https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> * Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE * https://github.com/zhukov/webogram/blob/master/LICENSE

75
gulpfile.js

@ -4,28 +4,29 @@ var pj = require('./package.json');
var $ = require('gulp-load-plugins')(); var $ = require('gulp-load-plugins')();
var concat = require('gulp-concat'); var concat = require('gulp-concat');
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'));
});
// The generated file is being created at src // The generated file is being created at src
// so it can be fetched by usemin. // so it can be fetched by usemin.
gulp.task('templates', function() { gulp.task('templates', function() {
return gulp.src('app/partials/*.html') return gulp.src('app/partials/*.html')
.pipe($.angularTemplatecache('partials.js', { .pipe($.angularTemplatecache('templates.js', {
root: 'partials', root: 'partials',
module: 'partials', module: 'myApp.templates',
standalone: true standalone: true
})) }))
.pipe(gulp.dest('app/js')); .pipe(gulp.dest('app/js'));
}); });
gulp.task('usemin', ['templates', 'enable-production'], 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('copy', function() { gulp.task('copy', function() {
return es.concat( return es.concat(
gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js']) gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js'])
@ -46,13 +47,13 @@ gulp.task('copy', function() {
}); });
gulp.task('compress-dist', ['add-csp'], function() { gulp.task('compress-dist', ['add-csp'], function() {
return es.concat( return gulp.src('dist/**/*')
gulp.src('dist/*') .pipe($.zip('webogram_v' + pj.version + '.zip'))
.pipe($.zip('webogram_v' + pj.version + '.zip')) .pipe(gulp.dest('releases'));
.pipe(gulp.dest('package')), });
gulp.src('package/*.zip')
.pipe(gulp.dest('.')) gulp.task('cleanup-dist', ['compress-dist'], function() {
); return gulp.src(['releases/**/*', '!releases/*.zip']).pipe($.clean());
}); });
gulp.task('add-csp', ['build'], function() { gulp.task('add-csp', ['build'], function() {
@ -74,22 +75,48 @@ gulp.task('update-version-settings', function() {
}); });
gulp.task('update-version-comments', function() { gulp.task('update-version-comments', function() {
return gulp.src('app/**/*') return gulp.src('app/**/*.js')
.pipe($.grepStream('Webogram v'))
.pipe($.replace(/Webogram v[0-9.]*/, 'Webogram v' + pj.version)) .pipe($.replace(/Webogram v[0-9.]*/, 'Webogram v' + pj.version))
.pipe(gulp.dest('app')); .pipe(gulp.dest('app'));
}); });
gulp.task('enable-production', function() {
return es.concat(
gulp.src('app/**/*.html')
.pipe($.replace(/PRODUCTION_ONLY_BEGIN/g, 'PRODUCTION_ONLY_BEGIN-->'))
.pipe($.replace(/PRODUCTION_ONLY_END/, '<!--PRODUCTION_ONLY_END'))
.pipe(gulp.dest('app')),
gulp.src('app/**/*.js')
.pipe($.replace(/PRODUCTION_ONLY_BEGIN(\*\/)?/g, 'PRODUCTION_ONLY_BEGIN*/'))
.pipe($.replace(/(\/\*)?PRODUCTION_ONLY_END/g, '/*PRODUCTION_ONLY_END'))
.pipe(gulp.dest('app'))
);
});
gulp.task('disable-production', function() {
return es.concat(
gulp.src('app/index.html')
.pipe($.replace(/PRODUCTION_ONLY_BEGIN-->/g, 'PRODUCTION_ONLY_BEGIN'))
.pipe($.replace(/<!--PRODUCTION_ONLY_END/g, 'PRODUCTION_ONLY_END'))
.pipe(gulp.dest('app')),
gulp.src('app/**/*.js')
.pipe($.replace(/PRODUCTION_ONLY_BEGIN(\*\/)?/g, 'PRODUCTION_ONLY_BEGIN'))
.pipe($.replace(/(\/\*)?PRODUCTION_ONLY_END/g, 'PRODUCTION_ONLY_END'))
.pipe(gulp.dest('app'))
);
});
gulp.task('clean', function() { gulp.task('clean', function() {
return gulp.src('dist').pipe($.clean()); return gulp.src(['dist/*', '!dist/.git']).pipe($.clean());
}); });
gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']); gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']);
gulp.task('build', ['templates', 'usemin', 'copy']); gulp.task('build', ['templates', 'usemin', 'copy'], function () {
gulp.task('package', ['compress-dist'], function() { gulp.start('disable-production');
gulp.src('package').pipe($.clean());
}); });
gulp.task('package', ['cleanup-dist']);
gulp.task('default', ['clean'], function() { gulp.task('default', ['clean'], function() {
gulp.start('build'); gulp.start('build');

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "webogram", "name": "webogram",
"version": "0.0.1", "version": "0.0.19",
"description": "UNOFFICIAL Telegram Web App.", "description": "UNOFFICIAL Telegram Web App.",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {

Loading…
Cancel
Save