ruyadorno/ntl

Feature Request: allow scripts to be ignored from list

fiznool opened this issue Β· 8 comments

If you prefer to install npm modules locally, and run them via npm run, you can install ntl in this way:

npm install --save-dev ntl

Then you can configure in your package.json:

"scripts": {
  "start": "ntl",
  ...
}

This means you don't need to install ntl globally, and instead you can run npm start to bring up the ntl options.

The issue is, ntl will also display start as one of the items in the list. It would be nice to ignore this script via a command line flag. For example:

"scripts": {
  "start": "ntl --ignore start",
  ...
}

Or in general, for example, a precommit script with lint-staged.

The ntl package.json field could be expanded with a blacklist array option. In my case, it would be:

  "scripts": {
    "ntl": "ntl",
    "precommit": "lint-staged",
    "dev": "..."
  },
  "ntl": {
    "blacklist": ["precommit", "ntl"],
    "descriptions": {
      "dev": "Launch dev mode"
    }
  }

πŸ‘ for the blacklist option.

Excluding npm start isn’t possible because it’s just a personal use case.

I just wonder if this should be another key in the package.json or if it would make more sense to have an option for that like:

-b, --blacklist       Exclude scripts from the list      [list]

or:

-e, --exclude       Exclude scripts from the list      [list]

Example:

ntl --exclude=precommit,ntl

Hej @ruyadorno,

would you accept a PR for that? :octocat:

sure thing! my thoughts:

  • naming-wise I think either --exclude or --ignore are much better options
  • ideally we should support both package.json field AND cli options (but if you want to start with just one that's fine πŸ‘ )
  • another improvement I think could be useful is to be able to accept * in order to ignore a given prefix/suffix e.g: --ignore=pre* to ignore all pre-scripts

@paquan and me are currently working on this.

We have decided to name the option -e --> --exclude to prevent an alias name clash with -i -> --info.

We skip support of defining the excludes via an exclude key in the package.json because this should be done with #23.

PR is created :octocat:

Landed on v3.2.0

thank you so much @mischah @Paquan πŸŽ‰

It was our pleasure and we hat lots of fun working together on this πŸ˜„