joshwcomeau / guppy

🐠A friendly application manager and task runner for React.js
ISC License
3.27k stars 154 forks source link

Add yarn call to install deps. if no node_modules found #278

Closed AWolf81 closed 5 years ago

AWolf81 commented 5 years ago

During my work on #277 I've had a situation where I don't have a node_modules folder and Guppy can't run any tasks.

At the delete performance issue, I'm deleting the node_modules folder and then move the project to trash. If the user restores the project from trash then we're having the situation mentioned above.

Describe the solution you'd like If dependency panel is empty show a button that's saying Install dependencies. See screenshot below to see the state with-out dependencies. This button triggers a yarn call to install everything. Afterwards we need to refresh the dependencies so we're having the installed dependencies available.

I think we also need to add a check to import-project.saga. So we're checking if node_modules is available and if not we're running yarn or should we always call it to ensure that everything is installed?

The actual script that triggers the yarn call will be inside dependency.saga and triggered with an action TRIGGER_YARN_INSTALL. That's needed because we're having two situations where the node_modules folder could be missing:

The good thing about this is that we can also add a feature import from Github because there is also an installation needed. But that's a separate issue as this needs a git client to clone a repository.

Screenshot grafik

joshwcomeau commented 5 years ago

If dependency panel is empty show a button that's saying Install dependencies. See screenshot below to see the state with-out dependencies. This button triggers a yarn call to install everything.

Yeah, that sounds good to me. I wonder if we should do this automatically, if we find ourselves in this situation...

It would also be good to have a menu option like Reinstall dependencies which would delete node_modules and run yarn, as a way to force a cleanup in case the user winds up in a weird state.

The good thing about this is that we can also add a feature import from Github because there is also an installation needed. But that's a separate issue as this needs a git client to clone a repository.

Yeah, that's an exciting potential future set of tasks, github integration!

AWolf81 commented 5 years ago

I'm working on this as it will be the base for the Git integration stuff. I'm working on branch reinstall. Not pushed yet.

Reinstall will first remove node_modules folder and then it triggers yarn. No need to do a separate install action with-out removing node_modules as delete should fail silently.

I'll add Reinstall Dependencies to Application menu\Current project\Reinstall Dependencies. Also there will be an Install button in UI if no dependencies are found and that will also trigger reinstall.

Do we need a confirm dialog to reinstall? Maybe we're showing a notification about what it will do and that it can take several minutes, what do you think? But I think it would be also OK to do it with-out notification as it's clear what a reinstall will do. I'll re-use the waiting spinner here as the reinstall will take some time.

melanieseltzer commented 5 years ago

This was completed in #318