madrun 9.1.0 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +16 -0
- package/README.md +2 -0
- package/bin/init.mjs +1 -3
- package/bin/madrun-completion.js +0 -1
- package/bin/madrun.mjs +12 -18
- package/lib/check.js +0 -1
- package/lib/choose.mjs +1 -0
- package/lib/fix.mjs +3 -9
- package/lib/help.js +0 -1
- package/lib/madrun.js +13 -12
- package/lib/validate.js +0 -1
- package/lib/wildcard.js +2 -3
- package/package.json +6 -8
- package/supported.json +1 -5
package/ChangeLog
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
2023.07.06, v9.3.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- c72b896 package: eslint-plugin-putout v18.0.0
|
|
5
|
+
- 4d8d729 package: putout v30.0.2
|
|
6
|
+
- 8fc78af package: escover v3.4.0
|
|
7
|
+
- c607a04 package: c8 v8.0.0
|
|
8
|
+
- b14cab2 package: eslint-plugin-n v16.0.1
|
|
9
|
+
|
|
10
|
+
2023.05.01, v9.2.0
|
|
11
|
+
|
|
12
|
+
feature:
|
|
13
|
+
- a702e01 madrun: use built-in madrun
|
|
14
|
+
- 77560c6 package: eslint-plugin-putout v17.5.1
|
|
15
|
+
- 928768c package: @putout/plugin-madrun v15.0.0
|
|
16
|
+
|
|
1
17
|
2023.03.07, v9.1.0
|
|
2
18
|
|
|
3
19
|
feature:
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# 🏎 Madrun [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
[NPMURL]: https://npmjs.org/package/madrun "npm"
|
|
4
6
|
[NPMIMGURL]: https://img.shields.io/npm/v/madrun.svg?style=flat
|
|
5
7
|
[BuildStatusURL]: https://github.com/coderaiser/madrun/actions?query=workflow%3A%22Node+CI%22 "Build Status"
|
package/bin/init.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
writeFile,
|
|
5
5
|
access,
|
|
6
6
|
} from 'fs/promises';
|
|
7
|
-
|
|
8
7
|
import tryToCatch from 'try-to-catch';
|
|
9
8
|
import montag from 'montag';
|
|
10
9
|
|
|
@@ -21,7 +20,7 @@ export const createMadrun = async (cwd, info) => {
|
|
|
21
20
|
if (!name) {
|
|
22
21
|
const {scripts = {}} = info;
|
|
23
22
|
|
|
24
|
-
const madrun = montag
|
|
23
|
+
const madrun = montag`
|
|
25
24
|
'use strict';
|
|
26
25
|
|
|
27
26
|
const {
|
|
@@ -82,4 +81,3 @@ async function findMadrun(cwd) {
|
|
|
82
81
|
|
|
83
82
|
return '';
|
|
84
83
|
}
|
|
85
|
-
|
package/bin/madrun-completion.js
CHANGED
package/bin/madrun.mjs
CHANGED
|
@@ -5,11 +5,9 @@ import {
|
|
|
5
5
|
dirname,
|
|
6
6
|
basename,
|
|
7
7
|
} from 'path';
|
|
8
|
-
|
|
9
8
|
import findUp from 'find-up';
|
|
10
9
|
import tryToCatch from 'try-to-catch';
|
|
11
10
|
import yargsParser from 'yargs-parser';
|
|
12
|
-
|
|
13
11
|
import {series} from '../lib/madrun.js';
|
|
14
12
|
import check from '../lib/check.js';
|
|
15
13
|
import {choose} from '../lib/choose.mjs';
|
|
@@ -17,10 +15,9 @@ import {choose} from '../lib/choose.mjs';
|
|
|
17
15
|
const require = createRequire(import.meta.url);
|
|
18
16
|
|
|
19
17
|
const {exit} = process;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} = process.env;
|
|
18
|
+
|
|
19
|
+
const {MADRUN_PWD, MADRUN_NAME} = process.env;
|
|
20
|
+
|
|
24
21
|
const cwd = process.cwd();
|
|
25
22
|
|
|
26
23
|
const args = yargsParser(process.argv.slice(2), {
|
|
@@ -60,10 +57,7 @@ if (version) {
|
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
if (init) {
|
|
63
|
-
const {
|
|
64
|
-
createMadrun,
|
|
65
|
-
patchPackage,
|
|
66
|
-
} = await import('./init.mjs');
|
|
60
|
+
const {createMadrun, patchPackage} = await import('./init.mjs');
|
|
67
61
|
|
|
68
62
|
fix = true;
|
|
69
63
|
|
|
@@ -86,7 +80,9 @@ const [dir, scripts] = await getScript();
|
|
|
86
80
|
const problems = check(scripts);
|
|
87
81
|
|
|
88
82
|
if (problems) {
|
|
89
|
-
const result = await putoutMadrun(dir, {
|
|
83
|
+
const result = await putoutMadrun(dir, {
|
|
84
|
+
fix,
|
|
85
|
+
});
|
|
90
86
|
|
|
91
87
|
if (fix) {
|
|
92
88
|
exit();
|
|
@@ -119,7 +115,10 @@ if (e) {
|
|
|
119
115
|
exit(1);
|
|
120
116
|
}
|
|
121
117
|
|
|
122
|
-
console.log(getOutput({
|
|
118
|
+
console.log(getOutput({
|
|
119
|
+
cmd,
|
|
120
|
+
cwd,
|
|
121
|
+
}));
|
|
123
122
|
await execute(cmd);
|
|
124
123
|
|
|
125
124
|
function getOutput({cmd, cwd}) {
|
|
@@ -176,11 +175,7 @@ async function getScript() {
|
|
|
176
175
|
async function putoutMadrun(dir, {fix}) {
|
|
177
176
|
const name = `${dir}/.madrun.js`;
|
|
178
177
|
const {runPutout} = await import('../lib/fix.mjs');
|
|
179
|
-
const {
|
|
180
|
-
readFile,
|
|
181
|
-
writeFile,
|
|
182
|
-
} = await import('fs/promises');
|
|
183
|
-
|
|
178
|
+
const {readFile, writeFile} = await import('fs/promises');
|
|
184
179
|
const data = await readFile(name, 'utf8');
|
|
185
180
|
const {places, code} = await runPutout(data);
|
|
186
181
|
|
|
@@ -189,4 +184,3 @@ async function putoutMadrun(dir, {fix}) {
|
|
|
189
184
|
|
|
190
185
|
return places;
|
|
191
186
|
}
|
|
192
|
-
|
package/lib/check.js
CHANGED
package/lib/choose.mjs
CHANGED
package/lib/fix.mjs
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import putout, {
|
|
2
|
-
initReport,
|
|
3
|
-
} from 'putout';
|
|
4
|
-
|
|
1
|
+
import putout, {initReport} from 'putout';
|
|
5
2
|
import dumpFormatter from '@putout/formatter-dump';
|
|
6
|
-
import madrun from '@putout/plugin-madrun';
|
|
7
3
|
|
|
8
4
|
const report = initReport();
|
|
9
5
|
|
|
10
6
|
export const runPutout = async (data, options) => {
|
|
11
7
|
const {code, places} = putout(data, {
|
|
8
|
+
printer: 'putout',
|
|
12
9
|
...options,
|
|
13
|
-
plugins: [
|
|
14
|
-
madrun,
|
|
15
|
-
}],
|
|
10
|
+
plugins: ['madrun'],
|
|
16
11
|
});
|
|
17
12
|
|
|
18
13
|
return {
|
|
@@ -23,4 +18,3 @@ export const runPutout = async (data, options) => {
|
|
|
23
18
|
}),
|
|
24
19
|
};
|
|
25
20
|
};
|
|
26
|
-
|
package/lib/help.js
CHANGED
package/lib/madrun.js
CHANGED
|
@@ -8,7 +8,7 @@ const findUp = require('find-up');
|
|
|
8
8
|
const wildcard = require('./wildcard');
|
|
9
9
|
const check = require('./check');
|
|
10
10
|
const supported = require('../supported');
|
|
11
|
-
|
|
11
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
12
12
|
const isStr = (a) => typeof a === 'string';
|
|
13
13
|
const {isArray} = Array;
|
|
14
14
|
|
|
@@ -22,12 +22,11 @@ async function getScripts() {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
module.exports.cutEnv = async (names, opts = '', env, scripts) => {
|
|
25
|
-
|
|
26
|
-
names = [names];
|
|
27
|
-
|
|
25
|
+
names = maybeArray(names);
|
|
28
26
|
scripts = scripts || await getScripts();
|
|
29
27
|
|
|
30
28
|
const isParallel = false;
|
|
29
|
+
|
|
31
30
|
const commands = await run(names, opts, scripts, {
|
|
32
31
|
env,
|
|
33
32
|
cutEnv: true,
|
|
@@ -53,12 +52,11 @@ module.exports.run = async (name, opts = '', env, scripts) => {
|
|
|
53
52
|
module.exports.series = series;
|
|
54
53
|
|
|
55
54
|
async function series(names, opts = '', env, scripts) {
|
|
56
|
-
|
|
57
|
-
names = [names];
|
|
58
|
-
|
|
55
|
+
names = maybeArray(names);
|
|
59
56
|
scripts = scripts || await getScripts();
|
|
60
57
|
|
|
61
58
|
const isParallel = false;
|
|
59
|
+
|
|
62
60
|
const commands = await run(names, opts, scripts, {
|
|
63
61
|
env,
|
|
64
62
|
isParallel,
|
|
@@ -71,12 +69,14 @@ async function series(names, opts = '', env, scripts) {
|
|
|
71
69
|
|
|
72
70
|
module.exports.parallel = async (names, opts = '', env, scripts) => {
|
|
73
71
|
scripts = scripts || await getScripts();
|
|
74
|
-
|
|
75
|
-
if (isStr(names))
|
|
76
|
-
names = [names];
|
|
72
|
+
names = maybeArray(names);
|
|
77
73
|
|
|
78
74
|
const isParallel = true;
|
|
79
|
-
|
|
75
|
+
|
|
76
|
+
const commands = await run(names, opts, scripts, {
|
|
77
|
+
env,
|
|
78
|
+
isParallel,
|
|
79
|
+
});
|
|
80
80
|
|
|
81
81
|
return joinByType(commands, {
|
|
82
82
|
isParallel,
|
|
@@ -141,7 +141,9 @@ const parse = async (name, {scripts, opts, env, isParallel, cutEnv}) => {
|
|
|
141
141
|
const fn = jessy(key, scripts);
|
|
142
142
|
|
|
143
143
|
const {line, lineEnv} = await runScriptFn(fn);
|
|
144
|
+
|
|
144
145
|
const cmd = addOpts(line, opts);
|
|
146
|
+
|
|
145
147
|
const cmdEnv = addEnv(cmd, {
|
|
146
148
|
...cutEnv ? {} : lineEnv,
|
|
147
149
|
...env,
|
|
@@ -195,4 +197,3 @@ async function addPrePost(cmd, key, scripts) {
|
|
|
195
197
|
|
|
196
198
|
return cmd;
|
|
197
199
|
}
|
|
198
|
-
|
package/lib/validate.js
CHANGED
package/lib/wildcard.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
module.exports = (str) => {
|
|
4
|
-
const wildcard =
|
|
4
|
+
const wildcard = `^${str
|
|
5
5
|
.replace('.', '\\.')
|
|
6
6
|
.replace('*', '.*')
|
|
7
|
-
.replace('?', '.?')
|
|
7
|
+
.replace('?', '.?')}$`;
|
|
8
8
|
|
|
9
9
|
return RegExp(wildcard);
|
|
10
10
|
};
|
|
11
|
-
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "madrun",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "CLI tool to run multiple npm-scripts in a madly comfortable way",
|
|
5
5
|
"main": "lib/madrun.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
|
-
"commitType": "colon",
|
|
8
7
|
"scripts": {
|
|
9
8
|
"lint": "madrun lint",
|
|
10
9
|
"fresh:lint": "madrun fresh:lint",
|
|
@@ -56,7 +55,6 @@
|
|
|
56
55
|
},
|
|
57
56
|
"dependencies": {
|
|
58
57
|
"@putout/formatter-dump": "^4.0.0",
|
|
59
|
-
"@putout/plugin-madrun": "^14.0.0",
|
|
60
58
|
"all-object-keys": "^2.0.0",
|
|
61
59
|
"enquirer": "^2.3.6",
|
|
62
60
|
"find-up": "^5.0.0",
|
|
@@ -64,18 +62,18 @@
|
|
|
64
62
|
"mapsome": "^1.0.0",
|
|
65
63
|
"montag": "^1.0.0",
|
|
66
64
|
"once": "^1.4.0",
|
|
67
|
-
"putout": "^
|
|
65
|
+
"putout": "^30.0.2",
|
|
68
66
|
"try-catch": "^3.0.0",
|
|
69
67
|
"try-to-catch": "^3.0.0",
|
|
70
68
|
"yargs-parser": "^21.0.0"
|
|
71
69
|
},
|
|
72
70
|
"devDependencies": {
|
|
73
71
|
"@putout/formatter-json": "^2.0.0",
|
|
74
|
-
"c8": "^
|
|
75
|
-
"escover": "^
|
|
72
|
+
"c8": "^8.0.0",
|
|
73
|
+
"escover": "^3.4.0",
|
|
76
74
|
"eslint": "^8.0.0",
|
|
77
|
-
"eslint-plugin-n": "^
|
|
78
|
-
"eslint-plugin-putout": "^
|
|
75
|
+
"eslint-plugin-n": "^16.0.1",
|
|
76
|
+
"eslint-plugin-putout": "^18.0.0",
|
|
79
77
|
"mock-import": "^3.0.0",
|
|
80
78
|
"mock-require": "^3.0.3",
|
|
81
79
|
"nodemon": "^2.0.0",
|
package/supported.json
CHANGED