diff --git a/.all-contributorsrc b/.all-contributorsrc index 407a46c..bd2e5e9 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -407,6 +407,15 @@ "contributions": [ "code" ] + }, + { + "login": "kevjin", + "name": "Kevin J", + "avatar_url": "https://avatars2.githubusercontent.com/u/15851351?v=4", + "profile": "https://github.com/kevjin", + "contributions": [ + "code" + ] } ], "repoType": "github" diff --git a/README.md b/README.md index 075557b..ab6c851 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ All the benefits of npm scripts without the cost of a bloated package.json and l [![downloads][downloads-badge]][npm-stat] [![MIT License][license-badge]][LICENSE] -[![All Contributors](https://img.shields.io/badge/all_contributors-40-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-41-orange.svg?style=flat-square)](#contributors) [![PRs Welcome][prs-badge]][prs] [![Donate][donate-badge]][donate] [![Code of Conduct][coc-badge]][coc] @@ -489,7 +489,7 @@ Thanks goes to these people ([emoji key][emojis]): | [
Sorin Muntean](https://github.com/sxn)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=sxn "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=sxn "Tests") [πŸ“–](https://github.com/kentcdodds/p-s/commits?author=sxn "Documentation") | [
Keith Gunn](https://github.com/gunnx)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Agunnx "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=gunnx "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=gunnx "Tests") | [
Joe Martella](http://martellaj.github.io)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Amartellaj "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=martellaj "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=martellaj "Tests") | [
Martin Segado](https://github.com/msegado)
[πŸ“–](https://github.com/kentcdodds/p-s/commits?author=msegado "Documentation") | [
Bram Borggreve](http://colmena.io/)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Abeeman "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=beeman "Code") | [
Elijah Manor](http://elijahmanor.com)
[πŸ“Ή](#video-elijahmanor "Videos") | [
Ragu Ramaswamy](https://github.com/rrag)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=rrag "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=rrag "Tests") [πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Arrag "Bug reports") | | [
Erik Fox](http://www.erikfox.co/)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Aerikfox "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=erikfox "Code") [πŸ“–](https://github.com/kentcdodds/p-s/commits?author=erikfox "Documentation") [⚠️](https://github.com/kentcdodds/p-s/commits?author=erikfox "Tests") | [
Aditya Pratap Singh](http://blog.adityapsingh.com)
[πŸ‘€](#review-addityasingh "Reviewed Pull Requests") | [
bumbleblym](https://github.com/bumbleblym)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=bumbleblym "Code") [πŸ“–](https://github.com/kentcdodds/p-s/commits?author=bumbleblym "Documentation") | [
Islam Attrash](https://twitter.com/IslamAttrash)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=Attrash-Islam "Code") | [
JasonSooter](https://github.com/JasonSooter)
[πŸ“–](https://github.com/kentcdodds/p-s/commits?author=JasonSooter "Documentation") | [
Nate Cavanaugh](http://alterform.com)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=natecavanaugh "Code") | [
Wissam Abirached](https://designingforscale.com)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=wabirached "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=wabirached "Tests") | | [
PaweΕ‚ MikoΕ‚ajczyk](https://github.com/Miklet)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=Miklet "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=Miklet "Tests") | [
Kyle Welch](http://www.krwelch.com)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=kwelch "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=kwelch "Tests") | [
Lufty Wiranda](http://instagram.com/luftywiranda13)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=luftywiranda13 "Code") | [
Bhargav Ponnapalli](http://imbhargav5.com)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=imbhargav5 "Code") | [
falieson](https://github.com/Falieson)
[πŸ“–](https://github.com/kentcdodds/p-s/commits?author=Falieson "Documentation") [πŸ”§](#tool-Falieson "Tools") | [
Suhas Karanth](https://github.com/sudo-suhas)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Asudo-suhas "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=sudo-suhas "Code") | [
Eric Skram](http://www.ericskram.com)
[πŸ“–](https://github.com/kentcdodds/p-s/commits?author=Vpr99 "Documentation") | -| [
Kether Saturnius](http://www.k3th3r.com)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=iamkether "Code") [πŸ“–](https://github.com/kentcdodds/p-s/commits?author=iamkether "Documentation") | [
Sviatoslav](https://github.com/SleepWalker)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3ASleepWalker "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=SleepWalker "Code") | [
Wei Wang](https://github.com/onlywei)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=onlywei "Code") | [
Sami Jaber](http://twitter.com/samjabz)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Asamijaber "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=samijaber "Code") | [
Florian LΓΆchle](https://github.com/schottilol)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=schottilol "Code") | +| [
Kether Saturnius](http://www.k3th3r.com)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=iamkether "Code") [πŸ“–](https://github.com/kentcdodds/p-s/commits?author=iamkether "Documentation") | [
Sviatoslav](https://github.com/SleepWalker)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3ASleepWalker "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=SleepWalker "Code") | [
Wei Wang](https://github.com/onlywei)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=onlywei "Code") | [
Sami Jaber](http://twitter.com/samjabz)
[πŸ›](https://github.com/kentcdodds/p-s/issues?q=author%3Asamijaber "Bug reports") [πŸ’»](https://github.com/kentcdodds/p-s/commits?author=samijaber "Code") | [
Florian LΓΆchle](https://github.com/schottilol)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=schottilol "Code") | [
Kevin J](https://github.com/kevjin)
[πŸ’»](https://github.com/kentcdodds/p-s/commits?author=kevjin "Code") | This project follows the [all-contributors][all-contributors] specification. diff --git a/cli-test/__tests__/__snapshots__/cli.js.snap b/cli-test/__tests__/__snapshots__/cli.js.snap index 1faf1e6..281a8e5 100644 --- a/cli-test/__tests__/__snapshots__/cli.js.snap +++ b/cli-test/__tests__/__snapshots__/cli.js.snap @@ -29,10 +29,10 @@ log } `; -exports[`with --silent 1`] = ` +exports[`with silent option set true 1`] = ` Object { "stderr": "", - "stdout": "test script + "stdout": "silent ", } `; diff --git a/cli-test/__tests__/cli.js b/cli-test/__tests__/cli.js index c3c548e..3c89aa2 100644 --- a/cli-test/__tests__/cli.js +++ b/cli-test/__tests__/cli.js @@ -9,7 +9,8 @@ test('with config with default script', () => test('with a missing config', () => snapshot('-c ./something-that-does-not-exist.js')) -test('with --silent', () => snapshot('test --silent')) +test('with silent option set true', () => + snapshot('-c ./package-script-silent.js')) test('with --require', () => snapshot('--config ./es6-package-scripts.js --require babel-register log')) diff --git a/cli-test/__tests__/fixtures/package-script-silent.js b/cli-test/__tests__/fixtures/package-script-silent.js new file mode 100644 index 0000000..a4f88ee --- /dev/null +++ b/cli-test/__tests__/fixtures/package-script-silent.js @@ -0,0 +1,8 @@ +module.exports = { + scripts: { + default: 'echo "silent"', + }, + options: { + silent: true, + } +} diff --git a/src/bin/nps.js b/src/bin/nps.js index 4647a3d..ff2615b 100755 --- a/src/bin/nps.js +++ b/src/bin/nps.js @@ -12,11 +12,14 @@ if (argv && psConfig) { runPackageScript({ scriptConfig: psConfig.scripts, scripts: argv._, - options: merge(psConfig.options, { - silent: argv.silent, - logLevel: argv.logLevel, - scripts: argv.scripts, - }), + options: merge( + { + silent: argv.silent, + logLevel: argv.logLevel, + scripts: argv.scripts, + }, + psConfig.options, + ), }).then( () => { // make this explicit @@ -25,11 +28,16 @@ if (argv && psConfig) { process.exitCode = 0 }, error => { - const logLevel = getLogLevel({ - silent: argv.silent, - logLevel: argv.logLevel, - scripts: argv.scripts, - }) + const logLevel = getLogLevel( + merge( + { + silent: argv.silent, + logLevel: argv.logLevel, + scripts: argv.scripts, + }, + psConfig.options, + ), + ) const log = getLogger(logLevel) log.error(error) process.exitCode = error.code || FAIL_CODE