ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit ab5a48f01441d99f2ed9ca49c7716fce3869f06b
parent 318a5cad52b6242d455b9f04205d4f82fc2b260a
Author: Konstantin Tarkus <hello@tarkus.me>
Date:   Tue, 15 Jul 2014 03:32:02 +0400

Update node.js modules

Diffstat:
Mgulpfile.js | 39+++++++++++++++++++--------------------
Mpackage.json | 14+++++++-------
2 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/gulpfile.js b/gulpfile.js @@ -3,12 +3,10 @@ * Copyright (c) KriaSoft, LLC. All rights reserved. See LICENSE.txt */ -/* - * For more information on how to configure Gulp, please visit: - * https://github.com/gulpjs/gulp/blob/master/docs/API.md - */ +'use strict'; -// Include Gulp & other tools for build automation +// Include Gulp and other build automation tools and utilities +// See: https://github.com/gulpjs/gulp/blob/master/docs/API.md var gulp = require('gulp'); var $ = require('gulp-load-plugins')(); var es = require('event-stream'); @@ -18,9 +16,10 @@ var webpack = require('webpack'); var argv = require('minimist')(process.argv.slice(2)); // Settings +var DEST = './build'; var DEBUG = !argv.release; -var WATCH = Boolean(argv.watch); -var LOG = Boolean(argv.log); +var WATCH = !!argv.watch; +var LOG = !!argv.log; // Node.js runtime dependencies and their version numbers var pkgs = require('./package.json').dependencies; @@ -30,7 +29,7 @@ Object.keys(pkgs).forEach(function (key) { return pkgs[key] = pkgs[key].substrin // ----------------------------------------------------------------------------- gulp.task('clean', function (cb) { var rimraf = require('rimraf'); - rimraf('./build', cb); + rimraf(DEST, cb); }); // Copy vendor files @@ -38,9 +37,9 @@ gulp.task('clean', function (cb) { gulp.task('vendor', function () { return es.merge( gulp.src('./node_modules/jquery/dist/**') - .pipe(gulp.dest('./build/vendor/jquery-' + pkgs.jquery)), + .pipe(gulp.dest(DEST + '/vendor/jquery-' + pkgs.jquery)), gulp.src('./node_modules/bootstrap/dist/fonts/**') - .pipe(gulp.dest('./build/fonts')) + .pipe(gulp.dest(DEST + '/fonts')) ); }); @@ -49,9 +48,9 @@ gulp.task('vendor', function () { gulp.task('assets', function () { return es.merge( gulp.src('./src/assets/**') - .pipe(gulp.dest('./build')), + .pipe(gulp.dest(DEST)), gulp.src('./src/images/**') - .pipe(gulp.dest('./build/images/')), + .pipe(gulp.dest(DEST + '/images/')), gulp.src('./src/*.html') .pipe(DEBUG ? $.util.noop() : $.htmlmin({ removeComments: true, @@ -59,7 +58,7 @@ gulp.task('assets', function () { minifyJS: true })) .pipe(DEBUG ? $.embedlr() : $.util.noop()) - .pipe(gulp.dest('./build')) + .pipe(gulp.dest(DEST)) ); }); @@ -71,7 +70,7 @@ gulp.task('styles', function () { .pipe($.less({sourceMap: DEBUG, sourceMapBasepath: __dirname})) .on('error', $.util.log) .pipe(DEBUG ? $.util.noop() : $.minifyCss()) - .pipe(gulp.dest('./build/css')); + .pipe(gulp.dest(DEST + '/css')); }); // Create JavaScript bundle @@ -112,15 +111,15 @@ gulp.task('serve', ['build'], function (next) { // For non-existent files output the contents of /index.html page in order to make HTML5 routing work var urlPath = url.parse(req.url).pathname; if (urlPath === '/') { - req.url = '/build/index.html'; + req.url = DEST.substring(1) + '/index.html'; } else if (['src', 'bower_components'].indexOf(urlPath.split('/')[1]) === -1) { if (urlPath.length > 3 && ['src', 'bower_components'].indexOf(urlPath.split('/')[1]) === -1 && ['css', 'html', 'ico', 'js', 'png', 'txt', 'xml'].indexOf(urlPath.split('.').pop()) == -1 && ['fonts', 'images', 'vendor', 'views'].indexOf(urlPath.split('/')[1]) == -1) { - req.url = '/build/index.html'; + req.url = DEST.substring(1) + '/index.html'; } else { - req.url = '/build' + req.url; + req.url = DEST.substring(1) + req.url; } } server(req, res); @@ -142,8 +141,8 @@ gulp.task('watch', ['serve'], function () { gulp.watch('./src/**/*.less', ['styles']); // Watch for changes in 'compiled' files - gulp.watch('./build/**', function (file) { - var relPath = 'build\\' + path.relative('./build', file.path); + gulp.watch(DEST + '/**', function (file) { + var relPath = DEST.substring(2) + '\\' + path.relative(DEST, file.path); $.util.log('File changed: ' + $.util.colors.magenta(relPath)); lr.changed(file.path); }); @@ -156,7 +155,7 @@ gulp.task('watch', ['serve'], function () { gulp.task('deploy', ['build'], function (cb) { var url = 'https://github.com/{name}/{name}.github.io.git'; var exec = require('child_process').exec; - var cwd = path.join(__dirname, './build'); + var cwd = path.join(__dirname, DEST); var cmd = 'git init && git remote add origin ' + url + ' && ' + 'git add . && git commit -m Release && ' + 'git push -f origin master'; diff --git a/package.json b/package.json @@ -12,27 +12,27 @@ "devDependencies": { "ecstatic": "^0.5.4", "event-stream": "^3.1.5", - "gulp": "^3.8.5", + "gulp": "^3.8.6", "gulp-changed": "^0.4.0", "gulp-embedlr": "^0.5.2", "gulp-htmlmin": "^0.1.3", - "gulp-jshint": "^1.6.4", + "gulp-jshint": "^1.7.1", "gulp-less": "^1.3.1", "gulp-livereload": "^2.1.0", "gulp-load-plugins": "^0.5.3", "gulp-minify-css": "^0.3.6", "gulp-plumber": "^0.6.3", "gulp-uglify": "^0.3.1", - "gulp-util": "^2.2.19", - "jshint-stylish": "^0.2.0", + "gulp-util": "^2.2.20", + "jshint-stylish": "^0.4.0", "jsx-loader": "^0.10.2", - "karma": "^0.12.16", + "karma": "^0.12.17", "minimist": "^0.2.0", - "protractor": "^1.0.0-rc2", + "protractor": "^1.0.0-rc4", "rimraf": "^2.2.8", "run-sequence": "^0.3.6", "url-loader": "^0.5.5", - "webpack": "^1.3.1-beta7" + "webpack": "^1.3.1-beta8" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1"