rman 0.9.1 → 0.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/cjs/commands/ci-command.js +1 -1
- package/cjs/commands/multi-task-command.js +3 -2
- package/cjs/commands/publish-command.js +1 -1
- package/cjs/commands/run-command.js +16 -7
- package/cjs/debug.js +1 -1
- package/cjs/utils/exec.js +5 -9
- package/esm/commands/ci-command.mjs +1 -1
- package/esm/commands/multi-task-command.mjs +3 -2
- package/esm/commands/publish-command.mjs +1 -1
- package/esm/commands/run-command.mjs +16 -7
- package/esm/debug.mjs +1 -1
- package/esm/utils/exec.d.ts +0 -1
- package/esm/utils/exec.mjs +5 -9
- package/package.json +22 -22
|
@@ -51,7 +51,7 @@ class CleanInstallCommand extends run_command_1.RunCommand {
|
|
|
51
51
|
}
|
|
52
52
|
async _fsDelete(fileOrDir) {
|
|
53
53
|
if (await (0, file_utils_1.fsExists)(fileOrDir)) {
|
|
54
|
-
npmlog_1.default.info(this.commandName, chalk_1.default.yellow('clean'), 'Deleting ' + fileOrDir);
|
|
54
|
+
npmlog_1.default.info(this.commandName, chalk_1.default.yellow('clean'), 'Deleting ' + path_1.default.relative(this.repository.dirname, fileOrDir));
|
|
55
55
|
await (0, file_utils_1.fsDelete)(fileOrDir);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -7,6 +7,7 @@ exports.MultiTaskCommand = void 0;
|
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const npmlog_1 = __importDefault(require("npmlog"));
|
|
9
9
|
const power_tasks_1 = require("power-tasks");
|
|
10
|
+
const putil_varhelpers_1 = require("putil-varhelpers");
|
|
10
11
|
const command_1 = require("../core/command");
|
|
11
12
|
const constants_1 = require("../utils/constants");
|
|
12
13
|
class MultiTaskCommand extends command_1.Command {
|
|
@@ -16,8 +17,7 @@ class MultiTaskCommand extends command_1.Command {
|
|
|
16
17
|
if (this.options.ci || !constants_1.isTTY)
|
|
17
18
|
this.options.progress = false;
|
|
18
19
|
// noinspection SuspiciousTypeOfGuard
|
|
19
|
-
this.options.concurrency =
|
|
20
|
-
parseInt(options.concurrency, 10) : undefined;
|
|
20
|
+
this.options.concurrency = (0, putil_varhelpers_1.toNumber)(options?.concurrency);
|
|
21
21
|
if (this.options.bail == null)
|
|
22
22
|
this.options.bail = true;
|
|
23
23
|
}
|
|
@@ -30,6 +30,7 @@ class MultiTaskCommand extends command_1.Command {
|
|
|
30
30
|
}
|
|
31
31
|
// this.enableProgress();
|
|
32
32
|
this._task = new power_tasks_1.Task(childTasks, {
|
|
33
|
+
name: '$project-root',
|
|
33
34
|
concurrency: this.options.concurrency || os_1.default.cpus().length,
|
|
34
35
|
bail: this.options.bail,
|
|
35
36
|
});
|
|
@@ -20,7 +20,7 @@ class PublishCommand extends run_command_1.RunCommand {
|
|
|
20
20
|
const selectedPackages = [];
|
|
21
21
|
for (const p of packages) {
|
|
22
22
|
const logPkgName = chalk_1.default.yellow(p.name);
|
|
23
|
-
npmlog_1.default.
|
|
23
|
+
npmlog_1.default.info(this.commandName, logPkgName, npmlog_1.default.separator, `Fetching package information from repository`);
|
|
24
24
|
const r = await (0, package_json_1.default)(p.json.name);
|
|
25
25
|
if (r.version === p.version) {
|
|
26
26
|
npmlog_1.default.info(this.commandName, logPkgName, npmlog_1.default.separator, `Ignored. Same version (${p.version}) in repository`);
|
|
@@ -32,16 +32,16 @@ class RunCommand extends multi_task_command_1.MultiTaskCommand {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const rootTask = this._prepareScriptTask({
|
|
36
36
|
name: 'root',
|
|
37
37
|
cwd: this.repository.dirname,
|
|
38
38
|
json: this.repository.json
|
|
39
39
|
});
|
|
40
|
-
if (!
|
|
40
|
+
if (!rootTask?.children)
|
|
41
41
|
return packageTasks;
|
|
42
42
|
const tasks = [];
|
|
43
|
-
const pre =
|
|
44
|
-
const post =
|
|
43
|
+
const pre = rootTask.children.filter((t => t.name?.endsWith(':pre' + this.script)));
|
|
44
|
+
const post = rootTask.children.filter((t => t.name?.endsWith(':post' + this.script)));
|
|
45
45
|
pre.forEach(t => t.options.exclusive = true);
|
|
46
46
|
post.forEach(t => t.options.exclusive = true);
|
|
47
47
|
tasks.push(...pre);
|
|
@@ -74,7 +74,7 @@ class RunCommand extends multi_task_command_1.MultiTaskCommand {
|
|
|
74
74
|
}, ctx);
|
|
75
75
|
}, {
|
|
76
76
|
name: args.name + ':' + s.name,
|
|
77
|
-
dependencies: s.name.startsWith('pre') || s.name.startsWith('post') ?
|
|
77
|
+
dependencies: (this.options.parallel || s.name.startsWith('pre') || s.name.startsWith('post')) ?
|
|
78
78
|
undefined : args.dependencies
|
|
79
79
|
});
|
|
80
80
|
children.push(task);
|
|
@@ -96,8 +96,7 @@ class RunCommand extends multi_task_command_1.MultiTaskCommand {
|
|
|
96
96
|
const r = await (0, exec_1.exec)(args.command, { cwd: args.cwd, stdio: args.stdio });
|
|
97
97
|
if (logLevel)
|
|
98
98
|
if (r.error) {
|
|
99
|
-
npmlog_1.default.error(this.commandName, chalk_1.default.cyan(args.name), chalk_1.default.red.bold('failed'), npmlog_1.default.separator, args.command, npmlog_1.default.separator, r.error.message.trim());
|
|
100
|
-
npmlog_1.default.verbose(this.commandName, '', r.stderr || r.stdout);
|
|
99
|
+
npmlog_1.default.error(this.commandName, chalk_1.default.cyan(args.name), chalk_1.default.red.bold('failed'), npmlog_1.default.separator, args.command, npmlog_1.default.separator, r.error.message.trim() + ('\n' + r.stdout).trim());
|
|
101
100
|
}
|
|
102
101
|
else
|
|
103
102
|
npmlog_1.default.log(logLevel, this.commandName, chalk_1.default.cyan(args.name), chalk_1.default.green.bold('executed'), npmlog_1.default.separator, args.command, chalk_1.default.yellow(' (' + (Date.now() - t) + ' ms)'));
|
|
@@ -126,6 +125,16 @@ RunCommand.commandName = 'run';
|
|
|
126
125
|
.option(RunCommand.cliCommandOptions);
|
|
127
126
|
},
|
|
128
127
|
handler: async (args) => {
|
|
128
|
+
const runCfg = repository.config?.command?.run;
|
|
129
|
+
if (args.script && runCfg && typeof runCfg === 'object') {
|
|
130
|
+
['parallel', 'bail', 'progress'].forEach(n => {
|
|
131
|
+
if (typeof runCfg[n] === 'string') {
|
|
132
|
+
if (runCfg[n].split(/\s*,\s*/).includes(args.script)) {
|
|
133
|
+
args[n] = true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
129
138
|
const options = command_1.Command.composeOptions(RunCommand.commandName, args, repository.config);
|
|
130
139
|
const script = '' + args.script;
|
|
131
140
|
await new RunCommand(repository, script, options).execute();
|
package/cjs/debug.js
CHANGED
package/cjs/utils/exec.js
CHANGED
|
@@ -28,21 +28,17 @@ async function exec(command, options) {
|
|
|
28
28
|
};
|
|
29
29
|
const result = {
|
|
30
30
|
code: undefined,
|
|
31
|
-
stderr: '',
|
|
32
31
|
stdout: ''
|
|
33
32
|
};
|
|
34
|
-
|
|
35
|
-
stdout: '',
|
|
36
|
-
stderr: ''
|
|
37
|
-
};
|
|
33
|
+
let buffer = '';
|
|
38
34
|
const processData = (data, stdio) => {
|
|
39
|
-
buffer
|
|
40
|
-
result
|
|
35
|
+
buffer += '' + data;
|
|
36
|
+
result.stdout += '' + data;
|
|
41
37
|
if (opts.onData)
|
|
42
38
|
opts.onData(data, stdio);
|
|
43
39
|
};
|
|
44
40
|
const processLines = (stdio, flush) => {
|
|
45
|
-
let chunk = buffer
|
|
41
|
+
let chunk = buffer;
|
|
46
42
|
let i;
|
|
47
43
|
if (flush && !chunk.endsWith('\n'))
|
|
48
44
|
chunk += '\n';
|
|
@@ -52,7 +48,7 @@ async function exec(command, options) {
|
|
|
52
48
|
if (opts.onLine)
|
|
53
49
|
opts.onLine(line, stdio);
|
|
54
50
|
}
|
|
55
|
-
buffer
|
|
51
|
+
buffer = chunk;
|
|
56
52
|
};
|
|
57
53
|
const child = (0, child_process_1.spawn)(command, opts.argv || [], spawnOptions);
|
|
58
54
|
if (child.pid) {
|
|
@@ -45,7 +45,7 @@ export class CleanInstallCommand extends RunCommand {
|
|
|
45
45
|
}
|
|
46
46
|
async _fsDelete(fileOrDir) {
|
|
47
47
|
if (await fsExists(fileOrDir)) {
|
|
48
|
-
logger.info(this.commandName, chalk.yellow('clean'), 'Deleting ' + fileOrDir);
|
|
48
|
+
logger.info(this.commandName, chalk.yellow('clean'), 'Deleting ' + path.relative(this.repository.dirname, fileOrDir));
|
|
49
49
|
await fsDelete(fileOrDir);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import logger from 'npmlog';
|
|
3
3
|
import { Task } from 'power-tasks';
|
|
4
|
+
import { toNumber } from 'putil-varhelpers';
|
|
4
5
|
import { Command } from './../core/command.mjs';
|
|
5
6
|
import { isTTY } from './../utils/constants.mjs';
|
|
6
7
|
export class MultiTaskCommand extends Command {
|
|
@@ -10,8 +11,7 @@ export class MultiTaskCommand extends Command {
|
|
|
10
11
|
if (this.options.ci || !isTTY)
|
|
11
12
|
this.options.progress = false;
|
|
12
13
|
// noinspection SuspiciousTypeOfGuard
|
|
13
|
-
this.options.concurrency =
|
|
14
|
-
parseInt(options.concurrency, 10) : undefined;
|
|
14
|
+
this.options.concurrency = toNumber(options?.concurrency);
|
|
15
15
|
if (this.options.bail == null)
|
|
16
16
|
this.options.bail = true;
|
|
17
17
|
}
|
|
@@ -24,6 +24,7 @@ export class MultiTaskCommand extends Command {
|
|
|
24
24
|
}
|
|
25
25
|
// this.enableProgress();
|
|
26
26
|
this._task = new Task(childTasks, {
|
|
27
|
+
name: '$project-root',
|
|
27
28
|
concurrency: this.options.concurrency || os.cpus().length,
|
|
28
29
|
bail: this.options.bail,
|
|
29
30
|
});
|
|
@@ -14,7 +14,7 @@ export class PublishCommand extends RunCommand {
|
|
|
14
14
|
const selectedPackages = [];
|
|
15
15
|
for (const p of packages) {
|
|
16
16
|
const logPkgName = chalk.yellow(p.name);
|
|
17
|
-
logger.
|
|
17
|
+
logger.info(this.commandName, logPkgName, logger.separator, `Fetching package information from repository`);
|
|
18
18
|
const r = await fetchPackageInfo(p.json.name);
|
|
19
19
|
if (r.version === p.version) {
|
|
20
20
|
logger.info(this.commandName, logPkgName, logger.separator, `Ignored. Same version (${p.version}) in repository`);
|
|
@@ -26,16 +26,16 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const rootTask = this._prepareScriptTask({
|
|
30
30
|
name: 'root',
|
|
31
31
|
cwd: this.repository.dirname,
|
|
32
32
|
json: this.repository.json
|
|
33
33
|
});
|
|
34
|
-
if (!
|
|
34
|
+
if (!rootTask?.children)
|
|
35
35
|
return packageTasks;
|
|
36
36
|
const tasks = [];
|
|
37
|
-
const pre =
|
|
38
|
-
const post =
|
|
37
|
+
const pre = rootTask.children.filter((t => t.name?.endsWith(':pre' + this.script)));
|
|
38
|
+
const post = rootTask.children.filter((t => t.name?.endsWith(':post' + this.script)));
|
|
39
39
|
pre.forEach(t => t.options.exclusive = true);
|
|
40
40
|
post.forEach(t => t.options.exclusive = true);
|
|
41
41
|
tasks.push(...pre);
|
|
@@ -68,7 +68,7 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
68
68
|
}, ctx);
|
|
69
69
|
}, {
|
|
70
70
|
name: args.name + ':' + s.name,
|
|
71
|
-
dependencies: s.name.startsWith('pre') || s.name.startsWith('post') ?
|
|
71
|
+
dependencies: (this.options.parallel || s.name.startsWith('pre') || s.name.startsWith('post')) ?
|
|
72
72
|
undefined : args.dependencies
|
|
73
73
|
});
|
|
74
74
|
children.push(task);
|
|
@@ -90,8 +90,7 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
90
90
|
const r = await exec(args.command, { cwd: args.cwd, stdio: args.stdio });
|
|
91
91
|
if (logLevel)
|
|
92
92
|
if (r.error) {
|
|
93
|
-
logger.error(this.commandName, chalk.cyan(args.name), chalk.red.bold('failed'), logger.separator, args.command, logger.separator, r.error.message.trim());
|
|
94
|
-
logger.verbose(this.commandName, '', r.stderr || r.stdout);
|
|
93
|
+
logger.error(this.commandName, chalk.cyan(args.name), chalk.red.bold('failed'), logger.separator, args.command, logger.separator, r.error.message.trim() + ('\n' + r.stdout).trim());
|
|
95
94
|
}
|
|
96
95
|
else
|
|
97
96
|
logger.log(logLevel, this.commandName, chalk.cyan(args.name), chalk.green.bold('executed'), logger.separator, args.command, chalk.yellow(' (' + (Date.now() - t) + ' ms)'));
|
|
@@ -119,6 +118,16 @@ RunCommand.commandName = 'run';
|
|
|
119
118
|
.option(RunCommand.cliCommandOptions);
|
|
120
119
|
},
|
|
121
120
|
handler: async (args) => {
|
|
121
|
+
const runCfg = repository.config?.command?.run;
|
|
122
|
+
if (args.script && runCfg && typeof runCfg === 'object') {
|
|
123
|
+
['parallel', 'bail', 'progress'].forEach(n => {
|
|
124
|
+
if (typeof runCfg[n] === 'string') {
|
|
125
|
+
if (runCfg[n].split(/\s*,\s*/).includes(args.script)) {
|
|
126
|
+
args[n] = true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
122
131
|
const options = Command.composeOptions(RunCommand.commandName, args, repository.config);
|
|
123
132
|
const script = '' + args.script;
|
|
124
133
|
await new RunCommand(repository, script, options).execute();
|
package/esm/debug.mjs
CHANGED
package/esm/utils/exec.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export interface IExecutorOptions {
|
|
|
14
14
|
export interface ExecuteCommandResult {
|
|
15
15
|
code?: number;
|
|
16
16
|
error?: Error;
|
|
17
|
-
stderr?: string;
|
|
18
17
|
stdout?: string;
|
|
19
18
|
}
|
|
20
19
|
export declare function exec(command: string, options?: IExecutorOptions): Promise<ExecuteCommandResult>;
|
package/esm/utils/exec.mjs
CHANGED
|
@@ -22,21 +22,17 @@ export async function exec(command, options) {
|
|
|
22
22
|
};
|
|
23
23
|
const result = {
|
|
24
24
|
code: undefined,
|
|
25
|
-
stderr: '',
|
|
26
25
|
stdout: ''
|
|
27
26
|
};
|
|
28
|
-
|
|
29
|
-
stdout: '',
|
|
30
|
-
stderr: ''
|
|
31
|
-
};
|
|
27
|
+
let buffer = '';
|
|
32
28
|
const processData = (data, stdio) => {
|
|
33
|
-
buffer
|
|
34
|
-
result
|
|
29
|
+
buffer += '' + data;
|
|
30
|
+
result.stdout += '' + data;
|
|
35
31
|
if (opts.onData)
|
|
36
32
|
opts.onData(data, stdio);
|
|
37
33
|
};
|
|
38
34
|
const processLines = (stdio, flush) => {
|
|
39
|
-
let chunk = buffer
|
|
35
|
+
let chunk = buffer;
|
|
40
36
|
let i;
|
|
41
37
|
if (flush && !chunk.endsWith('\n'))
|
|
42
38
|
chunk += '\n';
|
|
@@ -46,7 +42,7 @@ export async function exec(command, options) {
|
|
|
46
42
|
if (opts.onLine)
|
|
47
43
|
opts.onLine(line, stdio);
|
|
48
44
|
}
|
|
49
|
-
buffer
|
|
45
|
+
buffer = chunk;
|
|
50
46
|
};
|
|
51
47
|
const child = spawn(command, opts.argv || [], spawnOptions);
|
|
52
48
|
if (child.pid) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rman",
|
|
3
3
|
"description": "Monorepo repository manager",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"contributors": [
|
|
@@ -33,49 +33,49 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@netlify/parse-npm-script": "^0.1.2",
|
|
36
|
-
"chalk": "^5.0.
|
|
36
|
+
"chalk": "^5.0.1",
|
|
37
37
|
"easy-table": "^1.2.0",
|
|
38
38
|
"envinfo": "^7.8.1",
|
|
39
|
-
"fast-glob": "^3.2.
|
|
39
|
+
"fast-glob": "^3.2.11",
|
|
40
40
|
"figures": "^4.0.0",
|
|
41
41
|
"is-ci": "^3.0.1",
|
|
42
42
|
"js-yaml": "^4.1.0",
|
|
43
|
-
"npmlog": "^6.0.
|
|
43
|
+
"npmlog": "^6.0.1",
|
|
44
44
|
"package-json": "^7.0.0",
|
|
45
45
|
"path-key": "^4.0.0",
|
|
46
|
-
"power-tasks": "^0.
|
|
47
|
-
"putil-merge": "^3.
|
|
46
|
+
"power-tasks": "^0.6.0",
|
|
47
|
+
"putil-merge": "^3.8.0",
|
|
48
48
|
"putil-varhelpers": "^1.6.3",
|
|
49
49
|
"semver": "^7.3.5",
|
|
50
|
-
"signal-exit": "^3.0.
|
|
51
|
-
"strict-typed-events": "^2.
|
|
50
|
+
"signal-exit": "^3.0.7",
|
|
51
|
+
"strict-typed-events": "^2.1.0",
|
|
52
52
|
"strip-color": "^0.1.0",
|
|
53
|
-
"yargs": "^17.
|
|
53
|
+
"yargs": "^17.4.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/eslint-parser": "^7.
|
|
56
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
57
57
|
"@types/envinfo": "^7.8.1",
|
|
58
58
|
"@types/is-ci": "^3.0.0",
|
|
59
|
-
"@types/jest": "^27.4.
|
|
59
|
+
"@types/jest": "^27.4.1",
|
|
60
60
|
"@types/js-yaml": "^4.0.5",
|
|
61
|
-
"@types/node": "^17.0.
|
|
61
|
+
"@types/node": "^17.0.22",
|
|
62
62
|
"@types/npmlog": "^4.1.4",
|
|
63
63
|
"@types/semver": "^7.3.9",
|
|
64
64
|
"@types/signal-exit": "^3.0.1",
|
|
65
65
|
"@types/strip-color": "^0.1.0",
|
|
66
|
-
"@types/yargs": "^17.0.
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
68
|
-
"@typescript-eslint/parser": "^5.
|
|
69
|
-
"eslint": "^8.
|
|
66
|
+
"@types/yargs": "^17.0.10",
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "^5.16.0",
|
|
68
|
+
"@typescript-eslint/parser": "^5.16.0",
|
|
69
|
+
"eslint": "^8.11.0",
|
|
70
70
|
"eslint-config-google": "^0.14.0",
|
|
71
71
|
"jest": "^27.5.1",
|
|
72
|
-
"ts-cleanup": "^0.2.
|
|
73
|
-
"ts-gems": "^1.
|
|
72
|
+
"ts-cleanup": "^0.2.4",
|
|
73
|
+
"ts-gems": "^1.5.2",
|
|
74
74
|
"ts-jest": "^27.1.3",
|
|
75
|
-
"ts-loader": "^9.
|
|
76
|
-
"ts-node": "^10.
|
|
77
|
-
"tsconfig-paths": "^3.
|
|
78
|
-
"typescript": "^4.
|
|
75
|
+
"ts-loader": "^9.2.8",
|
|
76
|
+
"ts-node": "^10.7.0",
|
|
77
|
+
"tsconfig-paths": "^3.14.0",
|
|
78
|
+
"typescript": "^4.6.2",
|
|
79
79
|
"typescript-esm": "^2.0.0"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|