madrun 8.9.1 → 8.10.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 +8 -0
- package/bin/init.mjs +5 -4
- package/bin/madrun.mjs +11 -12
- package/lib/madrun.js +1 -4
- package/package.json +5 -5
package/ChangeLog
CHANGED
package/bin/init.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {createRequire} from 'module';
|
|
1
2
|
import {join} from 'path';
|
|
2
3
|
import {
|
|
3
4
|
writeFile,
|
|
@@ -6,13 +7,13 @@ import {
|
|
|
6
7
|
|
|
7
8
|
import tryToCatch from 'try-to-catch';
|
|
8
9
|
import montag from 'montag';
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
10
12
|
|
|
11
13
|
const {stringify} = JSON;
|
|
12
14
|
const {keys} = Object;
|
|
13
15
|
|
|
14
|
-
const
|
|
15
|
-
const supported = await simport('../supported.json');
|
|
16
|
+
const supported = require('../supported.json');
|
|
16
17
|
|
|
17
18
|
export const createMadrun = async (cwd, info) => {
|
|
18
19
|
let name = await findMadrun(cwd);
|
|
@@ -40,7 +41,7 @@ export const createMadrun = async (cwd, info) => {
|
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
export const patchPackage = async (name, info) => {
|
|
43
|
-
const {default: content} = await
|
|
44
|
+
const {default: content} = await import(name);
|
|
44
45
|
|
|
45
46
|
const updatedScripts = updatePackage(content);
|
|
46
47
|
const prepared = preparePackage(info, updatedScripts);
|
package/bin/madrun.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import {createRequire} from 'module';
|
|
3
4
|
import {
|
|
4
5
|
dirname,
|
|
5
6
|
basename,
|
|
@@ -8,12 +9,10 @@ import {
|
|
|
8
9
|
import findUp from 'find-up';
|
|
9
10
|
import tryToCatch from 'try-to-catch';
|
|
10
11
|
import yargsParser from 'yargs-parser';
|
|
11
|
-
import {createSimport} from 'simport';
|
|
12
12
|
|
|
13
13
|
import {series} from '../lib/madrun.js';
|
|
14
14
|
import check from '../lib/check.js';
|
|
15
|
-
|
|
16
|
-
const simport = createSimport(import.meta.url);
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
17
16
|
|
|
18
17
|
const {exit} = process;
|
|
19
18
|
const {
|
|
@@ -47,13 +46,13 @@ const {
|
|
|
47
46
|
} = args;
|
|
48
47
|
|
|
49
48
|
if (help) {
|
|
50
|
-
const {help} =
|
|
49
|
+
const {help} = require('../lib/help.js');
|
|
51
50
|
console.log(help());
|
|
52
51
|
process.exit();
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
if (version) {
|
|
56
|
-
const {version} =
|
|
55
|
+
const {version} = require('../package.json');
|
|
57
56
|
console.log(`v${version}`);
|
|
58
57
|
process.exit();
|
|
59
58
|
}
|
|
@@ -62,11 +61,11 @@ if (init) {
|
|
|
62
61
|
const {
|
|
63
62
|
createMadrun,
|
|
64
63
|
patchPackage,
|
|
65
|
-
} = await
|
|
64
|
+
} = await import('./init.mjs');
|
|
66
65
|
|
|
67
66
|
fix = true;
|
|
68
67
|
|
|
69
|
-
const [errorPackage, info] = await tryToCatch(
|
|
68
|
+
const [errorPackage, info] = await tryToCatch(require, `${cwd}/package.json`);
|
|
70
69
|
|
|
71
70
|
if (errorPackage)
|
|
72
71
|
console.error(errorPackage);
|
|
@@ -130,8 +129,8 @@ function getOutput({cmd, cwd}) {
|
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
async function execute(cmd) {
|
|
133
|
-
const {execSync} = await
|
|
134
|
-
const tryCatch = await
|
|
132
|
+
const {execSync} = await import('child_process');
|
|
133
|
+
const tryCatch = (await import('try-catch')).default;
|
|
135
134
|
|
|
136
135
|
const [error] = tryCatch(execSync, cmd, {
|
|
137
136
|
stdio: [0, 1, 2],
|
|
@@ -152,7 +151,7 @@ function getOptions(args) {
|
|
|
152
151
|
}
|
|
153
152
|
|
|
154
153
|
async function getScript() {
|
|
155
|
-
const supported =
|
|
154
|
+
const supported = require('../supported.json');
|
|
156
155
|
const path = findUp.sync(supported);
|
|
157
156
|
|
|
158
157
|
if (!path) {
|
|
@@ -160,7 +159,7 @@ async function getScript() {
|
|
|
160
159
|
process.exit(1);
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
const esm = await
|
|
162
|
+
const esm = await import(path);
|
|
164
163
|
|
|
165
164
|
return [
|
|
166
165
|
dirname(path),
|
|
@@ -170,7 +169,7 @@ async function getScript() {
|
|
|
170
169
|
|
|
171
170
|
async function putoutMadrun(dir, {fix}) {
|
|
172
171
|
const name = `${dir}/.madrun.js`;
|
|
173
|
-
const {runPutout} = await
|
|
172
|
+
const {runPutout} = await import('../lib/fix.mjs');
|
|
174
173
|
const {
|
|
175
174
|
readFile,
|
|
176
175
|
writeFile,
|
package/lib/madrun.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const keys = require('all-object-keys');
|
|
4
4
|
const jessy = require('jessy');
|
|
5
5
|
const findUp = require('find-up');
|
|
6
|
-
const {createSimport} = require('simport');
|
|
7
6
|
|
|
8
7
|
const wildcard = require('./wildcard');
|
|
9
8
|
const check = require('./check');
|
|
@@ -12,15 +11,13 @@ const supported = require('../supported');
|
|
|
12
11
|
const isStr = (a) => typeof a === 'string';
|
|
13
12
|
const {isArray} = Array;
|
|
14
13
|
|
|
15
|
-
const simport = createSimport(__filename);
|
|
16
|
-
|
|
17
14
|
async function getScripts() {
|
|
18
15
|
const path = findUp.sync(supported);
|
|
19
16
|
|
|
20
17
|
if (!path)
|
|
21
18
|
throw Error('.madrun.js is missing!');
|
|
22
19
|
|
|
23
|
-
return await
|
|
20
|
+
return (await import(path)).default;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
module.exports.cutEnv = async (names, opts = '', env, scripts) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "madrun",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.10.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",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"node": ">=14"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@putout/formatter-dump": "^
|
|
57
|
+
"@putout/formatter-dump": "^3.0.2",
|
|
58
58
|
"@putout/plugin-madrun": "^11.0.0",
|
|
59
59
|
"all-object-keys": "^2.0.0",
|
|
60
60
|
"find-up": "^5.0.0",
|
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
"montag": "^1.0.0",
|
|
64
64
|
"once": "^1.4.0",
|
|
65
65
|
"putout": "^24.0.0",
|
|
66
|
-
"simport": "^1.0.3",
|
|
67
66
|
"try-catch": "^3.0.0",
|
|
68
67
|
"try-to-catch": "^3.0.0",
|
|
69
68
|
"yargs-parser": "^21.0.0"
|
|
70
69
|
},
|
|
71
70
|
"devDependencies": {
|
|
72
71
|
"@cloudcmd/stub": "^3.1.0",
|
|
73
|
-
"@putout/formatter-json": "^
|
|
72
|
+
"@putout/formatter-json": "^2.0.0",
|
|
74
73
|
"c8": "^7.3.5",
|
|
75
|
-
"
|
|
74
|
+
"escover": "^1.1.6",
|
|
75
|
+
"eslint": "^8.0.0",
|
|
76
76
|
"eslint-plugin-node": "^11.0.0",
|
|
77
77
|
"eslint-plugin-putout": "^13.0.0",
|
|
78
78
|
"mock-import": "^2.1.1",
|