Giter Club home page Giter Club logo

nprr's Introduction

(Deprecated! Please check out https://fig.io/ or https://github.com/antfu/ni as possible alternatives)


nprr

nprr: npm run + autocomplete πŸš€

TL;DR: install it with $ npm i -g nprr, run it with $ nprr. If you want, add an alias.

npm Build Status Coverage Status Mutation testing badge Build Cron
Renovate enabled Commitizen friendly semantic-release Open Source Love Known Vulnerabilities

Nprr demo Watch the video on asciinema

What is nprr?

Nprr logo

Nprr is an npm run enhancer! It runs the good npm run programmatically (through npm.run(), not child_process.exec()) or let you choose the script to launch with autocomplete.

Features

  • runs a script the same way npm run would do
  • $ nprr reads the package.json scripts and let you choose the script to run with autocomplete
  • $ nprr te filters all the scripts containing te and lets you choose the script to run with autocomplete
  • $ nprr test runs directly any existing script (ex. test)

Examples

Imagine your package.json contains the following scripts:

{
  "scripts": {
    "test": "...",
    "test:unit": "...",
    "test:e2e": "...",
    "build:production": "...",
    "build:staging": "...",
    "commit": "..."
  }
}
  • $ nprr presents an autocomplete with all the available scripts
  • $ nprr te presents an autocomplete with all the scripts containing "te" ("test", "test:unit", "test:e2e")
  • $ nprr test launches directly npm run test

Command options

All the scripts can be launched with options too, all the next examples chain op1 op2 to the executed script, just after the autocomplete (or exact match) process:

  • $ nprr -- op1 op2
  • $ nprr te -- op1 op2
  • $ nprr te op1 op2
  • $ nprr test -- op1 op2
  • $ nprr test op1 op2

Installation

npm i -g nprr

FAQ

Could it be aliased to something shorter like "npr" or even "r"?

Yep! All the bin names are stored in /usr/local/bin and if you open it you can find the "nprr" symlink as long as the "npm" one (and "npx", etc.). All you need to do is duplicating it by running:

$ cp -a /usr/local/bin/nprr /usr/local/bin/YOUR_SHORTCUT (replace "YOUR_SHORTCUT" with "npr", "r" or whatever you want)

If you change your mind and you want to remove the new shortcut, do not worry: remove it by running

$ rm /usr/local/bin/YOUR_SHORTCUT

How does it work?

Read the dedicated article, both on Medium or dev.to.

Could I use nprr programmatically?

Certainly! The script below leverages nprr and gets the arguments passed to nprr.run() (please, do not forget to install nprr locally with npm i -D nprr)

const nprr = require("nprr");
nprr("test").then(argv => {
  console.log(argv);
});

Nprr accepts an array of strings or a string as the only argument.

Is it possible to edit the filter passed to nprr?

Unfortunately not but I'd love to add it as soon as possible. Nprr leverages Enquirer but, at the moment, it does not allow to do that, see the related issue (and Inquirer can do that neither).

Could npm allow for both autocomplete and fuzzy search?

At the moment the fuzzy search is not supported. I need to investigate how it could be done with Enquirer/Inquirer.

Why did you call it nprr?

Because "npr" has already been used on NPM.

Why did not you call it npra (npr + autocomplete)?

Because "nprr" is faser to be typed compared to "npra".

Does a less-obtrusive solution exist to list the package.json scripts without opening it?

Yes, it's the built-in npm-completion.

How could I record a video of a terminal session like you did with the opening gif?

Use asciinema. If you want to generate a GIF, make the video public and convert it launching $ docker run --rm -v $PWD:/data asciinema/asciicast2gif https://asciinema.org/a/VIDEOID.json video.gif.

Notes

The E2E tests are run directly with Travis, take a look at the .travis.yml file.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Stefano Magni
Stefano Magni

πŸ’» πŸ“– πŸ–‹ πŸ’‘ πŸ€”

This project follows the all-contributors specification. Contributions of any kind welcome!

nprr's People

Contributors

dependabot[bot] avatar noriste avatar renovate-bot avatar renovate[bot] avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

michael-realt

nprr's Issues

Use of mutation testing in nprr - Help needed

Hello there!

My name is Ana. I noted that you use the mutation testing tool StrykerJS in the project.
I am a postdoctoral researcher at the University of Seville (Spain), and my colleagues and I are studying how mutation testing tools are used in practice. With this aim in mind, we have analysed over 3,500 public GitHub repositories using mutation testing tools, including yours! This work has recently been published in a journal paper available at https://link.springer.com/content/pdf/10.1007/s10664-022-10177-8.pdf.

To complete this study, we are asking for your help to understand better how mutation testing is used in practice, please! We would be extremely grateful if you could contribute to this study by answering a brief survey of 21 simple questions (no more than 6 minutes). This is the link to the questionnaire https://forms.gle/FvXNrimWAsJYC1zB9.

We apologize if you have already received message multiple times or if you have already had the opportunity to complete the survey. If you have already shared your feedback, we want to convey our appreciation, kindly disregard this message, and please accept our apologies for any inconvenience.

Drop me an e-mail if you have any questions or comments ([email protected]). Thank you very much in advance!!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

npm
package.json
  • enquirer ^2.3.2
  • npm ^9.0.0
  • @semantic-release/npm 10.0.3
  • @stryker-mutator/core 7.0.1
  • @stryker-mutator/html-reporter 3.1.0
  • @stryker-mutator/javascript-mutator 4.0.0
  • @stryker-mutator/jest-runner 7.0.1
  • coveralls 3.1.1
  • cz-conventional-changelog 3.3.0
  • jest 29.5.0
  • jest-watch-typeahead 2.2.2
  • semantic-release 21.0.3
test-projects/import-nprr/package.json
travis
.travis.yml
  • node 10

  • Check this box to trigger a request for Renovate to run again on this repository

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

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.