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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(local-install): Add npmEnv option to LocalInstaller #7

Merged
merged 1 commit into from
Mar 21, 2018

Conversation

wojtkowiak
Copy link
Contributor

@wojtkowiak wojtkowiak commented Feb 27, 2018

Hello,

I have a plan to use your package in meteor-desktop but I've faced a problem when installing local packages that have native node modules. The compilation goes against current node and what I need is to compile them against the electron version. For that I need to pass additional env vars to npm. I have made this small change to be able to do that.
I am a total newbie in typescript so I hope its typescriptish enough 🙂
Let me know if that can go into your next release.

Copy link
Owner

@nicojs nicojs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! Looks good so far. I have a few remarks.

I'm also missing a small update in the readme and some tests. Do you need some help with that?

Are you planning to use it from the programmatic API and not the CLI?

super();
this.sourcesByTarget = resolve(sourcesByTarget);
if (options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use Object.assign here? options = Object.assign({}, options);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, good point

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.assign can handle an undefined value. So you can even remove this entire if:

 constructor(sourcesByTarget: ListByPackage, options?: Options) {
         super();
         this.sourcesByTarget = resolve(sourcesByTarget);
         this.options = Object.assign({}, options);
     }

@@ -1,3 +1,4 @@
import * as child_process from 'child_process';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ExecOptions are actually re-exported from mz/child_process (using export * from "child_process";), so you should be able to use import { exec, ExecOptions } from 'mz/child_process'; instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oww, good to know, much more cleaner that way.

@nicojs
Copy link
Owner

nicojs commented Feb 27, 2018

You've got to love mutation testing. Build failed because new code paths do not have unit tests:

Final mutation score 71.43 under breaking threshold 72, setting exit code to 1 (failure).

@wojtkowiak
Copy link
Contributor Author

Thanks for looking into this 🙂
Sorry for the delay, I needed to handle some other issues.
I have adjusted the commit according to your comments and added the test. I have also added a section in the Readme. Feel free to modify it.

Are you planning to use it from the programmatic API and not the CLI?

I guess it would be difficult to use it from the CLI. I mean passing an object from CLI would be hard. Maybe there should be an option to pass it when using the CLI interface programmatically but not sure if it's worth it.

@wojtkowiak
Copy link
Contributor Author

Would you have a moment to take a look?

Copy link
Owner

@nicojs nicojs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took so long. I somehow missed the update from git. Thanks for the reminder

super();
this.sourcesByTarget = resolve(sourcesByTarget);
if (options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.assign can handle an undefined value. So you can even remove this entire if:

 constructor(sourcesByTarget: ListByPackage, options?: Options) {
         super();
         this.sourcesByTarget = resolve(sourcesByTarget);
         this.options = Object.assign({}, options);
     }

@nicojs nicojs merged commit c32776a into nicojs:master Mar 21, 2018
@nicojs
Copy link
Owner

nicojs commented Mar 21, 2018

@wojtkowiak
Copy link
Contributor Author

Thanks for your time and for merging it in! 👍

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