Giter Site home page Giter Site logo

ruyadorno / ntl Goto Github PK

View Code? Open in Web Editor NEW
890.0 9.0 45.0 855 KB

Node Task List: Interactive cli to list and run package.json scripts

Home Page: https://www.npmjs.com/package/ntl

License: MIT License

JavaScript 100.00%
javascript js nodejs cli command-line npm workflow

ntl's Introduction




ntl


Node Task List

NPM version Build Status Coverage Status License Join the chat at https://gitter.im/ipipeto/Lobby

Interactive cli tool that lists and run package.json scripts.

An iPipeTo workflow


Table of Contents


⬇️ Install

$ npm install -g ntl

🔎 Usage

Navigate to any folder containing a package.json file (usually a Node.js project) that has configured scripts, then just use the ntl command:

ntl

You can also specify a path to a project folder containing a package.json file:

ntl ./my-node-project


demo animation


😍 Features

  • Interactive interface that lists all package.json scripts
  • Select any item in the interactive interface to execute that task
  • Add descriptions to each task that can be shown in the UI
  • Multiple interactive interfaces (menu list, autocomplete fuzzy search)
  • Many options to customize the UI (exclude scripts, amount of items, etc)
  • Easy to repeat last ran script (nt and rerun options)
  • Run multiple tasks
    • Repeat previously set of ran tasks
    • Preserve order of selection
  • Customize rerun cache options

📚 Customize

Custom runner

By default Node Task List tries to use npm to run the configured script tasks. In case you want to use a custom runner (e.g: yarn or pnpm) you can configure ntl to use whatever runner you prefer.

That can be configured system-wide by setting the environment variable in your profile file (.bashrc or .bash_profile for macos). In case you only want to ever use yarn as your node task runner, you should set:

# .bashrc (linux) OR .bash_profile (macos)
export NTL_RUNNER=yarn

Keep in mind environment variables are flexible enough that they can also be set temporarily prior to running a command, so the following would also work:

NTL_RUNNER=yarn ntl

You can also define a runner in a per-project basis using the ntl configuration of your package.json, e.g:

{
  "name": "<project>",
  "version": "1.0.0",
  "ntl": {
    "runner": "yarn"
  }
}

Using task descriptions

📝 You can define descriptions for your tasks in your package.json file by defining a ntl section, e.g:

{
  "name": "<project>",
  "version": "1.0.0",
  "scripts": {
    "build": "make build",
    "coverage": "jest --coverage",
    "test": "jest"
  },
  "ntl": {
    "descriptions": {
      "build": "Builds the project",
      "coverage": "Run test outputing code coverage",
      "test": "Run project's tests"
    }
  }
}

These descriptions will be shown anytime you run ntl.


Displaying task contents

Use the --info or simply -i option in order to display the contents of each script task, like:

$ ntl -i
⬢  Node Task List
? Select a task to run: (Use arrow keys)
❯ generate-manual › maked-man README.md > man/man1/ntl.1
          pretest › eslint cli.js rerun.js test
             test › cross-env NTL_NO_RERUN_CACHE=1 tap

Task contents will also be shown when using the --descriptions option and no description is available for a given item.


Exclude tasks from UI

You can define a list of scripts to be excluded from the interactive menu using the --exclude option:

$ ntl -e coverall tasks
⬢  Node Task List
? Select a task to run: (Use arrow keys)
❯ test
  test:watch

You can also use a wildcard character to exclude multiple scripts:

$ ntl -e "test*"
⬢  Node Task List
? Select a task to run: (Use arrow keys)
❯ coveralls
  tasks

Exclude tasks with missing descriptions

You can also filter out items that doesn't have a description using the --descriptions-only or -o option.


Customize cache

ntl uses a cache system that stores the last ran command for each project in order to make it easier for users to repeat it. Given its importance, the following environment variables are available in order to customize its location and size:

  • NTL_RERUN_CACHE_DIR: Defines a directory to store the cache file
  • NTL_RERUN_CACHE_NAME: Filename to use for the cache
  • NTL_RERUN_CACHE_MAX: Number of items to store in the cache (defaults to 10)
  • NTL_NO_RERUN_CACHE: When defined, avoid the cache system completely

For example, if a given user wanted to store its cache in ~/.ntl/cache location and save up to 100 items in it, they could add the following to their .bashrc (linux) or .bash_profile (macos):

export NTL_RERUN_CACHE_DIR=$HOME
export NTL_RERUN_CACHE_NAME=cache
export NTL_RERUN_CACHE_MAX=100

The cache can also be customized through command line options:

  • --rerun-cache-dir Defines a directory to store the cache file
  • --rerun-cache-name: Filename to use for the cache
  • --no-rerun-cache: Avoids the cache system completely

UI Size

You can increase/reduce the size of the presented UI list using the --size or -s option. In this example we just increased the size of the list to show up to 12 items at once:

$ ntl -s 12
⬢  Node Task List
? Select a task to run:
❯ build
  generate-manual
  hello
  bomdia
  bonjour
  test
  test:dev
  test:ci
  test:integration
  test:unit
  test:e2e
  start

The default size value is 7 items.


🔄 Repeat the last ran task

ntl provides many options to make it easier to rerun the last task, either through having it selected as default option the next time you run the ntl command, or by using one of the following:

  • The ultra convenient way: nt command shorthand 😎 (You should think of nt as: "ok, just run the last node task", in contrast to ntl which should be interpreted as: "ok, give me the node task list again") in case no previous task is available, running nt will behave exactly as ntl
  • Using a --rerun or -r flag, e.g: ntl -r
  • Prepending the NTL_RERUN env variable, e.g: NTL_RERUN=true ntl

demo animation showing how to rerun a script using the nt command shorthand


Ⓜ️ Run multiple tasks

Using the --multiple or -m option, the interface becomes a checkbox-based list that allows you to select multiple tasks and run them in serial.

$ ntl -m
⬢  Node Task List
? Select a task to run:
 ◯ start
 ◉ test
❯◉ test:ci

demo animation showing how to use -m to have a checkbox interface allowing for selection of multiple tasks to be ran in serial

Better yet, combine that with the rerun feature and you can repeat multiple tasks using the nt command.

Run multiple tasks in order of selection

You can run multiple tasks in the order you pick them 😎 Use the --ordered or -O option:

$ ntl -O
⬢  Node Task List
? Select a task to run: (Press <space> to select, <r> to res
et)
 ◯   bar › Test task
 ◯   foo › Test task
❯2 hello › Hello world
 ◯ start › Start the development server
 1  test › Run all tests for the project

⏩ Run in autocomplete or fuzzy search mode

Use --autocomplete or -A option in order to use an interface variation that allows you to type the name of the task instead of browsing through an arrow-based menu. This mode can be very helpful when managing a long list of tasks.

$ ntl -A
⬢  Node Task List
? Select a task to run: t
❯ pretest
  test
  start

demo animation showing how to use -m to have a checkbox interface allowing for selection of multiple tasks to be ran in serial


Tips

ntl as default task

You can define ntl as a dev dependency and one of the tasks of your project, specially start - so whenever someone runs npm start or yarn start they get the convenient ntl interface. Like in the following package.json example:

{
  "name": "<project>",
  "version": "1.0.0",
  "scripts": {
    "start": "ntl"
  },
  "devDependencies": {
    "ntl": "^5.0.0"
  }
}

Exclude scripts

You can also define a task that invokes ntl while excluding other tasks, e.g:

{
  "scripts": {
    "test": "jest --coverage",
    "test:watch": "jest --coverage --watchAll",
    "coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
    "tasks": "ntl --exclude coverall tasks"
  }
}

Included command aliases

  • ntl The default command
  • nodetasklist Longhand version in case users have conflicting ntl commands
  • npm-tasklist Legacy longhand version
  • nt Rerun last script shortcut
  • nodetask Rerun last script longhand

ℹ️ Help

Still feel like you could use some --help ?

Usage:
  ntl [<path>]             Build an interactive interface and run any script
  nt [<path>]              Rerun last executed script

Options:
  -a, --all                Includes pre and post scripts on the list   [boolean]
  -A, --autocomplete       Starts in autocomplete mode                 [boolean]
  -D, --debug              Prints to stderr any internal error         [boolean]
  -d, --descriptions       Displays the descriptions of each script    [boolean]
  -o, --descriptions-only  Limits output to scripts with a description [boolean]
  -h, --help               Shows this help message                     [boolean]
  -i, --info               Displays the contents of each script        [boolean]
  -e, --exclude            Excludes specific scripts                     [array]
  -m, --multiple           Allows the selection of multiple items      [boolean]
  -O, --ordered            Selects multiple items in order             [boolean]
  -s, --size               Amount of lines to display at once           [number]
  --rerun-cache-dir        Defines the rerun task cache location        [string]
  --rerun-cache-name       Defines the rerun task cache filename        [string]
  --no-rerun-cache         Never write to or read from cache           [boolean]
  -v, --version            Show version number                         [boolean]
  -r, --rerun              Rerun last executed script                  [boolean]

Visit https://github.com/ruyadorno/ntl for more info

License

MIT © 2020 Ruy Adorno

ntl's People

Contributors

bclinkinbeard avatar darahak avatar dependabot[bot] avatar goatfried avatar littlewhiteya avatar mehdi-hp avatar mischah avatar mkamakura avatar recuencojones avatar ruyadorno avatar vladimyr avatar wgolledge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ntl's Issues

Exits program on ESC is slow

In my CLI, I noticed after running ntl and pressing ESC key it takes few milliseconds before exiting. All the other actions execute immediately.

In the following screenshot, I pressed The ESC button and highlighted the mouse at the same time.

ntl-esc-slow

ntl breaks when trying to list only-description tasks + show info

ntl is breaking pretty bad when trying to use a particular combination of options:

In a given project with no task descriptions:

$ ntl -i -o
.../ntl/cli.js:86
const longestScriptName = (scripts) => Object.keys(scripts).reduce((acc, curr) => curr.length > acc.length ? curr : acc).length;
                                                            ^

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at longestScriptName (.../ntl/cli.js:86:61)
    at .../ntl/cli.js:90:57
    at Array.map (<anonymous>)
    at Object.<anonymous> (.../ntl/cli.js:90:25)

most 7 items

Git command shows the most 7 'npm scripts' items, how can I do to show more? I write more than 10 scripts in package.json.

Not working in Win 10

Just had a play in Win 10. Although the menu works, nothing happens after you press enter. I'm guessing it has a problem with the Exec() bit. Any thoughts?

Misleading error message when package.json is malformed

Node.js version: 8.12.0
ntl version: 3.0.0

Attempting to run ntl with a malformed package.json (with a missing comma, for instance) will display the following error message:

✖  No package.json found

The error message should be different when package.json is malformed to make troubleshooting easier.

Put executed commands in history

I wish I could use ntl to find a command, run it, and then the next time I want to run that same command again, I can just arrow-up in my shell and run it again, instead of running ntl and arrowing through the options a second time.

Maybe the shell-history module would make this easy.

Support a description for npm scripts

Hey — this project is great, exactly what I've been looking for. Thanks for building it!

My team has a lot of scripts to manage, and some have similar names but different behaviour (eg, build and build_watch). I'd like to be able to provide a description of the commands as documentation. Is that something you'd be willing to see added? (I'll happily do the PR)

I was thinking it could use the config key in package.json:

{
  "scripts": {
    "start": "...",
    "test": "...",
    "lint": "..."
  },
  "config": {
    "ntl": {
      "start": "Start a development server",
      "test": "Run the unit tests",
      "lint": "Lint JavaScript and Sass"
    }
  }
}

Any thoughts?

Show more tasks

Maybe I'm weird, but many of my projects have more than eight scripts. I know I can arrow down through them all, but it would be nice if ntl showed all of the scripts.

screen shot 2017-02-23 at 9 49 22 am

Absolute path not working

Currently if trying to use an absolute path as the filename argument, such as:

ntl /home/user/project/

will always result in:

✖  No package.json found

An option for choosing custom npm client

For now, ntl use npm to execute script by default. I need to use private npm client to execute script for some reasons(like preset npm remote registry, etc...), so is it possible to add an option for setting private npm client?

Error when running native node test-runner module + tap-spec + esm

Using the Node.js v18.7 and tap-spec to pipe results from the node test runner the ntl command outputs ✖ Error building interactive interface and the nt throws an exception

Steps for reproducing the error:

// test.mjs
import {
  describe,
  it
} from 'node:test'
import {
  deepStrictEqual
} from 'node:assert'

describe('Array new features', () => {
  describe('new immutable array functions', () => {
    it('old way to change arrays (mutable)', () => {
      const items = [1, 3, 2]
      items.sort() // [1, 2, 3]

      deepStrictEqual(items, [1, 2, 3])
    });
  });
});

My script in the package.json file

//package.json
"scripts": {
    "test": "node --no-warnings mytest.mjs | tap-spec"
 },
"devDependencies": {
    "tap-spec": "^5.0.0"
 },

Using ntl

ntl
⬢  Node Task List
? Select a task to run: test

> [email protected] test
> node --no-warnings mytest.mjs | tap-spec

        # Subtest: new immutable array functions
            # Subtest: old way to change arrays (mutable)
            ok 1 - old way to change arrays (mutable)
              ---
              duration_ms: 0.000995537
              ...

  Subtest: Array new features

        ok 1 - new immutable array functions
          ---
          duration_ms: 0.003098021
          ...
    ✔ Array new features
✖  Error building interactive interface
nt 

> [email protected] test
> node --no-warnings mytest.mjs | tap-spec

        # Subtest: new immutable array functions
            # Subtest: old way to change arrays (mutable)
            ok 1 - old way to change arrays (mutable)
              ---
              duration_ms: 0.001907764
              ...

  Subtest: Array new features

        ok 1 - new immutable array functions
          ---
          duration_ms: 0.003592342
          ...
    ✔ Array new features
node:child_process:926
    throw err;
    ^

Error: Command failed: npm run test
    at checkExecSyncError (node:child_process:851:11)
    at execSync (node:child_process:923:15)
    at /Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:198:3
    at Array.forEach (<anonymous>)
    at executeCommands (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:197:7)
    at runCachedTask (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:166:3)
    at hasCachedTasks (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:170:9)
    at run (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:262:6)
    at Object.<anonymous> (/Users/erickwendel/.nvm/versions/node/v18.7.0/lib/node_modules/ntl/cli.js:294:2) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 33161,
  stdout: null,
  stderr: null
}

Node.js v18.7.0

Configuration via file

Hi, thanks for this nice little utility :)

I'd like to configure ntl sytem-wide without the need of adding option parameters for each call, e.g. ntl -A -s 20. A bash alias would work, but something like a .ntlrc would be more convenient. Prettier uses cosmiconfig for this, so you get a lot of configuration methods:

  • A .prettierrc file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json/.js.
  • A prettier.config.js file that exports an object.
  • A "prettier" key in your package.json file.

The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.

What do you think about this?

Error when "-O" option

When

ntl --ordered true

or

ntl -O

I get a error

⬢  Node Task List
internal/modules/cjs/loader.js:1102
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/mycomputer/WebstormProjects/togglefly/node_modules/.pnpm/[email protected]/node_modules/cli-cursor/index.js
require() of ES modules is not supported.
require() of /home/mycomputer/WebstormProjects/togglefly/node_modules/.pnpm/[email protected]/node_modules/cli-cursor/index.js from /home/mycomputer/WebstormProjects/togglefly/node_modules/.pnpm/[email protected][email protected]/node_modules/inquirer-ordinal-prompt/dist/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /home/mycomputer/WebstormProjects/togglefly/node_modules/.pnpm/[email protected]/node_modules/cli-cursor/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/mycomputer/WebstormProjects/togglefly/node_modules/.pnpm/[email protected]/node_modules/cli-cursor/package.json.

    at new NodeError (internal/errors.js:322:7)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/home/mycomputer/WebstormProjects/togglefly/node_modules/.pnpm/[email protected][email protected]/node_modules/inquirer-ordinal-prompt/dist/index.js:4:19)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  code: 'ERR_REQUIRE_ESM'
}

Node Version: v14.20.0
PNPM version: 7.8.0
OS: Ubuntu 20.04.4 LTS

I got the same error in another project using NPM version 6.14.17. In my first project I'm using ESM but in the second one I'm not. I also tried to make a minimal reproduction project for this issue, but it worked. It may be a problem with my computer or my projects, I'm still investigating.

EDIT
I forgot to put the version of my NPM: v6.14.17.

Support command invocation with 'o' keystroke.

Hi @ruyadorno. I love this tool!

I especially like that j and k work out of the box. github.com and gmail.com have trained me to hit o to open the currently selected item, so that was my muscle memory instinct. I know enter works, but it might be worth supporting both keystrokes for command invocation.

Task description

It would be very handy if ntl provided a way to display a description about the available tasks. I believe it would be failry straightforward to implement this.

If you think it's a good idea I can give it a shot.

Numbers to script list in menu

Hi,
It would be nice to have a numbered list of task scripts so that by pressing that number, the script will be executed.
Then no need to scroll down to the task.

 Select a task or Press the no to run: (Use arrow keys)
❯0 start
 1 build
 2 test
 3 eject
 4 lint
 5 format

Animated SVGs

Viewing the project README is somewhat problematic on Safari 13 due to the animated SVGs on the page. They were apparently enough to cause my laptop to heat up quite a bit before I tracked the culprit down (the process for the repository landing page consumes a non-trivial amount of resources).

It might be worth changing how the project is showcased to prevent the problematic behavior from occurring for folks visiting the repository.

/cc @ruyadorno

[Q] How to pass the arguments?

How to pass arguments for the scripts. For example,

npm run abc -- a1=v1 a2=v2

How do I do this when executing a script through ntl?

NPM gives error due to exit code

Love this tool, thank you!

Am not sure if this is something in my environment (Git bash on Windows), but when I Escape, or Ctrl+D to exit the task list I get an NPM error due to exit code 1...

$ npm run menu

> [email protected] menu D:\alfie\projects\stt\sttlp-content
> ntl -o

√  Node Task List
? Select a task to run:
  decrease-ecs-beta › Decrease processor instances in beta to fast track resync. Requires AWS credential
      stop-ecs-beta › Stop processor on beta. Useful if you want to run processor locally for testing. Requires AWS credential
     check-ecs-beta › Check number of running instances after increase/decrease of the desired count. Requires AWS credential
>          make-nav › Re-create nav.json
        s3sync-beta › Force re-sync all files to S3. This will trigger Fargate processor for all files. Requires AWS credential
        s3sync-prod › Force re-sync all files to S3. This will trigger Fargate processor for all files. Requires AWS credential
       docker-build › Create new docker image. Requires Docker daemon
(Move up and down to reveal more choices)npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! menu: `ntl -o`
npm ERR! Exit status 1

My definition for the menu task looks like this:

  "scripts": {
    "menu": "ntl -o",
    ...
  }

Run tasks by name

It may seem counter intuitive but during some discussions in the npm cli I realized there's def a value to be provided to ntl users by allowing usage of positional arguments in order to run a task without the need of the interactive interface.

For one, it's an elegant way to fix the forwarding of arguments as described in #66 and it will also provide a nice shortcut alternative to npm run, e.g:

ntl build --with-flags -> npm run build -- --with-flags

Descriptions abruptly stopped displaying

I have been using ntl for a while but today, it abruptly stopped working. Is there anything in particular that may have caused this? I am not aware of a change in my environment.

Here's a reduced example of my package.json:

{
  "scripts": {
    "dev": "ntl -d -o",
    "dev:app": "cd ui/app && yarn serve",
    "dev:config": "cd ui/config && yarn serve"
  },
  "ntl": {
    "descriptions": {
      "dev:app": "Run app",
      "dev:config": "Run Config"
    }
  }
}

Output:

$ yarn dev
yarn run v1.13.0
$ ntl -d -o
No descriptions for your npm scripts found
✔ Npm Task List - v3.1.0
? Select a task to run: (Use arrow keys)

Feature Request: run last task

A lot of times I need to run the same task again and again (tests for example).
So I want to be able to run the last task in more convenient way for example:

ntl last
or
ntl rerun

Indenting Despite --descriptions-only or exclude tasks

{
  "scripts": {
    "foo": "foo",
    "bar baz qux quux quuz": "bar"
  },
  "ntl": {
    "descriptions": {
      "foo": "Lorem ipsum"
    }
  }
}

Even with using the descriptions only option, it still indents the script name as if those other option(s) were listed:

$ npx ntl
? Select a task to run: (Use arrow keys)
❯                   foo › Lorem ipsum 
  bar baz qux quux quuz ›  
  
$ npx ntl -o   
? Select a task to run: (Use arrow keys)
❯                   foo › Lorem ipsum 

Why does it matter?
If you have the situation where you only want to show scripts that have descriptions, but then some of the hidden script names are really long

Same thing occurs if you exclude a task with the -e exclude task arg

Change descriptions-only behavior

@mischah in current master I changed the default behavior of --descriptions-only to not depend on --descriptions anymore, so given:

scripts: {
	build: 'echo "build"',
	test: 'echo "test"'
},
ntl: {
	descriptions: {
		test: "Run tests"
	}
}

Running ntl -o will:

$ ntl -o
✔  Npm Task List - v4.0.0
? Select a task to run: (Use arrow keys)
❯ test

What is your opinion on it? I personally think it's simpler to have flags being independent from one another but I'd like your input and make sure you're aware of the somewhat breaking change.

using a seperate file to define scripts and paching them into package.json

Is there any interest for adding the possibility to patch the package.json with scripts defined in a seperate file?

It wouldn't be hard to implement and would allow users to use YAML, JS or JSON5 and their pleasantness.
This would also allow the command and the description to be right next to eachother, which i would like

command could look like this:

ntl -p/--patch path/to/file (defaulting to <pkg-root>/.ntlrc.<ext>)

so the structure would be something like:

{
    "build": {
      "command": "make build",
      "description": "Builds the project"
    },
    "coverage": {
      "command": "jest --coverage",
      "description": "Run test outputing code coverage"
    },
    "test": {
      "command": "jest"
    },
  // or if it has no desc, a shorthand
  "lint": "standard src/**/*.js"
}

this could be used together with general configs #23 like:

{
  // config properites...
 "scripts": {
  // like above...
  }
}

this would also expose a common surface for a module that extends ntl, as config properties can be easily added. we could also add a complementary API that lets you import these scripts (for eg. for usage with npm run-script)

this could also be extended down the line to rather easily implement monorepo support #58 via a 'namespace': {<name>: <path/to/package>} property or something like that.

I'm planning on writing a patcher that does something like this (without the many practicallity featueres of course) for a module i'm writing. so if there is interest in this, i could provide a fundament and help with the further implementation

"nt" not working in windows

In windows environments, command "nt" not working.

The application show this warning:

Unable to retrieve commands to rerun

Is there any way this option work on windows?

Obs .: in linux it works perfectly. ❤️
Thanks.

Requesting escape key and visual end marker.

ntl is very useful. Thank you!

Really appreciate that j and k are mapped so I can cruise tasks vim-style.

In addition, it would be great to have esc to exit ntl and to add a visual separator between the last choice and when it revolves back around to the beginning.

Fatal Error: v8::ToLocalChecked

Hello!

I'm tried to launch ntl in the folder doesn't containing a package.json file and got fatal error on output.

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal

Display task descriptions by default (but not commands)

I think it would make sense to display task descriptions by default (essentially enabling the -d switch by default), while hiding full commands for the sake of simplicity. The -d switch could be preserved to display commands for tasks that do not have a description.

This would improve discoverability of task descriptions and further encourage adding them to package.json.

Hide "No descriptions" found alert

ntl --size 12 --autocomplete --all --descriptions is desired for that little snippet view on the right side
image

but what is undesired is this annoying message at the top. lets get rid of it
image

Feature Request: allow scripts to be ignored from list

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",
  ...
}

Monorepo support

Hello! Does it has support for a mono repo? Scanning through multiple package.json?

Ignore all tasks that starts with underline (_)

I could get that working, but the command I needed was

$ ntl -e '__*'

I don't know why I tried a pattern for strings starting with double underline, but that's how I'm ignoring tasks that start with only one underline.

Conflict with Netlify `ntl` command

Netlfiy have recently added a shorthand ntl command that interferes with this command when both are installed on the same machine (this happens with or without npx).

Would it be possible to rename this command, or also have it listed under another (longhand?) command so that users are still able to access it after using Netlify.

Edit: I'm able to run with npx -p ntl --no-install ntl but it's a bit contrived.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.