Skip to content

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

Closed

Description

@rosen-vladimirov

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.

Activity

  1. added this to the 1.7.1 milestone on Mar 15, 2016
  2. rosen-vladimirov commented on Mar 22, 2016

    @rosen-vladimirov
    ContributorAuthor

    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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions