Skip to content

Conversation

@Andreyco
Copy link

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

  • given relative path, resolve absolute path relative to the app root
  • given absolute path, resolve given absolute path

I strongly believe `appRoot.resolve` should behave as `path.resolve` does.
It means:
- given relative path, resolve absolute path relative to the app root
- given absolute path, resolve given absolute path
@codecov-commenter
Copy link

codecov-commenter commented May 20, 2020

Codecov Report

❗ 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
Copy link
Owner

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
Copy link
Author

Sure, here is the use case.

  • A dependency relay on loading certain file, let's say it's a configuration JSON file for a lib (lib uses this package as resolver)
  • A dependency reads environment variable for certain variable, e.g. {LIB}_CONFIGURATION_PATH.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants