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

How to request user input during plugin installation? #2521

Closed
EddyVerbruggen opened this issue Feb 9, 2017 · 4 comments
Closed

How to request user input during plugin installation? #2521

EddyVerbruggen opened this issue Feb 9, 2017 · 4 comments
Assignees
Labels
Milestone

Comments

@EddyVerbruggen
Copy link
Contributor

Hi,

Before {N} 2.5.0 was released nativescript-plugin-firebase was able to use a postinstall script that prompted the user about his configuration ("Do you want to use Firebase Messaging? (y/n)"). The prompt code can be found here.

When 2.5.0 was released and you installed version 3.9.2 of the plugin the CLI just hanged. So I released 3.9.3 that removed the postinstall script, now users must not forget to run it themselves after plugin installation.

Was this intended / is it a bug.. I don't know, but what would you currently recommend for me to use to prompt the user during plugin installation?

Thanks!

@jlooper
Copy link

jlooper commented Feb 10, 2017

Amplifying this, and I'd like to re-enable the use of postinstall prompts as it's a great feature to have with these more feature-full plugins

@rosen-vladimirov
Copy link
Contributor

Hey @EddyVerbruggen , @jlooper , thanks for pointing this regression.
In versions before 2.5.0, CLI was using npm as a dependency in it's own package.json. In 2.5.0, we rely on user's npm installation. So this required a lot of changes in the code and it looks like we've missed this case.
We'll try to provide a fix as soon as possible. Thanks for reporting it.

Btw @EddyVerbruggen , such postinstall scripts can cause issues in CI builds, where the terminal is not interactive. I would advise you to add isInteractive method and call any prompt only in case the method returns true:

function isInteractive() {
	return process.stdout.isTTY && process.stdin.isTTY;
}

@EddyVerbruggen
Copy link
Contributor Author

Hey @rosen-vladimirov, thanks a lot for picking this up so quickly, much appreciated!

Btw, the firebase plugin saves a json config file for CI builds to pick up, but your suggestion is a great addition to that, will add it!

@EddyVerbruggen
Copy link
Contributor Author

@rosen-vladimirov This issue is back with the current CLI (3.1.0). This line uses "pipe" instead of your fix ("inherit").

I've found a way to fix it and will do a PR so postinstall scripts are executed again.

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

No branches or pull requests

4 participants