-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
32 additions
and
26 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
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import isCi from 'is-ci' | ||
import renameFn from 'rename-fn' | ||
|
||
import { parseOpts } from './options.js' | ||
import { execCommand } from './exec.js' | ||
|
||
// Create a Gulp task | ||
export const task = function(input, opts) { | ||
const optsA = { ...opts, ...FORCED_OPTS } | ||
const optsB = parseOpts(optsA) | ||
const optsA = parseOpts({ opts, defaultOpts, forcedOpts }) | ||
|
||
const gulpTask = execCommand.bind(null, input, optsB) | ||
const gulpTask = execCommand.bind(null, input, optsA) | ||
|
||
// Log the command and arguments as the inner function name | ||
renameFn(gulpTask, input) | ||
|
||
return gulpTask | ||
} | ||
|
||
const defaultOpts = { verbose: isCi } | ||
// The `echo` option is not needed since the function name shows it already | ||
const FORCED_OPTS = { echo: false } | ||
const forcedOpts = { echo: false } |
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,7 @@ | ||
// Like Lodash pickBy() | ||
export const pickBy = function(object, condition) { | ||
const pairs = Object.entries(object).filter(([key, value]) => | ||
condition(value, key), | ||
) | ||
return Object.fromEntries(pairs) | ||
} |