-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
I'm using yarn3.2.0 in my NAPI-RS projects, and in the CI test steps I want to install dependencies on host platform and testing the native addons on the qemu Docker images.
Installing dependencies on the host platform has many advantages:
- It's easy to use
actions/cacheto cache yarn dependencies. - It's faster because the host platform is running on the native CPU arch.
Imagine testing linux-aarch64-musl native addons on ubuntu-latest x64 host, I want to install dependencies in these steps:
- yarn config set supportedArchitectures.cpu 'arm64'
- yarn config set supportedArchitectures.libc 'musl'
- yarn install --immutable --mode=skip-build
With the current version, yarn will throw error in linking step: Error: While persisting /canvas/.yarn/cache/@swc-core-linux-x64-gnu-npm-1.2.163-e0dc2d703e-8.zip/node_modules/@swc/core-linux-x64-gnu/ -> /canvas/node_modules/@swc/core-linux-x64-gnu ENOENT: no such file or directory, scandir '/canvas/.yarn/cache/@swc-core-linux-x64-gnu-npm-1.2.163-e0dc2d703e-8.zip/node_modules/@swc/core-linux-x64-gnu'
If set CPU and libc with current:
- yarn config set supportedArchitectures.cpu --json '["arm64", "current"]'
- yarn config set supportedArchitectures.libc --json '["musl", "current"]'
- yarn install --immutable --mode=skip-build
Only packages satisfied with the current platform will be preserved, ls -la @swc:
root@6d7dbe3dd415:/canvas# ls node_modules/@swc
core core-linux-x64-gnu
Describe the solution you'd like
I think in linking steps should only preserve the packages satisfied with supportedArchitectures but not the current platform.
Describe the drawbacks of your solution
Only preserve the packages satisfied with supportedArchitectures.
Describe alternatives you've considered
Add a flag to specify this behavior?