Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Conversation

@blackmamo
Copy link
Contributor

Using junctions and adding a negative include pattern massively speed up the packaging time

Copying the files on windows is very slow and can be avoided by using junctions
This advice saved me a lot of time
@blackmamo
Copy link
Contributor Author

Created issue to go with this PR

#348

// Windows can't symlink so we have to use junction on Windows
if (process.platform == 'win32') {
fse.copySync(reqsInstalledAt, symlinkPath);
fse.symlink(reqsInstalledAt, symlinkPath, 'junction');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require any extra user permissions? I recall something about that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is my understanding that junctions only require the normal file creation permissions. When created they use fully qualified paths and can only link to directories in the same NTFS filesystem.

The admin permissions are required for a full symlink because this has more serious security complications.

The only potential problem I can see is if someone has set up their cache directory and the serverless directory on separate file systems. In that case the junction operation would fail. I could add this note to the readme, but it may be a lot of noise for an unlikely setup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, very cool. I thought junctions were symlinks. Thanks for the clarification.

@dschep dschep merged commit e31a10c into serverless:master Apr 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants