Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute paths support #1

Closed
rpominov opened this issue Feb 28, 2022 · 1 comment
Closed

Absolute paths support #1

rpominov opened this issue Feb 28, 2022 · 1 comment

Comments

@rpominov
Copy link
Owner

rpominov commented Feb 28, 2022

Solution 1

One way we can add support of absolute paths is to automatically strip out root (as defined by path.parse()) before transforming the path, then add it back to the front of the result path.

Issues:

  • No way to remove the root
  • on Windows it won't be possible to change the root from C:\ to D:\ etc.

Solution 2

Add a {root} keyword, that inserts the root. This way you can either do {root}{0..-1}, or D:/{0..-1} to change the root.

Issues:

  • users will have to think about it "do I always add {root}? do I do it only when I expect an absolute path? do I expect an absolute in a particular case?"
  • visual noise / mental load when looking at a pattern

Solution 3

The first solution + an option removeRoot.

Issues:

  • will make API more complex
  • will work only when you use API directly. If a path-rebuild pattern is a part of some kind of a config there will be no way to pass the option (except by making the config schema more complex as well)
@rpominov
Copy link
Owner Author

Done (Solution 2)

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

No branches or pull requests

1 participant