npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

better-scripts

v0.4.3

Published

The next level of npm scripts. An npm scripts runner. A better way to organize your npm scripts. Make redundant NPM scripts easier to read, maintain and use.

Downloads

6,610

Readme

Installation

Install with yarn

yarn add better-scripts -D

Or install with npm

npm install better-scripts --save-dev

Or install with pnpm

pnpm add better-scripts -D

Or use npx for one-time use

npx better-scripts

Usage

Basic setup

Simply run npx better-scripts will read your existing scripts, let's give it a try at first

npx better-scripts

Now, let's move all scripts into better-scripts and add only one "scripts": "better-scripts" in scripts

{
  "scripts": {
    "scripts": "better-scripts"
  },
  "better-scripts": {
    "dev": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test"
  }
}

Then run yarn scripts will read your scripts from better-scripts

yarn scripts

Add script description

Second value as description in array form

{
  "better-scripts": {
    "dev": ["react-scripts start", "Start a development server"]
  }
}

Script as object

You can add more properties in object form

{
  "better-scripts": {
    "dev": {
      "alias": "🧑🏻‍💻 Dev",
      "command": "react-scripts start",
      "desc": "Start a development server"
    }
  }
}

Separate configuration file

You can write your "better-scriprts" out of package.json

Create a scripts.json file in the root directory

{
  "dev": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test"
}

Supported file formats

  • a better-scripts property in package.json (⭐️ Recommended)
  • scripts.json (⭐️⭐️ Recommended)
  • better-scripts.json
  • .better-scriptsrc
  • .better-scriptsrc.json
  • .better-scriptsrc.yaml
  • .better-scriptsrc.yml
  • .better-scriptsrc.js
  • .better-scriptsrc.cjs
  • better-scriptsrc.config.js
  • better-scriptsrc.config.cjs

Specified configuration file

yarn scripts --config custom-config.json

Command line

yarn scripts --help

➤_ A better way to organize your npm scripts

Commands:
  better-scripts              Run your script  [default]
  better-scripts run <name>   Run script non-interactive, usually in CI mode
  better-scripts list [name]  Show all scripts

Options:
  -v, --version  Show version number  [boolean]
  -c, --config   Specified config filepath  [string]
      --track    Show tracked error stack message
  -h, --help     Show help  [boolean]

Examples:
  npx better-scripts                   - Run your script interactive
  npx better-scripts run dev           - Run "dev" script non-interactive
  npx better-scripts run build.deploy  - Run "build" and "deploy" child script in chain order
  npx better-scripts list              - Show all scripts

Default

Interactive with one simple command

yarn scripts

Run

Non-interactive with specific command

yarn scripts run <name>

<name> is your script name that defined in config

Chain operation

yarn scripts run <name.name...>

Skip chaining paths

yarn scripts run <name.name...> --skip

-s, --skip

List

Show all your scripts

yarn scripts list

Compact mode

yarn scripts list --compact

Show specific script name's scripts

yarn scripts list <name>
yarn scripts list <name.name...>

Advanced

The API is not stable yet

Contributors

| iamyoki | Garker | annoyc | | :---------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------: | | iamyoki | Garker | annoyc |

License

MIT