v0.0.5 仅检查改动文件

This commit is contained in:
yi-ge 2017-02-12 01:28:00 +08:00
parent a2228f369f
commit f9f099a48c
4 changed files with 33 additions and 10 deletions

View File

@ -1,4 +1,4 @@
{
'presets': ['es2015', 'stage-2'],
'plugins': ['transform-runtime']
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime"]
}

View File

@ -471,9 +471,14 @@ request.post('/api').form({key:'value'}), function(err,httpResponse,body){ /* ..
删除gulpfile.js中的lint、eslint_start两个任务并且把default改为“gulp.task('default', ['start']”。
## 更新说明
更新说明
--------
*v0.0.5 2017年02月12日01:25:34*
1、修改了gulpfile.js文件在更改文件热重启的时候无需检查全部文件仅检查改动文件开发速度更快。
2、修改了package.json中"start"项的值为"gulp nodemon"配合gulpfile.js文件的修改。
*v0.0.4 2017年02月07日15:57:17*
1、修改了部分配置文件的配置方法使之更为规范老版本用户无须理会对程序没有影响
2、修改了eslintrc.js文件中的JavaScript版本配置改为ES8兼容async、await。
3、修改gulpfile.js文件第12行检查`src/**/*.js`文件。
3、修改gulpfile.js文件第12行检查`src/**/*.js`文件。

View File

@ -8,7 +8,22 @@ if (process.env.npm_config_argv.indexOf('debug') > 0) {
jsScript = 'node debug'
}
gulp.task('lint', () => {
function lintOne (aims) {
console.log('ESlint:' + aims)
console.time('Finished eslint')
return gulp.src(aims)
.pipe(eslint({configFile: './.eslintrc.js'}))
.pipe(eslint.format(friendlyFormatter))
.pipe(eslint.results(results => {
// Called once for all ESLint results.
console.log(`- Total Results: ${results.length}`)
console.log(`- Total Warnings: ${results.warningCount}`)
console.log(`- Total Errors: ${results.errorCount}`)
console.timeEnd('Finished eslint')
}))
}
gulp.task('ESlint', () => {
return gulp.src(['src/**/*.js', '!node_modules/**'])
.pipe(eslint({configFile: './.eslintrc.js'}))
.pipe(eslint.format(friendlyFormatter))
@ -21,13 +36,16 @@ gulp.task('lint', () => {
}))
})
gulp.task('eslint_start', ['lint'], function () {
gulp.task('ESlint_nodemon', ['ESlint'], function () {
var stream = nodemon({
script: 'build/dev-server.js',
execMap: {
js: jsScript
},
tasks: ['lint'],
tasks: function (changedFiles) {
lintOne(changedFiles)
return []
},
verbose: true,
ignore: ['build/*.js', 'dist/*.js', 'nodemon.json', '.git', 'node_modules/**/node_modules', 'gulpfile.js'],
env: {
@ -46,7 +64,7 @@ gulp.task('eslint_start', ['lint'], function () {
})
})
gulp.task('start', function () {
gulp.task('nodemon', function () {
return nodemon({
script: 'build/dev-server.js',
execMap: {
@ -61,6 +79,6 @@ gulp.task('start', function () {
})
})
gulp.task('default', ['lint', 'eslint_start'], function () {
gulp.task('default', ['ESlint', 'ESlint_nodemon'], function () {
// console.log('ESlin检查完成')
})

View File

@ -4,7 +4,7 @@
"description": "Koa2 RESTful API 服务器的脚手架",
"author": "轶哥 <a@wyr.me>",
"scripts": {
"start": "gulp start",
"start": "gulp nodemon",
"dev": "gulp",
"build": "babel src -d dist",
"production": "node dist/app.js"