Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@
"code",
"test"
]
},
{
"login": "ryansully",
"name": "Ryan Sullivan",
"avatar_url": "https://avatars3.githubusercontent.com/u/51629?v=4",
"profile": "http://ryansully.com/",
"contributions": [
"code",
"test"
]
}
]
],
"repoType": "github"
}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Utilities for [nps][nps] (npm-package-scripts)
[![downloads][downloads-badge]][npm-stat]
[![MIT License][license-badge]][LICENSE]

[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Donate][donate-badge]][donate]
[![Code of Conduct][coc-badge]][coc]
Expand Down Expand Up @@ -102,8 +102,9 @@ list them here!
Thanks goes to these people ([emoji key][emojis]):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/nps-utils/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/nps-utils/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/nps-utils/commits?author=kentcdodds) | [<img src="https://avatars2.githubusercontent.com/u/7352279?v=3" width="100px;"/><br /><sub>Huy Nguyen</sub>](https://www.huy-nguyen.com/)<br />[📖](https://github.com/kentcdodds/nps-utils/commits?author=huy-nguyen) 🚇 | [<img src="https://avatars1.githubusercontent.com/u/1970063?v=4" width="100px;"/><br /><sub>Keith Gunn</sub>](https://github.com/gunnx)<br />[🐛](https://github.com/kentcdodds/nps-utils/issues?q=author%3Agunnx) [💻](https://github.com/kentcdodds/nps-utils/commits?author=gunnx) [📖](https://github.com/kentcdodds/nps-utils/commits?author=gunnx) [⚠️](https://github.com/kentcdodds/nps-utils/commits?author=gunnx) | [<img src="https://avatars3.githubusercontent.com/u/215033?v=4" width="100px;"/><br /><sub>Mike Cann</sub>](http://www.mikecann.co.uk)<br />[💻](https://github.com/kentcdodds/nps-utils/commits?author=mikecann) [⚠️](https://github.com/kentcdodds/nps-utils/commits?author=mikecann) |
| :---: | :---: | :---: | :---: |
<!-- prettier-ignore -->
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/nps-utils/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/nps-utils/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/nps-utils/commits?author=kentcdodds "Tests") | [<img src="https://avatars2.githubusercontent.com/u/7352279?v=3" width="100px;"/><br /><sub><b>Huy Nguyen</b></sub>](https://www.huy-nguyen.com/)<br />[📖](https://github.com/kentcdodds/nps-utils/commits?author=huy-nguyen "Documentation") [🚇](#infra-huy-nguyen "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars1.githubusercontent.com/u/1970063?v=4" width="100px;"/><br /><sub><b>Keith Gunn</b></sub>](https://github.com/gunnx)<br />[🐛](https://github.com/kentcdodds/nps-utils/issues?q=author%3Agunnx "Bug reports") [💻](https://github.com/kentcdodds/nps-utils/commits?author=gunnx "Code") [📖](https://github.com/kentcdodds/nps-utils/commits?author=gunnx "Documentation") [⚠️](https://github.com/kentcdodds/nps-utils/commits?author=gunnx "Tests") | [<img src="https://avatars3.githubusercontent.com/u/215033?v=4" width="100px;"/><br /><sub><b>Mike Cann</b></sub>](http://www.mikecann.co.uk)<br />[💻](https://github.com/kentcdodds/nps-utils/commits?author=mikecann "Code") [⚠️](https://github.com/kentcdodds/nps-utils/commits?author=mikecann "Tests") | [<img src="https://avatars3.githubusercontent.com/u/51629?v=4" width="100px;"/><br /><sub><b>Ryan Sullivan</b></sub>](http://ryansully.com/)<br />[💻](https://github.com/kentcdodds/nps-utils/commits?author=ryansully "Code") [⚠️](https://github.com/kentcdodds/nps-utils/commits?author=ryansully "Tests") |
| :---: | :---: | :---: | :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors][all-contributors] specification. Contributions of any kind welcome!
Expand Down
4 changes: 4 additions & 0 deletions src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ exports[`setColors as darwin 1`] = `"node node_modules/concurrently/src/main.js

exports[`setColors as win32 1`] = `"node node_modules/concurrently/src/main.js --kill-others-on-fail --prefix-colors \\"white.bgBlue.bold,black.bgYellow.dim\\" --prefix \\"[{name}]\\" --names \\"lint,build\\" \\"nps lint\\" \\"nps build\\""`;

exports[`setConcurrentFlags as darwin 1`] = `"node node_modules/concurrently/src/main.js --kill-others-on-fail --no-color --prefix-colors \\"bgBlue.bold,bgMagenta.bold\\" --prefix \\"[{name}]\\" --names \\"lint,build\\" 'nps lint' 'nps build'"`;

exports[`setConcurrentFlags as win32 1`] = `"node node_modules/concurrently/src/main.js --kill-others-on-fail --no-color --prefix-colors \\"bgBlue.bold,bgMagenta.bold\\" --prefix \\"[{name}]\\" --names \\"lint,build\\" \\"nps lint\\" \\"nps build\\""`;

exports[`shellEscape as darwin 1`] = `"'testing $:{}()[]ą^ęńł'\\"'\\"'÷//'\\"'\\"'\`\\" '"`;

exports[`shellEscape as win32 1`] = `"\\"testing $:{}()[]ą^ęńł'÷//'\`\\"\\" \\""`;
17 changes: 16 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ let defaultColors = [
// TODO: add more colors that look good?
]

let defaultConcurrentFlags = [
'--kill-others-on-fail',
]

export {
concurrent,
series,
Expand All @@ -30,6 +34,7 @@ export {
includePackage,
shellEscape,
getBin,
setConcurrentFlags,
}

/**
Expand All @@ -41,6 +46,16 @@ export {
function setColors(colors) {
defaultColors = colors
}

/**
* Set custom flags to be passed to concurrently
* @param {string[]} flags - Array of command line arguments for concurrently
* @see https://github.com/kimmobrunfeldt/concurrently
*/
function setConcurrentFlags(flags) {
defaultConcurrentFlags = flags
}

/**
* Accepts any number of scripts, filters out any
* falsy ones and joins them with ' && '
Expand Down Expand Up @@ -117,7 +132,7 @@ function concurrent(scripts) {
names: [],
})
const flags = [
'--kill-others-on-fail',
...defaultConcurrentFlags,
`--prefix-colors "${colors.join(',')}"`,
'--prefix "[{name}]"',
`--names "${names.join(',')}"`,
Expand Down
4 changes: 4 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const snapshotTests = {
shellEscape: ({shellEscape}) =>
shellEscape(`testing $:{}()[]ą^ęńł'÷/\\'\`" `),
getBin: ({getBin}) => getBin('rimraf'),
setConcurrentFlags: ({concurrent, setConcurrentFlags}) => {
setConcurrentFlags(['--kill-others-on-fail', '--no-color'])
return concurrent.nps('lint', 'build')
},
}

Object.keys(snapshotTests).forEach(testName => {
Expand Down