-
Notifications
You must be signed in to change notification settings - Fork 5.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
feat(npm): add flag for creating and resolving npm packages to a local node_modules folder #15971
Conversation
That's right, I think we should consider adding |
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.
A few comments. I think --node-modules-dir
will be more intelligible flag name than --local-npm
.
@@ -294,6 +324,60 @@ pub async fn remove_dir_all_if_exists(path: &Path) -> std::io::Result<()> { | |||
} | |||
} | |||
|
|||
/// Copies a directory to another directory. | |||
/// | |||
/// Note: Does not handle symlinks. |
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.
Should it handle symlinks at some point?
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.
Maybe. For now it doesn't because it's not necessary for npm packages from my understanding.
let testdata_dir = testdata_path(); | ||
let args = args | ||
.iter() | ||
.map(|arg| arg.replace("$TESTDATA", &testdata_dir.to_string_lossy())) | ||
.collect::<Vec<_>>(); |
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.
Nice 👍
While an env var might be more appropriate in the sense that typically |
--local-npm
flag for creating a local node_modules folderThere 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.
LGTM
…l node_modules folder (#15971)
This flag is for greater compatibility with packages that depend on a local node_modules folder existing.
node_modules
folder pnpm style -- Note: Missing peer dependency support for the first pass.Note: We cannot symlink to the global cache because that will cause resolutions to resolve to the global cache. For now, it copies, but we could hardlink if on the same file system in the future.
--local-npm
name. Also, Bartek recommended this maybe be an env var. Edit: It's now--node-modules-dir
Closes #15822