Skip to content

tns plugin add <plugin> has issues with postinstall scripts #1610

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

Closed
rosen-vladimirov opened this issue Mar 15, 2016 · 1 comment
Closed
Assignees
Milestone

Comments

@rosen-vladimirov
Copy link
Contributor

tns plugin add <plugin> has some issues with stdin when postinstall is using inquirer.
For example create plugin that has the following postinstall script:

"postinstall": "npm install inquirer && node myScript.js"

where myScript.js is something like:

var inquirer = require('inquirer');
var quest = {
    'name': 'myinq',
    'type': 'input',
    'message': 'Ask something: ',
    'default': undefined
};

function promptForEmail() {
    inquirer.prompt([quest],
        function(answers) {
            console.log("answers:", answers);
        });
}

promptForEmail();

In case you call npm install <plugin> the prompt is executed correctly and user can type.
In case you call tns plugin add <plugin> the user's input is slowed down, some symbols are not shown at all, etc.

Required for nativescript-telerik-ui.

@rosen-vladimirov
Copy link
Contributor Author

Reproducible without using inquirer. Set the postinstall script to be:

const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question('Ask something:? ', (answer) => {
    console.log('Thank you for your valuable feedback, which was:\n', answer);
    rl.close();
});

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

No branches or pull requests

2 participants