-
Notifications
You must be signed in to change notification settings - Fork 15
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
Spin fails to generate Bucklescript project even when npm is installed #67
Comments
Hi @johnridesabike, thanks for reporting the issue! Without adding extra complexity and detecting installed commands, a fix for this could be to use |
Would it make sense to make an option for it? Iβm imagining something like:
And if you select
I imagine that anyone with yarn installed is familiar enough with it to know how to run it themselves. This approach is still flexible enough to let users use whichever package manager they want. |
@johnridesabike I'm a bit hesitant to add new prompts. I feel like Spin already asks too many questions when generating projects. If there is a satisfying solution to this that does not require adding a new prompt, I'd prefer to look into it. In fact, thinking about your first suggestion, I think the cost of the added complexity of using one command or the other depending on the user's system will be justified if the alternative is to add another prompt. |
@tmattio While not quite as convenient, skipping the post-install command and outputting a message like "Please run yarn/npm install to install all dependencies" seems like an option that could at least be considered. |
@citizen428 Good idea! Actually, we could tweak the behavior of the post-install commands to make them optional. If the post-install command is optional, it will run only if the user has the command on its system, otherwise, it would just ignore it, or eventually write a non-error message. What do you think? EDIT: Maybe that's what you meant by "skipping the post-install"? |
Your proposed solution is slightly more sophisticated than what I had in mind, I wouldn't even have attempted to run the command, just unconditionally output the message. I like your approach though, as we'd essentially just have to change the following pattern match:
Instead of raising
On second thought, there's a lot happening after that |
@tmattio I quickly hacked something together, this is what it looks like: |
For what it's worth, Create React App will automatically use either yarn or npm: https://github.com/facebook/create-react-app/blob/master/packages/create-react-app/createReactApp.js#L333 |
Thanks @johnridesabike! But I do think it makes more sense for Spin to have consistent handling of all post-install commands rather than a special case for |
A fix for this is implemented in #74. The We define this in the template like this:
Closing this now since I want to merge the PR in the next days (and tidy up the issue board at the same time). |
Using Spin 0.5.1 on MacOS and running
spin new bs-react spin-test
I don't have yarn installed. It would be nice if was smart enough to use either yarn or npm.
The text was updated successfully, but these errors were encountered: