-
Notifications
You must be signed in to change notification settings - Fork 162
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
Normalize paths during compilation #1702
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that having semi-support for absolute paths is a good idea (I'd probably just normalize relative paths)... but up to you to decide.
core/utils.ts
Outdated
|
||
export function resolveActionsConfigFilename(configFilename: string, configPath: string) { | ||
// This path computation supports "absolute" paths in the context of a dataform project. | ||
if (configFilename[0] === "/") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure it is a good idea to start supporting absolute (ish!) paths?
I'm a bit concerned about the lack of consistency (maybe resulting in actual bugs / conflicts) with what we output, i.e. none of our output filenames contain leading slashes.
I think I'd be more comfortable doing this if we were more consistent about that. without it, it's definitely a bit worrying.
AFAICT special logic for absolute paths is needed even if we do normalization (so this is just a subset of supported paths): We currently resolve What I think makes sense is for the root to be the root "/" of the project, and the effective current working directory to be current location of the |
I don't follow. I'm not commenting on "normalize and resolve |
Oh right! I want to support both though - or at least throw an error if an absolute path is used and we don't support it. What mismatch between input and output do you mean? The outputted filenames in the compiled graph are always from the base of the project (though we don't place a root slash in it), so |
Right, this is the part that I think is confusing/may lead to trouble. In input, we're suggesting that the project root is really the filesystem root - fine, makes sense. But in output, we're not. That inconsistency seems risky to me, I hope that it will not lead to issues. |
That's fair, I think I agree then. So the steps would be:
|
Have updated this PR to do the normalization instead. |
…-path-bases Normalize paths during compilation
Because Node isn't used in Core, Node's path computation can't be used to do this directly. To avoid redefining path resolution in yet another place, this seems like the best option.