sezna / nps

NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json
MIT License
1.43k stars 93 forks source link

feat(options): added --prefix option #220

Closed dannycoates closed 4 years ago

dannycoates commented 4 years ago

Hi! I'm a new nps user and I love it! I added this feature for myself but maybe it'd be useful to others.

What:

This adds a prefix option to prepend a string to the start of each script name in the cli

Why:

I wanted to be able to do something like this:

cli

npm test unit functional

package-scripts.js

module.exports = {
  scripts: {
    test: {
      unit: 'mocha ./tests',
      functional: 'intern'
    }
  }
}

package.json

{
  "scripts": {
    "test": "nps --prefix=test"
  }
}

Checklist:

codecov[bot] commented 4 years ago

Codecov Report

Merging #220 into master will not change coverage by %. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #220   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           12        12           
  Lines          396       399    +3     
  Branches        96        98    +2     
=========================================
+ Hits           396       399    +3     
Impacted Files Coverage Δ
src/bin-utils/parser.js 100.00% <100.00%> (ø)
src/index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f4a47c1...2fa922b. Read the comment docs.

dannycoates commented 4 years ago

I don't think the default case is working here. I'll push an update soon

sezna commented 4 years ago

@dannycoates is this ready for review now? Sorry, I didn't see you updated it after the last comment!

dannycoates commented 4 years ago

@sezna yes, it's ready, thanks!

sezna commented 4 years ago

Looks good to me, sorry about the delay!