@putout/plugin-madrun 
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"
}
}
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',
};
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