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: add support for .npsrc.y(a)ml file format #227

Closed mifieldxu closed 3 years ago

mifieldxu commented 3 years ago

What: Add YAML file format support to the existing .npsrc cli config functionality

Why: I like YAML! Also it doesn't make sense for the cli to support the format for package-scripts.yml, but not for .npsrc...

How: I primarily built on the facilities within ./src/bin-utils/index.js and parser.js that pertain to the parsing of the .npsrc file. Specifically, I added a few more possible file names in getCLIConfig() (in parser.js); added the utility functions getParserByExtension() and loadCLIConfigWithParser(), and heavily refactored loadCLIConfig() to rely on these utility functions to determine how to parse a given .npsrc file. I also made a few little refactoring changes that have no impact on functionality or behaviour. For example, initialize() in ./src/bin-utils/initialize/index.js is not expected to have a return value, as it is not assigned to anything any time it is invoked in the codebase.

Checklist:

codecov[bot] commented 3 years ago

Codecov Report

Merging #227 (cdab43b) into master (57989a2) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #227   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           12        12           
  Lines          399       417   +18     
  Branches        98       103    +5     
=========================================
+ Hits           399       417   +18     
Impacted Files Coverage Δ
src/bin-utils/index.js 100.00% <100.00%> (ø)
src/bin-utils/initialize/index.js 100.00% <100.00%> (ø)
src/bin-utils/parser.js 100.00% <100.00%> (ø)
src/get-script-to-run.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 57989a2...cdab43b. Read the comment docs.

sezna commented 3 years ago

Hey! Sorry for the late review. I’ll take a look at this today. Holiday season...