madrun

CLI tool to run multiple npm-scripts in a madly comfortable way

MIT 145 个版本
安装
npm install madrun
yarn add madrun
pnpm add madrun
bun add madrun
README

🏎 Madrun License NPM version Build Status Coverage Status

image

CLI tool to run multiple npm-scripts in a madly comfortable way. Can be used together with redrun.

Install

npm i madrun -g

Usage

First thing you should do is:

  • ✅ create .madrun.js file with all scripts written in JavaScript;
  • ✅ update package.json scripts to use madrun;

This can be done using:

madrun --init

When you create new script, you can run it with: madrun lint test. Run madrun --init again, to update package.json, so you can use:

npm run lint
npm test

Then you can run madrun without args to see list of a scripts. Or run:

madrun <script>

To run specified script.

Completion

You can enable tab-completion of npm scripts similar to npm's completion using:

madrun-completion >> ~/.bashrc
madrun-completion >> ~/.zshrc

You may also pipe the output of madrun-completion to a file such as /usr/local/etc/bash_completion.d/madrun if you have a system that will read that file for you.

Options

Madrun can be configured using env variables.

MADRUN_PWD

MADRUN_PWD will output current directory path:

MADRUN_PWD=1 madrun lint
> putout lib test .madrun.js (/home/coderaiser/cloudcmd)

MADRUN_NAME

MADRUN_NAME will output name of current directory:

MADRUN_NAME=1 madrun lint
> putout lib test .madrun.js (cloudcmd)

API

madrun supports next API set:

run(name, [opt, env])

Run script by a name or regexp.

  • name - name of a script
  • opt - options to run with
  • env - object with env variables
  • scripts - all scripts set (need for embedding only)

series(names, [opt, env, scripts])

Run scripts by a name or regexp one-by-one.

  • name - array of names of scrips
  • opt - options to run with
  • env - object with env variables
  • scripts - all scripts set (need for embedding only)

parallel (names, [opt, env, scripts])

Run scripts by a name or regexp parallel.

  • name - array of names of scrips
  • opt - options to run with
  • env - object with env variables
  • scripts - all scripts set (need for embedding only)

cutEnv(name, [opt, env])

Same as run, but returns result without env.

  • name - name of a script
  • opt - options to run with
  • env - object with env variables
  • scripts - all scripts set (need for embedding only)

Example

Let's install madrun and save it as devDependency with:

npm i madrun -D

Let's create file .madrun.js:

import {run, cutEnv} from 'madrun';

const env = {
    CI: 1,
};

export default {
    'lint': () => 'putout .',
    'fix:lint': async () => await run('lint', '--fix', {
        NODE_ENV: 'development',
    }),
    'lint:env': () => ['putout .', {
        CI: 1,
    }],
    'env:lint': () => [env, 'putout .'],
    'lint:no-env': async () => await cutEnv('lint:env'),
};

Now you can call any of listed scripts with help of 🏎 Madrun:

madrun lint
> putout .

For series run you can use:

madrun lint:*
> CI=1 putout . && putout .
  • redrun - CLI tool to run multiple npm-scripts fast.

License

MIT

版本列表
13.0.4 2026-07-16
13.0.3 2026-07-01
13.0.2 2026-05-19
13.0.1 2026-03-07
13.0.0 2026-02-16
12.1.3 2026-01-28
12.1.2 2026-01-28
12.1.1 2026-01-28
12.1.0 2026-01-04
12.0.0 2025-12-31
11.0.7 2025-12-31
11.0.6 2025-12-30
11.0.5 2025-12-30
11.0.4 2025-12-04
11.0.3 2025-09-18
11.0.2 2025-05-29
11.0.1 2025-04-08
11.0.0 2025-03-21
10.2.5 2025-02-12
10.2.4 2025-01-29
10.2.3 2025-01-20
10.2.2 2024-12-13
10.2.1 2024-09-25
10.2.0 2024-09-25
10.1.0 2024-07-16
10.0.1 2024-01-19
10.0.0 2023-12-09
9.4.1 2023-11-09
9.4.0 2023-09-14
9.3.1 2023-08-04
9.3.0 2023-07-06
9.2.0 2023-05-01
9.1.0 2023-03-07
9.0.8 2023-03-06
9.0.7 2022-10-20
9.0.6 2022-07-20
9.0.5 2022-06-23
9.0.4 2022-05-27
9.0.3 2022-05-08
9.0.2 2022-03-29
9.0.1 2022-03-29
9.0.0 2022-02-17
8.10.1 2022-01-14
8.10.0 2022-01-14
8.9.1 2022-01-12
8.9.0 2021-12-21
8.8.12 2021-11-10
8.8.11 2021-10-31
8.8.10 2021-09-12
8.8.9 2021-09-09
8.8.8 2021-09-09
8.8.7 2021-08-25
8.8.6 2021-07-16
8.8.5 2021-05-28
8.8.4 2021-05-18
8.8.3 2021-05-03
8.8.2 2021-03-27
8.8.1 2021-03-02
8.8.0 2021-02-16
8.7.2 2021-02-15
8.7.1 2021-02-13
8.7.0 2021-02-12
8.6.5 2021-02-11
8.6.4 2021-01-26
8.6.3 2021-01-26
8.6.2 2021-01-25
8.6.1 2021-01-22
8.6.0 2021-01-11
8.5.0 2021-01-11
8.4.0 2021-01-11
8.3.8 2020-12-30
8.3.7 2020-12-30
8.3.6 2020-12-30
8.3.5 2020-12-29
8.3.4 2020-12-29
8.3.3 2020-12-28
8.3.2 2020-12-28
8.3.1 2020-12-28
8.3.0 2020-12-28
8.2.0 2020-12-25
8.1.0 2020-12-18
8.0.5 2020-12-07
8.0.4 2020-12-07
8.0.3 2020-12-07
8.0.2 2020-12-05
8.0.1 2020-12-05
8.0.0 2020-11-26
7.0.5 2020-11-04
7.0.4 2020-09-16
7.0.3 2020-09-11
7.0.2 2020-08-09
7.0.1 2020-07-28
7.0.0 2020-06-24
6.0.1 2020-05-07
6.0.0 2020-05-04
5.5.0 2020-04-24
5.4.5 2020-03-08
5.4.4 2020-02-24
5.4.3 2020-02-24
5.4.2 2020-02-10
5.4.1 2019-12-30
5.4.0 2019-12-25
5.3.0 2019-12-21
5.2.1 2019-12-21
5.2.0 2019-12-20
5.1.1 2019-12-20
5.1.0 2019-12-19
5.0.1 2019-11-21
5.0.0 2019-11-06
4.2.0 2019-11-04
4.1.4 2019-10-28
4.1.3 2019-10-28
4.1.2 2019-10-28
4.1.1 2019-10-27
4.1.0 2019-10-25
4.0.0 2019-10-25
3.1.1 2019-10-24
3.1.0 2019-10-24
3.0.6 2019-10-07
3.0.5 2019-09-18
3.0.4 2019-09-18
3.0.3 2019-09-11
3.0.2 2019-09-09
3.0.1 2019-08-29
3.0.0 2019-08-29
2.5.1 2019-08-27
2.5.0 2019-08-05
2.4.0 2019-08-05
2.3.1 2019-07-22
2.3.0 2019-07-21
2.2.0 2019-07-21
2.1.4 2019-07-11
2.1.3 2019-07-10
2.1.2 2019-03-21
2.1.1 2019-03-12
2.1.0 2019-02-21
2.0.1 2019-02-15
2.0.0 2019-02-15
1.4.0 2019-02-15
1.3.0 2019-02-13
1.2.0 2019-02-13
1.1.1 2019-02-08
1.1.0 2019-02-01
1.0.1 2019-01-25
1.0.0 2019-01-25