Skip to content

Allow commands to run via yarn #1788

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

Merged
merged 2 commits into from
Dec 4, 2018

Conversation

y-yagi
Copy link
Member

@y-yagi y-yagi commented Nov 2, 2018

Currently, commands(webpack and webpacker-dev-server) need to exist under the node_modules/.bin directory.

But when Yarn Plug'n'Play using, node_modules/.bin is not created.
Ref: https://github.com/yarnpkg/rfcs/blob/master/accepted/0000-plug-an-play.md

In this case, I think it is better to run the commands via yarn.

For this reason, I added new config key, and if it is specified, run commands via yarn.

I'm not sure if it is appropriate to set this behavior in the configuration file.
If env is appropriate, I will update it. Thanks!

@gauravtiwari
Copy link
Member

@y-yagi Thanks for this. Looks great, I am not sure about config option though therefore, I am wondering would it make sense to check file presence and fallback to yarn? (do this implicitely)

if File.exist?('node_modules/.bin/webpack')
else 
  # try yarn
end

@y-yagi y-yagi force-pushed the use_yarn_to_run_the_clis branch 2 times, most recently from c9aed02 to 40956f1 Compare December 2, 2018 22:52
@y-yagi
Copy link
Member Author

y-yagi commented Dec 2, 2018

Thanks for your feedback!
I added config to think that it is confusing when using Yarn Plug'n'Play to break by whether node_modules exists or not.
(This is because it predicts that node_modules will remain in many cases when migrating to Yarn Plug'n'Play)

But this is probably the only problem in the beginning. Otherwise, it makes more sense to check if the file exists.
I updated to fix that check node_modules exists or not.

@y-yagi
Copy link
Member Author

y-yagi commented Dec 2, 2018

Because of the effect that BigDecimal.new removed, the build of 4.2 + ruby-head is an fails. This fixes with #1825.

@gauravtiwari
Copy link
Member

Merged #1825 thanks for the update

@gauravtiwari
Copy link
Member

If you could rebase with the master it should pass 👍

To avoid to effects other tests.
@y-yagi y-yagi force-pushed the use_yarn_to_run_the_clis branch from 40956f1 to 5195c98 Compare December 3, 2018 22:50
Currently, commands(`webpack` and `webpacker-dev-server`) are need to exist
under the `node_modules/.bin` directory.

But when Yarn Plug'n'Play using, `node_modules/.bin` is not created.
Ref: https://github.com/yarnpkg/rfcs/blob/master/accepted/0000-plug-an-play.md

In this case, need to execute the command via `yarn`.
So if `node_modules` does not exist, executes the command via `yarn`.
@y-yagi y-yagi force-pushed the use_yarn_to_run_the_clis branch from 5195c98 to c80a968 Compare December 3, 2018 23:23
@y-yagi
Copy link
Member Author

y-yagi commented Dec 3, 2018

Rebased!

@gauravtiwari gauravtiwari merged commit ae816d6 into rails:master Dec 4, 2018
@gauravtiwari
Copy link
Member

Great, merged 👍 🍰

@y-yagi
Copy link
Member Author

y-yagi commented Dec 4, 2018

Thanks!

@y-yagi y-yagi deleted the use_yarn_to_run_the_clis branch December 4, 2018 08:49
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.

2 participants