Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

use junctions instead of symlinks #175

Closed
wants to merge 1 commit into from
Closed

Conversation

nlf
Copy link
Contributor

@nlf nlf commented Nov 5, 2020

in windows we should use junctions, not symlinks, as junctions can be created by non-admin users while symlinks require elevated permissions. this change was made in npm 6 and regressed in npm 7.

note that it's unnecessary to put a conditional around the parameter, as well as unnecessary to make the target an absolute path, per nodejs docs:

The type argument is only available on Windows and ignored on other platforms. It can be set to 'dir', 'file', or 'junction'. If the type argument is not set, Node.js will autodetect target type and use 'file' or 'dir'. If the target does not exist, 'file' will be used. Windows junction points require the destination path to be absolute. When using 'junction', the target argument will automatically be normalized to absolute path.

References

Fixes npm/cli#2079
Fixes npm/cli#1923

@philipparndt
Copy link

there is already a PR handling this: #162 you have changed it to junction for every platform, is this intended?

@nlf
Copy link
Contributor Author

nlf commented Nov 5, 2020

there is already a PR handling this: #162 you have changed it to junction for every platform, is this intended?

per the documentation quoted above, the third parameter is ignored in non-windows environments making the coverage workarounds in the other pull request unnecessary. i'm happy to close this one if the other PR removes the conditional, though

@philipparndt
Copy link

Ah, thats great! In that case I suggest to use this one 👍
I'm happy when this is closed ;)

@isaacs isaacs closed this in ab5e7e5 Nov 6, 2020
@wraithgar wraithgar deleted the nlf/junctions-not-symlinks branch April 22, 2021 17:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants