use gulp instead of grunt

This commit is contained in:
Michael Barrett 2015-04-30 11:37:57 +01:00
parent cfff9bd086
commit 0a205f5e8a
9 changed files with 64 additions and 61 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
/node_modules/ /node_modules/
/build/

2
.jscsrc Normal file
View File

@ -0,0 +1,2 @@
{
}

View File

@ -1,10 +1,11 @@
.editorconfig .editorconfig
.gitignore .gitignore
.jshintrc .jshintrc
.jscsrc
.travis.yml .travis.yml
bower.json bower.json
CHANGELOG.md CHANGELOG.md
Gruntfile.js Gulpfile.js
LICENSE LICENSE
README.md README.md
/test/ /test/

View File

@ -1,8 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- "0.6"
- "0.8"
- "0.10" - "0.10"
- "0.11" - "0.11"
- "0.12" - "0.12"
@ -15,7 +13,4 @@ cache:
directories: directories:
- node_modules - node_modules
before_script: script: gulp ci
- npm install -g grunt-cli
script: grunt test

View File

@ -1,43 +0,0 @@
module.exports = function(grunt) {
// measure the time each task takes
require('time-grunt')(grunt);
// autoload Grunt tasks
require('load-grunt-tasks')(grunt);
// main project config
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
dist: {
files: {
'dist/<%= pkg.name %>.min.js': 'src/<%= pkg.name %>.js'
}
}
},
jshint: {
options: {
jshintrc: true
},
files: [
'Gruntfile.js',
'src/<%= pkg.name %>.js',
'test/**/*.js'
]
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
}
}
});
// user defined tasks
grunt.registerTask('test', ['mochaTest']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('build', ['uglify']);
grunt.registerTask('default', ['jshint', 'mochaTest', 'uglify']);
};

44
Gulpfile.js Normal file
View File

@ -0,0 +1,44 @@
var gulp = require('gulp');
var $ = require('gulp-load-plugins')({
scope: 'devDependencies'
});
var runSequence = require('run-sequence');
gulp.task('lint', function () {
gulp.src('src/**/*.js')
.pipe($.jshint('.jshintrc'))
.pipe($.jshint.reporter('jshint-stylish'));
});
gulp.task('cs', function () {
return gulp.src('src/**/*.js')
.pipe($.jscs());
});
gulp.task('test', function () {
return gulp.src('test/**/*.js', { read: false })
.pipe($.mocha());
});
gulp.task('minify', function () {
return gulp.src('src/*.js')
.pipe($.sourcemaps.init())
.pipe($.uglify())
.pipe($.rename({
extname: '.min.js'
}))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('build', function (callback) {
runSequence(
['lint', 'cs', 'test'],
'minify',
callback
);
});
gulp.task('ci', ['lint', 'cs', 'test']);
gulp.task('default', ['build']);

View File

@ -11,7 +11,7 @@
"ignore": [ "ignore": [
"**/.*", "**/.*",
"CHANGELOG.md", "CHANGELOG.md",
"Gruntfile.js", "Gulpfile.js",
"LICENSE", "LICENSE",
"README.md", "README.md",
"node_modules", "node_modules",

File diff suppressed because one or more lines are too long

View File

@ -10,13 +10,17 @@
"main": "timestring.js", "main": "timestring.js",
"version": "1.1.0", "version": "1.1.0",
"devDependencies": { "devDependencies": {
"chai": "^1.9.1", "chai": "^2.3.0",
"grunt": "^0.4.5", "gulp": "^3.8.11",
"grunt-contrib-jshint": "^0.10.0", "gulp-jscs": "^1.6.0",
"grunt-contrib-uglify": "^0.5.0", "gulp-jshint": "^1.10.0",
"grunt-mocha-test": "^0.11.0", "gulp-load-plugins": "^0.10.0",
"load-grunt-tasks": "^0.6.0", "gulp-mocha": "^2.0.1",
"mocha": "^1.20.1", "gulp-rename": "^1.2.2",
"time-grunt": "^0.4.0" "gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^1.2.0",
"jshint-stylish": "^1.0.1",
"mocha": "^2.2.4",
"run-sequence": "^1.1.0"
} }
} }