ElMassimo / ElMassimo/vite_ruby
Corepack packageManager set to pnpm triggers warning with assets:precompile
- Dominant language
- Ruby
- Stars
- 1.6k
- Forks
- 149
- Avg merge
- 5h 13m
- Merged PRs (30d)
- 2
Description
[troubleshooting section]: https://vite-ruby.netlify.app/guide/troubleshooting.html
- [x] I have tried upgrading by running `bundle update vite_ruby`.
- [x] I have read the __[troubleshooting section]__ before opening an issue.
### Description 📖
With corepack enabled and packageManager set (to pnpm in my case), running rake assets:precompile will throw a warning (but continue):
```
/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22373
throw new UsageError(`This project is configured to use ${result.spec.name} because ${result.target} has a "packageManager" field`);
^
UsageError: This project is configured to use pnpm because /Users/jpr/src/Rhino/mono-test/rhino-project-template_rails_mono/package.json has a "packageManager" field
at Engine.findProjectSpec (/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22373:21)
at async Engine.executePackageManagerRequest (/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22404:24)
at async Object.runMain (/Users/jpr/.asdf/installs/nodejs/20.14.0/lib/node_modules/corepack/dist/lib/corepack.cjs:23096:5) {
clipanion: { type: 'usage' }
}
```
I have traced this to:
https://github.com/ElMassimo/vite_ruby/blob/a3182a9b8abc058004e47b81b214ea6e578e7e6f/vite_ruby/lib/tasks/vite.rake#L92
Because it runs the yarn command (when it is not installed), triggering the warning. I suspect that yarn call should either:
* Check for the 'yarn' binary before running the command OR
* Only run this if yarn is the package manager
### Reproduction 🐞
Vite Ruby Info
_Run `bin/rake vite:info` and provide the output:_
```
bin/vite present?: true
vite_ruby: 3.8.2
vite_rails: 3.0.17
rails: 7.1.3.4
ruby: ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin23]
node: v20.14.0
pnpm: 9.9.0
```
### Logs 📜
### Screenshots 📷
Contributor guide
Assessment
This issue has not been assessed yet.