Skip to content

Commit

Permalink
fix(core): Prevent user-task from reporting errors with no return
Browse files Browse the repository at this point in the history
  • Loading branch information
Marinerer committed Sep 26, 2023
1 parent 9836edc commit 6742eb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 1 addition & 10 deletions packages/core/build/user.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
const { gulp, glob, lodash, merge } = require('@pipflow/utils')
const { pipeline } = require('../base/utils')

module.exports = function userTask(options = {}, done) {
const { compiler, plugins } = options

// 1. 自定义处理函数
if (typeof compiler === 'function') {
return compiler(
{
gulp,
glob,
lodash,
merge
},
done
)
return compiler(done)
}

// 2. 自定义处理流程
Expand Down
3 changes: 2 additions & 1 deletion packages/main/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ if (CC.tasks?.length > 0) {
})

// 🍱 所有自定义任务
task(item.name, done => {
// !使用async函数,防止用户自定义任务无返回值导致报错
task(item.name, async done => {
return taskMap[item.type]?.(item, done)
})
}
Expand Down

0 comments on commit 6742eb1

Please sign in to comment.