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

[Feature]: provide --interactive (-i) option #238

Open
DmitryEfimenko opened this issue Jan 26, 2023 · 0 comments
Open

[Feature]: provide --interactive (-i) option #238

DmitryEfimenko opened this issue Jan 26, 2023 · 0 comments

Comments

@DmitryEfimenko
Copy link

  • nps version: 5.10.0
  • node version: 18.10.0
  • npm version: 8.19.2

Problem description:

The nps does a great job organizing scripts. But even then the scripts might grow to the extent where it's hard to remember exactly the command you need to run. I see the nps provides autocomplete feature, but it's currently buggy and also would not provide the experience I'm after.

Suggested solution:

I'd like to propose --interactive option. When used, the nps would traverse the top-level scripts and use inquirer (probably) or commander to present these scripts as options to select from. Once one option is selected, if there are sub-options, these are presented. Otherwise, nps would execute the associated command.

Scripts file (or at least the relevant bits):

module.exports = {
  scripts: {
    default: "node index.js",
    lint: "eslint .",
    test: {
      default: "jest",
      watch: {
        script: "jest --watch",
        description: "run in the amazingly intelligent Jest watch mode"
      }
    },
    build: {
      default: "webpack",
      prod: "webpack -p"
    },
    validate: npsUtils.concurrent.nps("lint", "test", "build")
  }
};

The command executed:

nps -i

The output:

> default: node index.js
  lint: eslint .
  test...
  build...
  validate: npsUtils.concurrent.nps("lint", "test", "build")
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

No branches or pull requests

1 participant