18.0.0 β€’ Published 5 months ago

@putout/plugin-madrun v18.0.0

Weekly downloads
3,571
License
MIT
Repository
github
Last release
5 months ago

@putout/plugin-madrun NPM version

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

(c) Madrun

🐊Putout plugin adds ability to fix issues with Madrun config file.

Install

npm i putout @putout/plugin-madrun -D

Rules

{
    "rules": {
        "madrun/add-function": "on",
        "madrun/add-fix-lint": "on",
        "madrun/add-run": "on",
        "madrun/add-cut-env": "on",
        "madrun/call-run": "on",
        "madrun/convert-run-argument": "on",
        "madrun/convert-args-to-scripts": "on",
        "madrun/convert-run-to-cut-env": "on",
        "madrun/convert-cut-env-to-run": "on",
        "madrun/rename-series-to-run": "on",
        "madrun/rename-eslint-to-putout": "on",
        "madrun/set-lint-dot": "on",
        "madrun/convert-to-async": "on",
        "madrun/convert-nyc-to-c8": "on",
        "madrun/set-report-lcov": "on",
        "madrun/remove-check-duplicates-from-test": "on",
        "madrun/remove-useless-array-in-run": "on",
        "madrun/remove-useless-string-conversion": "on"
    }
}

add-function

❌ Example of incorrect code

module.exports = {
    hello: 'world',
};

βœ… Example of correct code

module.exports = {
    hello: () => 'world',
};

add-fix-lint

❌ Example of incorrect code

const {run} = require('madrun');

module.exports = {
    lint: 'putout lib test',
};

βœ… Example of correct code

const {run} = require('madrun');

module.exports = {
    'lint': 'putout lib test',
    'fix:lint': run('lint', '--fix'),
};

add-run

❌ Example of incorrect code

module.exports = {
    lint: 'putout lib test',
};

βœ… Example of correct code

const {run} = require('madrun');

module.exports = {
    lint: 'putout lib test',
};

add-cut-env

❌ Example of incorrect code

export default {
    'test': () => [env, 'test:only'],
    'test:only': () => [env, 'npm test'],
};

βœ… Example of correct code

import {cutEnv} from 'madrun';

export default {
    'test': async () => [testEnv, await cutEnv('test:only')],
    'test:only': () => [env, 'npm test'],
};

convert-run-argument

❌ Example of incorrect code

module.exports = {
    hello: () => run(['a']),
};

βœ… Example of correct code

module.exports = {
    hello: () => run('a'),
};

convert-args-to-scripts

Check out in 🐊Putout Editor.

❌ Example of incorrect code

export default {
    build: () => 'tsup',
    wisdom: () => run('build', 'test', 'test:dts'),
};

βœ… Example of correct code

export default {
    build: () => 'tsup',
    wisdom: () => run(['build', 'test', 'test:dts']),
};

convert-run-to-cut-env

❌ Example of incorrect code

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await run('test')],
    'coverage:only': async () => [env, await run('test:only')],
};

βœ… Example of correct code

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await cutEnv('test')],
    'coverage:only': async () => [env, await run('test:only')],
};

convert-cut-env-to-run

❌ Example of incorrect code

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await cutEnv('test')],
    'coverage:only': async () => [env, await cutEnv('test:only')],
};

βœ… Example of correct code

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
    'coverage': async () => [env, await cutEnv('test')],
    'coverage:only': async () => [env, await run('test:only')],
};

rename-eslint-to-putout

❌ Example of incorrect code

module.exports = {
    lint: 'eslint lib test --ignore test/fixture',
};

βœ… Example of correct code

module.exports = {
    lint: 'putout lib test',
};

set-lint-dot

❌ Example of incorrect code

module.exports = {
    lint: 'putout lib test',
};

βœ… Example of correct code

module.exports = {
    lint: 'putout .',
};

convert-to-async

❌ Example of incorrect code

module.exports = {
    lint: () => String(run('hello')),
};

βœ… Example of correct code

module.exports = {
    lint: async () => String(await run('hello')),
};

convert-nyc-to-c8

❌ Example of incorrect code

export default {
    coverage: () => 'nyc npm test',
    report: () => `nyc report --reporter=text-lcov | coveralls`,
};

βœ… Example of correct code

export default {
    coverage: () => 'c8 npm test',
    report: 'c8 report --reporter=lcov',
};

set-report-lcov

❌ Example of incorrect code

export default {
    report: () => `c8 report --reporter=text-lcov | coveralls || true`,
};

βœ… Example of correct code

export default {
    report: 'c8 report --reporter=lcov',
};

remove-check-duplicates-from-test

❌ Example of incorrect code

export default {
    test: () => 'tape -d *.js',
};

βœ… Example of correct code

export default {
    test: () => 'tape *.js',
};

remove-useless-array-in-run

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

export default {
    time: async () => await run(['lint:fresh', '-f time']),
};

βœ… Example of correct code

export default {
    time: async () => await run('lint:fresh', '-f time'),
};

remove-useless-string-conversion

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

export default {
    time: async () => [testEnv, String(await cutEnv('test:raw'))],
};

βœ… Example of correct code

export default {
    time: async () => [testEnv, await cutEnv('test:raw')],
};

declare

❌ Example of incorrect code

export default {
    coverage: async () => [env, `c8 ${await cutEnv('test')}`],
};

βœ… Example of correct code

import {cutEnv} from 'madrun';

export default {
    coverage: async () => [env, `c8 ${await cutEnv('test')}`],
};

License

MIT

18.0.0

5 months ago

17.3.0

6 months ago

17.1.0

7 months ago

16.1.1

9 months ago

16.1.0

9 months ago

17.2.0

7 months ago

17.4.0

6 months ago

17.0.0

7 months ago

16.0.0

9 months ago

15.1.0

11 months ago

15.0.0

1 year ago

14.3.0

2 years ago

14.4.0

2 years ago

14.1.0

2 years ago

14.2.0

2 years ago

12.0.0

2 years ago

14.0.0

2 years ago

13.0.0

2 years ago

11.1.0

2 years ago

11.0.0

2 years ago

10.3.0

3 years ago

10.2.0

3 years ago

10.1.0

3 years ago

10.0.0

3 years ago

9.5.0

3 years ago

9.4.1

3 years ago

9.4.0

3 years ago

9.3.0

3 years ago

9.2.0

3 years ago

9.1.0

3 years ago

9.0.0

3 years ago

8.2.0

3 years ago

8.1.0

3 years ago

8.0.0

3 years ago

7.5.0

3 years ago

7.3.0

3 years ago

7.2.0

4 years ago

7.1.0

4 years ago

7.0.0

4 years ago

6.1.2

4 years ago

6.1.0

4 years ago

6.1.1

4 years ago

6.0.0

4 years ago

5.0.2

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.0.0

4 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.15.1

5 years ago

1.15.0

5 years ago

1.14.0

5 years ago

1.13.0

5 years ago

1.12.2

5 years ago

1.12.1

5 years ago

1.12.0

5 years ago

1.11.1

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago