-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from realglobe-Inc/fix_warning
存在しないタスクを実行しようとしたら警告を出してほしい realglobe-Inc/pon#13
- Loading branch information
Showing
4 changed files
with
45 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Define CLI Runner | ||
* @function runnable | ||
* @param {string} cwd - Working directory | ||
* @returns {CLIRunner} Runner instance | ||
*/ | ||
'use strict' | ||
const { Ponfile } = require('ponfile') | ||
|
||
/** | ||
* Runner implementation for CLI | ||
*/ | ||
class CLIRunner extends Ponfile { | ||
run (...patterns) { | ||
return Promise.resolve( | ||
super.run(...arguments) | ||
).then((result) => { | ||
let isEmpty = Object.keys(result).length === 0 | ||
if (isEmpty) { | ||
let specified = patterns.length > 1 ? patterns : patterns[ 0 ] | ||
console.warn(`No task found for: ${JSON.stringify(specified)}`) | ||
} | ||
return result | ||
}) | ||
} | ||
} | ||
|
||
module.exports = (cwd) => new CLIRunner(cwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters