Skip to content
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

[Feature] Configurable location of node_modules/.store with nodeLinker: pnpm #6623

Open
2 tasks
kirill-konshin opened this issue Dec 3, 2024 · 0 comments
Open
2 tasks
Labels
enhancement New feature or request

Comments

@kirill-konshin
Copy link

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

It seems that copying directories to node_modules/.store during install takes considerable amount of time, so I was trying to persist this directory between jobs. Obvious solution is to put it in GitLab cache, but zip-unzip and network also takes time.

As a developer it would be convenient to place node_modules/.store somewhere else to be global, especially on CI. The benefit is that on GitLab Runner I can make a mounted volume, put .store there and share it between jobs, thus speeding up the install.

Currently this path

function getStoreLocation(project: Project) {
return ppath.join(getNodeModulesLocation(project), `.store`);
}
is hardcoded.

PNPM itself has global store by default: ~/.pnpm-store and provides config options pnpm config set store-dir /path/to/.pnpm-store to set it.

Compare the install times:

With node_modules/.store placed before install:

$ find node_modules -mindepth 1 -not -name ".cache" -exec rm -rf {} +
$ yarn install
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 1s 418ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 7s 889ms (not more than 10-15s, average arond 7-8s)

Vs when no .store (Yarn's own cache is pre-warmed already):

$ rm -rf node_modules
$ yarn install
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 1s 418ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 43s 678ms (average around ~45s)

Describe the solution you'd like

A simple config variable similar to cacheFolder would be enough: storeFolder for example.

Describe the drawbacks of your solution

Since I will be able to control the location and the variable, I don't see any drawbacks, just don't use the var if default behavior is OK.

Describe alternatives you've considered

I tried to symlink /cache/.store (where /cache is a mounted volume) to node_modules/.cache, installation was semi-successful: links were created but install failed with:

➤ YN0000: ┌ Link step
➤ YN0001: │ Error: ENOTDIR: not a directory, rmdir '/Users/dis/Sites/CX/frontend/node_modules/.store'
@kirill-konshin kirill-konshin added the enhancement New feature or request label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant