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

Implement resolving path relative package, but not path in file system #131

Open
vitonsky opened this issue Jun 19, 2022 · 2 comments
Open
Labels

Comments

@vitonsky
Copy link

Proposal

Implement resolving path relative package, but not path in file system.

For example your convention may assume that all paths start from #, node_modules or other symbol will resolve with packages manager, but will not be a fs paths.

Use case

I have theme file in my project https://github.com/translate-tools/linguist/blob/master/src/themes/default.theme.json

I want to start use pnpm which keep node_modules not in project directory. But theme file is use relative paths in file system to some file in node_modules. I need a way to specify something like #react-elegant-ui/theme/tokens/light-color.tokens.yml instead of ./node_modules/react-elegant-ui/theme/tokens/light-color.tokens.yml because relative path will not work.

Maybe i could use .js config and resolve paths with require? If yes, then how i can do it?

@vitonsky vitonsky added the RFC label Jun 19, 2022
@vitonsky
Copy link
Author

As i see, you have issue #81 and i agree that this feature must be implemented ASAP, because it's not so friendly when i have to keep in my mind a directory from where will resolve relative paths for my theme. It's not my deal and current implementation is not allow to make really complicated design systems.

It's good to solve both problems with one approach to handle paths.

We have to introduce a convention to handle filepaths.

It must support:

  • absolute paths
  • relative paths
  • package-relative paths

@vitonsky
Copy link
Author

vitonsky commented Jun 19, 2022

You know, i think it's will fine if all paths will be package-related by default.

For example foo/bar/baz.yml will mean a file bar/baz.yml from the module foo.

For other cases, we have to use default FS prefixes, ./foo and ../foo for related current directory and /foo for absolute paths.

All we need is solve all paths which start not from special FS tokens ., /, ~ as paths for packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant