inxilpro / node-app-root-path

Determine the root path to your project
MIT License
605 stars 29 forks source link

`resolve` function should behave as `path.resolve` #46

Open Andreyco opened 4 years ago

Andreyco commented 4 years ago

I strongly believe appRoot.resolve should behave as path.resolve does. It means:

codecov-commenter commented 4 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@54d06fe). Click here to learn what that means. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #46   +/-   ##
=========================================
  Coverage          ?   87.09%           
=========================================
  Files             ?        2           
  Lines             ?       62           
  Branches          ?        0           
=========================================
  Hits              ?       54           
  Misses            ?        8           
  Partials          ?        0           
Impacted Files Coverage Δ
lib/app-root-path.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 54d06fe...828d91a. Read the comment docs.

inxilpro commented 4 years ago

Hm. This makes sense. Can you explain what issue you bumped into that made you open the PR? This is a breaking change and would push us to 4.0, so I want to understand where/when it's necessary.

Andreyco commented 4 years ago

Sure, here is the use case.

Given it's a relative path (essentially means configuration file is in scope of host application directory), it should be resolved to host application root. This scenario works well.

The problem is with absolute path. A file could be outside of host application directory or inside (but referenced by absolute path). The path is not resolved correctly in this case and results in following output: {applicationRootPath}/{absolutePaht}

I fully understand this is breaking change and thus your concerns.