-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(core): do not use joinPathFragments for generating files #18753
fix(core): do not use joinPathFragments for generating files #18753
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
7549766
to
62d529a
Compare
62d529a
to
44de0ff
Compare
44de0ff
to
b4c121b
Compare
b4c121b
to
41f003e
Compare
@@ -5,14 +5,16 @@ function removeWindowsDriveLetter(osSpecificPath: string): string { | |||
} | |||
|
|||
/** | |||
* Coverts an os specific path to a unix style path | |||
* Coverts an os specific path to a unix style path. Use this when writing paths to config files. | |||
* This should not be used to read files on disk because of the removal of Windows drive letters. |
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.
This messaging will show up on nx.dev as well as intellisense for devkit users, I think its probably fine as-is, but maybe it'd be worth phrasing it more in line with it being ok for relative paths but not absolute? I can't think of a time that it wouldn't work when given relative path args.
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When running
npx create-nx-workspace
on a drive that is notC:
, the process fails because we strip out the drive letter before trying to gather file information. This failure happens duringcreate-nx-workspace
andensurePackage
because those two functions will create a temporary directory (usually in%LOCALAPPDATA%
, ie -C:\Users\user\AppData\Local
), and run nx generators from there. If we try to usereaddirSync
without the drive letter, it will default to looking at the current working directory. So if the working directory isD:\dev
, and a generator file is inC:\Users\user\AppData\Local\etc
, Nx will "normalize" the windows path and remove the drive letter, and node will try to look for the file inD:\Users\user\AppData\Local\etc
.Expected Behavior
Generating files do not remove the drive letter, and we just use a regular
join
Related Issue(s)
Fixes #18677
fixes #18727