Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Continue installing when one package fails #628

Open
hempels opened this issue Jul 13, 2016 · 5 comments
Open

Continue installing when one package fails #628

hempels opened this issue Jul 13, 2016 · 5 comments

Comments

@hempels
Copy link

hempels commented Jul 13, 2016

Description

When multiple packages are passed as arguments for install, typings stops whenever one of those fails (for instance, if a package is missing.) It would be helpful if it attempted each one independent of the result of the others.

Steps to Reproduce

Run typings using "install" with two packages listed, the first non-existent, the second valid.

Expected behavior:

Typings should report the error but continue attempting to install typings for remaining packages.

Actual behavior:

Typings stops with an ERR when the first package is tried and fails, and does not install the second.

Versions

1.0.5

@mjbvz
Copy link

mjbvz commented Jul 15, 2016

@hempels Thank you for reporting this.

To provide some more context on why this would be useful: Node.js Tools for Visual Studio is currently using typings to improve our code completions/IntelliSense, and adding this option would be super helpful for our users (microsoft/nodejstools#1140).

For installing multiple typings, we investigated running the typings command multiple times but there is too much overhead starting node each time. Providing an option to continue after errors would enable quick acquisition of all typings for a project. Otherwise, users end up with no IntelliSense if any typings file is missing, as they often are.

We'd love to contribute this feature. Any chance someone could help us get started?

@blakeembrey
Copy link
Member

You wouldn't need to run this from the CLI, you can use the core from https://github.com/typings/core directly. That said, there's two methods in here for singular or multiple installation: https://github.com/typings/core/blob/master/src/install.ts#L138-L154.

I think it's actually a pretty simple fix, the offending line would be https://github.com/typings/core/blob/master/src/install.ts#L194. I'd merge writing with compiling, then make the result of Promise.all always run (as opposed to not writing out right now when one fails).

@blakeembrey
Copy link
Member

What's the expected error handling for when something is not found but others are for general use-cases? NPM doesn't write anything when one package fails, for instance, which is consistent with Typings.

@mjbvz
Copy link

mjbvz commented Jul 15, 2016

@blakeembrey Thank you for the help.

A small wrapper around typings-core may be the best solution for our needs. I just wanted to check before creating this to see if adding an option to typings itself would help other users.

I also agree that the proposed option is different from how npm works, and could result in unexpected behavior (even if this option were behind a flag.) I'm going to investigate using typings-core to enable this behavior for our intellisense short-term, but please let me know if this is ever something you'd like to see in typings itself.

Thanks.

@blakeembrey
Copy link
Member

I do think users may want to see this also, just need to decide how it functions - mostly when it comes to errors and success since some values may succeed while others fail. It's possible the whole function could be changed to always succeed but emit events for errors instead.

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

No branches or pull requests

3 participants