Description
- 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
berry/packages/plugin-pnpm/sources/PnpmLinker.ts
Lines 311 to 313 in 8bfe2d5
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'