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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow skipping dependencies install. #412

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timoteialbu
Copy link

Description 馃摉

Add an env flag VITE_RUBY_SKIP_INSTALLING_DEPENDENCIES, which lets users skip installing all node dependencies in the install_dependencies rake task. This is similar to the existing VITE_RUBY_SKIP_INSTALLING_DEV_DEPENDENCIES flag.

Background 馃摐

The reason our team would like this is the following: We are trying to optimize our CI/CD running time and are working at parallelizing as many tasks as we can. We already installed our dependencies in another step and cached them. When we get to the "assets compilation" step, we would like to use those cached dependencies. Unfortunately, in its current state, the vite dependency installation step not only runs the dependency install again, but it also blows away our cache by using npx ci (which from our understanding uses npm ci in the background).

One workaround we found was using the VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION flag, but that skips the assets' precompilation, which we do want. By using that flag, we can then call bin/rake vite:build_all. This path is also acceptable, but I thought others might benefit from this flag instead in order to make their own CI setups easier. I've opened this PR both as a discussion forum and as a potential solution in case it's accepted.

The Fix 馃敤

Added a new flag which skips the install_dependencies task.

Screenshots 馃摲

@gjtorikian
Copy link

I was also surprised to find that our CI tests needed Internet access to run Vite compilation; this fix does a great job summarizing the issues we also found independently.

Could it be merged? 馃檹

@gjtorikian
Copy link

FWIW I also added

Rake::Task["vite:install_dependencies"].clear if Rake::Task.task_defined?("vite:install_dependencies")

In my lib/tasks folder to work around the problem, while waiting for this.

@mochetts
Copy link

mochetts commented Nov 20, 2023

Found an issue trying to use pnpm in CI that caused the mixup of yarn + pnpm to fail. It would ideal to have the possibility to set this env var and let me do the install manually by doing pnpm install in one of the CI steps.

image

@mochetts
Copy link

mochetts commented Nov 20, 2023

Found an issue trying to use pnpm in CI that caused the mixup of yarn + pnpm to fail. It would ideal to have the possibility to set this env var and let me do the install manually by doing pnpm install in one of the CI steps.

image

For me, it was running yarn due to having jsbuild and cssbuild gems included in the gemfile. They come installed by default in a fresh rails installation, so better to remove them before installing vite-ruby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants