v0.0.5 仅检查改动文件
This commit is contained in:
parent
a2228f369f
commit
f9f099a48c
4
.babelrc
4
.babelrc
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
'presets': ['es2015', 'stage-2'],
|
"presets": ["es2015", "stage-2"],
|
||||||
'plugins': ['transform-runtime']
|
"plugins": ["transform-runtime"]
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,12 @@ request.post('/api').form({key:'value'}), function(err,httpResponse,body){ /* ..
|
|||||||
|
|
||||||
删除gulpfile.js中的lint、eslint_start两个任务,并且把default改为“gulp.task('default', ['start']”。
|
删除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*
|
*v0.0.4 2017年02月07日15:57:17*
|
||||||
1、修改了部分配置文件的配置方法,使之更为规范(老版本用户无须理会,对程序没有影响)。
|
1、修改了部分配置文件的配置方法,使之更为规范(老版本用户无须理会,对程序没有影响)。
|
||||||
|
28
gulpfile.js
28
gulpfile.js
@ -8,7 +8,22 @@ if (process.env.npm_config_argv.indexOf('debug') > 0) {
|
|||||||
jsScript = 'node debug'
|
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/**'])
|
return gulp.src(['src/**/*.js', '!node_modules/**'])
|
||||||
.pipe(eslint({configFile: './.eslintrc.js'}))
|
.pipe(eslint({configFile: './.eslintrc.js'}))
|
||||||
.pipe(eslint.format(friendlyFormatter))
|
.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({
|
var stream = nodemon({
|
||||||
script: 'build/dev-server.js',
|
script: 'build/dev-server.js',
|
||||||
execMap: {
|
execMap: {
|
||||||
js: jsScript
|
js: jsScript
|
||||||
},
|
},
|
||||||
tasks: ['lint'],
|
tasks: function (changedFiles) {
|
||||||
|
lintOne(changedFiles)
|
||||||
|
return []
|
||||||
|
},
|
||||||
verbose: true,
|
verbose: true,
|
||||||
ignore: ['build/*.js', 'dist/*.js', 'nodemon.json', '.git', 'node_modules/**/node_modules', 'gulpfile.js'],
|
ignore: ['build/*.js', 'dist/*.js', 'nodemon.json', '.git', 'node_modules/**/node_modules', 'gulpfile.js'],
|
||||||
env: {
|
env: {
|
||||||
@ -46,7 +64,7 @@ gulp.task('eslint_start', ['lint'], function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('start', function () {
|
gulp.task('nodemon', function () {
|
||||||
return nodemon({
|
return nodemon({
|
||||||
script: 'build/dev-server.js',
|
script: 'build/dev-server.js',
|
||||||
execMap: {
|
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检查完成')
|
// console.log('ESlin检查完成')
|
||||||
})
|
})
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"description": "Koa2 RESTful API 服务器的脚手架",
|
"description": "Koa2 RESTful API 服务器的脚手架",
|
||||||
"author": "轶哥 <a@wyr.me>",
|
"author": "轶哥 <a@wyr.me>",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "gulp start",
|
"start": "gulp nodemon",
|
||||||
"dev": "gulp",
|
"dev": "gulp",
|
||||||
"build": "babel src -d dist",
|
"build": "babel src -d dist",
|
||||||
"production": "node dist/app.js"
|
"production": "node dist/app.js"
|
||||||
|
Loading…
Reference in New Issue
Block a user