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

fix: wrong script execution #194

Closed florianloechle closed 5 years ago

florianloechle commented 5 years ago

What: This pull request fixes #191. Change getScripts function to handle multiple possible script matches.

Why: The function did not account for more than one possible result and would always use the first script in the array without checking the other possible options.

How: Usage of reduce with no initial value will always return the first item just like before, but now additional possible scripts are also accounted for.

Checklist:

codecov[bot] commented 5 years ago

Codecov Report

Merging #194 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #194   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines         385    389    +4     
  Branches       93     94    +1     
=====================================
+ Hits          385    389    +4
Impacted Files Coverage Δ
src/get-script-to-run.js 100% <100%> (ø) :arrow_up:

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 4b45a86...11cbad0. Read the comment docs.

codecov[bot] commented 5 years ago

Codecov Report

Merging #194 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #194   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines         385    389    +4     
  Branches       93     94    +1     
=====================================
+ Hits          385    389    +4
Impacted Files Coverage Δ
src/get-script-to-run.js 100% <100%> (ø) :arrow_up:

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 4b45a86...11cbad0. Read the comment docs.