mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
switch from Grunt to gulp
This commit is contained in:
parent
1566421a62
commit
5a34187ed7
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,10 +2,8 @@
|
||||
.tern-port
|
||||
coverage/
|
||||
node_modules/.bin
|
||||
node_modules/grunt*
|
||||
node_modules/gulp*
|
||||
node_modules/istanbul
|
||||
node_modules/jshint
|
||||
node_modules/load-grunt-tasks
|
||||
|
||||
# User-specific files
|
||||
conf.json
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
# development-related files
|
||||
.jshintrc
|
||||
.eslintignore
|
||||
.eslintrc
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Gruntfile.js
|
||||
gulpfile.js
|
||||
|
||||
# scripts for launching JSDoc with Mozilla Rhino
|
||||
/jsdoc*
|
||||
|
||||
@ -2,5 +2,6 @@ language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
|
||||
install: npm install -g grunt-cli; npm install
|
||||
install: npm install -g gulp; npm install
|
||||
|
||||
96
Gruntfile.js
96
Gruntfile.js
@ -1,96 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var os = require('os');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
nodeBin: path.resolve(__dirname, './jsdoc.js'),
|
||||
nodePath: process.execPath,
|
||||
rhinoBin: (function() {
|
||||
var filepath = path.resolve(__dirname, './jsdoc');
|
||||
|
||||
if (os.platform().indexOf('win') === 0) {
|
||||
filepath += '.cmd';
|
||||
}
|
||||
|
||||
return filepath;
|
||||
})(),
|
||||
|
||||
bumpup: {
|
||||
options: {
|
||||
updateProps: {
|
||||
pkg: 'package.json'
|
||||
}
|
||||
},
|
||||
setters: {
|
||||
date: function(oldDate, releaseType, options) {
|
||||
return oldDate;
|
||||
},
|
||||
version: function(oldVersion, releaseType, options) {
|
||||
return oldVersion;
|
||||
},
|
||||
revision: function(oldVersion, releaseType, options) {
|
||||
return String( Date.now() );
|
||||
}
|
||||
},
|
||||
files: ['package.json']
|
||||
},
|
||||
eslint: {
|
||||
target: [
|
||||
'*.js',
|
||||
'lib/**/*.js',
|
||||
'plugins/*.js',
|
||||
'templates/default/*.js',
|
||||
'templates/haruki/*.js'
|
||||
]
|
||||
},
|
||||
shell: {
|
||||
'coverage': {
|
||||
command: './node_modules/.bin/istanbul cover <%= nodeBin %> -- -T',
|
||||
options: {
|
||||
stdout: true,
|
||||
stderr: true
|
||||
}
|
||||
},
|
||||
'test-rhino': {
|
||||
command: '<%= rhinoBin %> -T -q "parser=rhino"',
|
||||
options: {
|
||||
failOnError: true,
|
||||
stdout: true,
|
||||
stderr: true
|
||||
}
|
||||
},
|
||||
'test-rhino-esprima': {
|
||||
command: '<%= rhinoBin %> -T -q "parser=esprima"',
|
||||
options: {
|
||||
failOnError: true,
|
||||
stdout: true,
|
||||
stderr: true
|
||||
}
|
||||
},
|
||||
'test-node': {
|
||||
command: '<%= nodePath %> <%= nodeBin %> -T',
|
||||
options: {
|
||||
failOnError: true,
|
||||
stdout: true,
|
||||
stderr: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require('load-grunt-tasks')(grunt);
|
||||
|
||||
grunt.renameTask('bumpup', 'bump');
|
||||
|
||||
grunt.registerTask('coverage', ['shell:coverage']);
|
||||
|
||||
grunt.registerTask('test-rhino', ['shell:test-rhino']);
|
||||
grunt.registerTask('test-rhino-esprima', ['shell:test-rhino-esprima']);
|
||||
grunt.registerTask('test-node', ['shell:test-node']);
|
||||
grunt.registerTask('test', ['test-rhino', 'test-rhino-esprima', 'test-node', 'eslint']);
|
||||
|
||||
grunt.registerTask('default', ['test']);
|
||||
};
|
||||
82
gulpfile.js
Normal file
82
gulpfile.js
Normal file
@ -0,0 +1,82 @@
|
||||
/*eslint max-nested-callbacks: 0 */
|
||||
'use strict';
|
||||
|
||||
var bump = require('gulp-bump');
|
||||
var eslint = require('gulp-eslint');
|
||||
var exec = require('child_process').exec;
|
||||
var gulp = require('gulp');
|
||||
var istanbul = require('istanbul');
|
||||
var os = require('os');
|
||||
var path = require('path');
|
||||
var util = require('util');
|
||||
|
||||
function execCb(cb, err, stdout, stderr) {
|
||||
console.log(stdout);
|
||||
console.error(stderr);
|
||||
cb(err);
|
||||
}
|
||||
|
||||
var options = {
|
||||
coveragePaths: [
|
||||
'*.js',
|
||||
'lib/**/*.js',
|
||||
'plugins/*.js'
|
||||
],
|
||||
lintPaths: [
|
||||
'*.js',
|
||||
'lib/**/*.js',
|
||||
'plugins/*.js',
|
||||
'templates/default/*.js',
|
||||
'templates/haruki/*.js'
|
||||
],
|
||||
nodeBin: path.resolve(__dirname, './jsdoc.js'),
|
||||
nodePath: process.execPath,
|
||||
rhinoBin: (function() {
|
||||
var filepath = path.resolve(__dirname, './jsdoc');
|
||||
|
||||
if (os.platform().indexOf('win') === 0) {
|
||||
filepath += '.cmd';
|
||||
}
|
||||
|
||||
return filepath;
|
||||
})()
|
||||
};
|
||||
|
||||
gulp.task('bump', function() {
|
||||
gulp.src('./package.json')
|
||||
.pipe(bump({
|
||||
key: 'revision',
|
||||
version: String( Date.now() )
|
||||
}))
|
||||
.pipe(gulp.dest('./'));
|
||||
});
|
||||
|
||||
gulp.task('coverage', function(cb) {
|
||||
var cmd = util.format('./node_modules/.bin/istanbul cover %s -- -T', options.nodeBin);
|
||||
exec(cmd, execCb.bind(null, cb));
|
||||
});
|
||||
|
||||
gulp.task('lint', function() {
|
||||
var pipeline = gulp.src(options.lintPaths)
|
||||
.pipe(eslint())
|
||||
.pipe(eslint.formatEach())
|
||||
.pipe(eslint.failOnError());
|
||||
});
|
||||
|
||||
gulp.task('test-node', function(cb) {
|
||||
var cmd = util.format('%s %s -T', options.nodePath, options.nodeBin);
|
||||
exec(cmd, execCb.bind(null, cb));
|
||||
});
|
||||
|
||||
gulp.task('test-rhino', function(cb) {
|
||||
var cmd = util.format('%s -T -q "parser=rhino"', options.rhinoBin);
|
||||
exec(cmd, execCb.bind(null, cb));
|
||||
});
|
||||
|
||||
gulp.task('test-rhino-esprima', function(cb) {
|
||||
var cmd = util.format('%s -T -q "parser=esprima"', options.rhinoBin);
|
||||
exec(cmd, execCb.bind(null, cb));
|
||||
});
|
||||
|
||||
gulp.task('test', ['lint', 'test-node', 'test-rhino', 'test-rhino-esprima']);
|
||||
gulp.task('default', ['test']);
|
||||
10
package.json
10
package.json
@ -28,12 +28,10 @@
|
||||
"wrench": "~1.3.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-bumpup": "~0.4.2",
|
||||
"grunt-eslint": "~0.4.0",
|
||||
"grunt-shell": "~0.6.1",
|
||||
"gulp": "~3.6.2",
|
||||
"gulp-bump": "~0.1.8",
|
||||
"gulp-eslint": "~0.1.6",
|
||||
"istanbul": "~0.2.1",
|
||||
"load-grunt-tasks": "~0.2.1",
|
||||
"tv4": "https://github.com/hegemonic/tv4/tarball/own-properties"
|
||||
},
|
||||
"engines": {
|
||||
@ -41,7 +39,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./node/postinstall.js",
|
||||
"test": "grunt test"
|
||||
"test": "gulp test"
|
||||
},
|
||||
"bin": {
|
||||
"jsdoc": "./jsdoc.js"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user