rman 0.28.0 → 0.29.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/bin/rman.mjs +1 -1
- package/cjs/cli.js +18 -18
- package/cjs/commands/build-command.js +5 -11
- package/cjs/commands/changed-command.js +8 -12
- package/cjs/commands/ci-command.js +10 -17
- package/cjs/commands/execute-command.js +25 -30
- package/cjs/commands/info-command.js +17 -24
- package/cjs/commands/list-command.js +34 -38
- package/cjs/commands/multi-task-command.js +14 -16
- package/cjs/commands/publish-command.js +26 -29
- package/cjs/commands/run-command.js +36 -37
- package/cjs/commands/version-command.js +37 -40
- package/cjs/core/command.js +20 -25
- package/cjs/core/logger.js +2 -4
- package/cjs/core/package.js +3 -5
- package/cjs/core/repository.js +9 -11
- package/cjs/index.js +2 -15
- package/cjs/utils/exec.js +7 -8
- package/cjs/utils/file-utils.js +10 -10
- package/cjs/utils/get-dirname.js +6 -9
- package/cjs/utils/git-utils.js +10 -10
- package/cjs/utils/npm-run-path.js +6 -9
- package/cjs/utils/npm-utils.js +3 -2
- package/esm/cli.js +12 -9
- package/esm/commands/build-command.js +4 -10
- package/esm/commands/changed-command.js +7 -11
- package/esm/commands/ci-command.js +5 -10
- package/esm/commands/execute-command.js +21 -24
- package/esm/commands/info-command.js +12 -17
- package/esm/commands/list-command.js +28 -30
- package/esm/commands/multi-task-command.js +11 -11
- package/esm/commands/publish-command.js +21 -22
- package/esm/commands/run-command.js +32 -31
- package/esm/commands/version-command.js +30 -31
- package/esm/core/command.js +13 -16
- package/esm/core/repository.js +3 -3
- package/esm/utils/exec.js +6 -6
- package/esm/utils/file-utils.js +4 -1
- package/esm/utils/get-dirname.js +1 -1
- package/esm/utils/git-utils.js +8 -6
- package/esm/utils/npm-utils.js +3 -2
- package/package.json +14 -62
- package/esm/cli.d.ts +0 -4
- package/esm/commands/build-command.d.ts +0 -11
- package/esm/commands/changed-command.d.ts +0 -16
- package/esm/commands/ci-command.d.ts +0 -24
- package/esm/commands/execute-command.d.ts +0 -19
- package/esm/commands/info-command.d.ts +0 -10
- package/esm/commands/list-command.d.ts +0 -38
- package/esm/commands/multi-task-command.d.ts +0 -22
- package/esm/commands/publish-command.d.ts +0 -22
- package/esm/commands/run-command.d.ts +0 -28
- package/esm/commands/version-command.d.ts +0 -25
- package/esm/core/command.d.ts +0 -35
- package/esm/core/constants.d.ts +0 -1
- package/esm/core/logger.d.ts +0 -12
- package/esm/core/package.d.ts +0 -13
- package/esm/core/repository.d.ts +0 -19
- package/esm/index.d.ts +0 -1
- package/esm/utils/exec.d.ts +0 -19
- package/esm/utils/file-utils.d.ts +0 -5
- package/esm/utils/get-dirname.d.ts +0 -2
- package/esm/utils/git-utils.d.ts +0 -25
- package/esm/utils/npm-run-path.d.ts +0 -67
- package/esm/utils/npm-utils.d.ts +0 -12
package/bin/rman.mjs
CHANGED
package/cjs/cli.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.runCli =
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
3
|
+
exports.runCli = runCli;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
7
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
8
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
12
10
|
const build_command_js_1 = require("./commands/build-command.js");
|
|
13
11
|
const changed_command_js_1 = require("./commands/changed-command.js");
|
|
14
12
|
const ci_command_js_1 = require("./commands/ci-command.js");
|
|
@@ -27,19 +25,23 @@ async function runCli(options) {
|
|
|
27
25
|
const pkgJson = JSON.parse(await promises_1.default.readFile(s, 'utf-8'));
|
|
28
26
|
const repository = repository_js_1.Repository.create(options?.cwd);
|
|
29
27
|
const _argv = options?.argv || process.argv.slice(2);
|
|
30
|
-
const globalKeys = Object.keys(command_js_1.Command.globalOptions).concat([
|
|
28
|
+
const globalKeys = Object.keys(command_js_1.Command.globalOptions).concat(['help', 'version']);
|
|
31
29
|
const program = (0, yargs_1.default)(_argv)
|
|
32
30
|
// .scriptName('rman')
|
|
33
31
|
.strict()
|
|
34
|
-
.version(pkgJson.version || '')
|
|
32
|
+
.version(pkgJson.version || '')
|
|
33
|
+
.alias('version', 'v')
|
|
35
34
|
.usage('$0 <cmd> [options...]')
|
|
36
|
-
.help('help')
|
|
35
|
+
.help('help')
|
|
36
|
+
.alias('help', 'h')
|
|
37
37
|
.showHelpOnFail(false, 'Run with --help for available options')
|
|
38
38
|
.fail((msg, err) => {
|
|
39
39
|
if (!err?.logged) {
|
|
40
|
-
const text =
|
|
40
|
+
const text = msg
|
|
41
41
|
? msg + '\n\n' + chalk_1.default.whiteBright('Run with --help for available options')
|
|
42
|
-
:
|
|
42
|
+
: err
|
|
43
|
+
? err.message
|
|
44
|
+
: '';
|
|
43
45
|
// eslint-disable-next-line no-console
|
|
44
46
|
console.log('\n' + chalk_1.default.red(text));
|
|
45
47
|
throw msg;
|
|
@@ -49,7 +51,7 @@ async function runCli(options) {
|
|
|
49
51
|
})
|
|
50
52
|
// group options under "Global Options:" header
|
|
51
53
|
.options(command_js_1.Command.globalOptions)
|
|
52
|
-
.group(globalKeys,
|
|
54
|
+
.group(globalKeys, 'Global Options:');
|
|
53
55
|
info_command_js_1.InfoCommand.initCli(repository, program);
|
|
54
56
|
list_command_js_1.ListCommand.initCli(repository, program);
|
|
55
57
|
changed_command_js_1.ChangedCommand.initCli(repository, program);
|
|
@@ -62,11 +64,9 @@ async function runCli(options) {
|
|
|
62
64
|
if (!_argv.length)
|
|
63
65
|
program.showHelp();
|
|
64
66
|
else
|
|
65
|
-
await program.parseAsync()
|
|
66
|
-
.catch(() => process.exit(1));
|
|
67
|
+
await program.parseAsync().catch(() => process.exit(1));
|
|
67
68
|
}
|
|
68
69
|
catch (e) {
|
|
69
70
|
npmlog_1.default.error('rman', e);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
exports.runCli = runCli;
|
|
@@ -9,25 +9,19 @@ class BuildCommand extends run_command_js_1.RunCommand {
|
|
|
9
9
|
this.repository = repository;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
BuildCommand.commandName = 'build';
|
|
13
12
|
exports.BuildCommand = BuildCommand;
|
|
13
|
+
BuildCommand.commandName = 'build';
|
|
14
14
|
(function (BuildCommand) {
|
|
15
15
|
function initCli(repository, program) {
|
|
16
16
|
program.command({
|
|
17
17
|
command: 'build [options...]',
|
|
18
18
|
describe: 'Alias for "run build"',
|
|
19
|
-
builder:
|
|
20
|
-
return cmd
|
|
21
|
-
.example("$0 build", "# Builds packages")
|
|
22
|
-
.option(BuildCommand.cliCommandOptions);
|
|
23
|
-
},
|
|
19
|
+
builder: cmd => cmd.example('$0 build', '# Builds packages').option(BuildCommand.cliCommandOptions),
|
|
24
20
|
handler: async (args) => {
|
|
25
21
|
const options = command_js_1.Command.composeOptions(BuildCommand.commandName, args, repository.config);
|
|
26
|
-
await new BuildCommand(repository, options)
|
|
27
|
-
|
|
28
|
-
}
|
|
22
|
+
await new BuildCommand(repository, options).execute();
|
|
23
|
+
},
|
|
29
24
|
});
|
|
30
25
|
}
|
|
31
26
|
BuildCommand.initCli = initCli;
|
|
32
|
-
})(BuildCommand
|
|
33
|
-
exports.BuildCommand = BuildCommand;
|
|
27
|
+
})(BuildCommand || (exports.BuildCommand = BuildCommand = {}));
|
|
@@ -14,26 +14,22 @@ class ChangedCommand extends list_command_js_1.ListCommand {
|
|
|
14
14
|
return !!(inf.isDirty || inf.isCommitted);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
ChangedCommand.commandName = 'changed';
|
|
18
17
|
exports.ChangedCommand = ChangedCommand;
|
|
18
|
+
ChangedCommand.commandName = 'changed';
|
|
19
19
|
(function (ChangedCommand) {
|
|
20
20
|
function initCli(repository, program) {
|
|
21
21
|
program.command({
|
|
22
22
|
command: 'changed [options...]',
|
|
23
23
|
describe: 'List local packages that have changed since the last tagged release',
|
|
24
|
-
builder:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.option(list_command_js_1.ListCommand.cliCommandOptions);
|
|
29
|
-
},
|
|
24
|
+
builder: cmd => cmd
|
|
25
|
+
.example('$0 changed', '# List changed packages')
|
|
26
|
+
.example('$0 changed --json', '# List changed packages in JSON format')
|
|
27
|
+
.option(list_command_js_1.ListCommand.cliCommandOptions),
|
|
30
28
|
handler: async (args) => {
|
|
31
29
|
const options = command_js_1.Command.composeOptions(ChangedCommand.commandName, args, repository.config);
|
|
32
|
-
await new ChangedCommand(repository, options)
|
|
33
|
-
|
|
34
|
-
}
|
|
30
|
+
await new ChangedCommand(repository, options).execute();
|
|
31
|
+
},
|
|
35
32
|
});
|
|
36
33
|
}
|
|
37
34
|
ChangedCommand.initCli = initCli;
|
|
38
|
-
})(ChangedCommand
|
|
39
|
-
exports.ChangedCommand = ChangedCommand;
|
|
35
|
+
})(ChangedCommand || (exports.ChangedCommand = ChangedCommand = {}));
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.CleanInstallCommand = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
7
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
8
|
const power_tasks_1 = require("power-tasks");
|
|
11
9
|
const command_js_1 = require("../core/command.js");
|
|
12
10
|
const file_utils_js_1 = require("../utils/file-utils.js");
|
|
@@ -28,7 +26,7 @@ class CleanInstallCommand extends run_command_js_1.RunCommand {
|
|
|
28
26
|
await this._fsDelete(path_1.default.join(dirname, 'yarn-lock.json'));
|
|
29
27
|
npmlog_1.default.info(this.commandName, chalk_1.default.yellow('install'), 'Running ' + client + ' install');
|
|
30
28
|
return super._exec(this.repository.rootPackage, client + ' install', {
|
|
31
|
-
stdio: 'inherit'
|
|
29
|
+
stdio: 'inherit',
|
|
32
30
|
});
|
|
33
31
|
}, { exclusive: true }));
|
|
34
32
|
return tasks;
|
|
@@ -53,27 +51,22 @@ class CleanInstallCommand extends run_command_js_1.RunCommand {
|
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
CleanInstallCommand.commandName = 'ci';
|
|
57
54
|
exports.CleanInstallCommand = CleanInstallCommand;
|
|
55
|
+
CleanInstallCommand.commandName = 'ci';
|
|
58
56
|
(function (CleanInstallCommand) {
|
|
59
57
|
CleanInstallCommand.cliCommandOptions = {
|
|
60
|
-
...run_command_js_1.RunCommand.cliCommandOptions
|
|
58
|
+
...run_command_js_1.RunCommand.cliCommandOptions,
|
|
61
59
|
};
|
|
62
60
|
function initCli(repository, program) {
|
|
63
61
|
program.command({
|
|
64
62
|
command: 'ci [...options]',
|
|
65
63
|
describe: 'Deletes all dependency modules and re-installs',
|
|
66
|
-
builder:
|
|
67
|
-
return cmd
|
|
68
|
-
.example("$0 ci", '')
|
|
69
|
-
.option(CleanInstallCommand.cliCommandOptions);
|
|
70
|
-
},
|
|
64
|
+
builder: cmd => cmd.example('$0 ci', '').option(CleanInstallCommand.cliCommandOptions),
|
|
71
65
|
handler: async (args) => {
|
|
72
66
|
const options = command_js_1.Command.composeOptions(CleanInstallCommand.commandName, args, repository.config);
|
|
73
67
|
await new CleanInstallCommand(repository, options).execute();
|
|
74
|
-
}
|
|
68
|
+
},
|
|
75
69
|
});
|
|
76
70
|
}
|
|
77
71
|
CleanInstallCommand.initCli = initCli;
|
|
78
|
-
})(CleanInstallCommand
|
|
79
|
-
exports.CleanInstallCommand = CleanInstallCommand;
|
|
72
|
+
})(CleanInstallCommand || (exports.CleanInstallCommand = CleanInstallCommand = {}));
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ExecuteCommand = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
9
7
|
const power_tasks_1 = require("power-tasks");
|
|
10
8
|
const command_js_1 = require("../core/command.js");
|
|
11
9
|
const exec_js_1 = require("../utils/exec.js");
|
|
@@ -26,54 +24,51 @@ class ExecuteCommand extends multi_task_command_js_1.MultiTaskCommand {
|
|
|
26
24
|
const r = await (0, exec_js_1.exec)(this.cmd, {
|
|
27
25
|
cwd: p.dirname,
|
|
28
26
|
argv: this.argv,
|
|
29
|
-
stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe'
|
|
27
|
+
stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe',
|
|
30
28
|
});
|
|
31
|
-
npmlog_1.default.log(
|
|
29
|
+
npmlog_1.default.log(r.error ? 'error' : 'info', this.commandName, p.name, r.error ? chalk_1.default.red.bold('failed') : chalk_1.default.green.bold('success'), npmlog_1.default.separator, this.cmd, chalk_1.default.yellow(' (' + (Date.now() - t) + ' ms') + ')');
|
|
32
30
|
}, {
|
|
33
31
|
name: p.name,
|
|
34
32
|
dependencies: this.options.parallel ? undefined : p.dependencies,
|
|
35
33
|
bail: this.options.bail,
|
|
36
|
-
concurrency: this.options.concurrency
|
|
34
|
+
concurrency: this.options.concurrency,
|
|
37
35
|
});
|
|
38
36
|
tasks.push(task);
|
|
39
37
|
}
|
|
40
38
|
return tasks;
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
|
-
ExecuteCommand.commandName = 'exec';
|
|
44
41
|
exports.ExecuteCommand = ExecuteCommand;
|
|
42
|
+
ExecuteCommand.commandName = 'exec';
|
|
45
43
|
(function (ExecuteCommand) {
|
|
46
44
|
ExecuteCommand.cliCommandOptions = {
|
|
47
|
-
...multi_task_command_js_1.MultiTaskCommand.cliCommandOptions
|
|
45
|
+
...multi_task_command_js_1.MultiTaskCommand.cliCommandOptions,
|
|
48
46
|
};
|
|
49
47
|
function initCli(repository, program) {
|
|
50
48
|
program.command({
|
|
51
49
|
command: 'exec [cmd] [args..]',
|
|
52
50
|
describe: 'Execute an arbitrary command in each package',
|
|
53
|
-
builder:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.option(ExecuteCommand.cliCommandOptions);
|
|
69
|
-
},
|
|
51
|
+
builder: cmd => cmd
|
|
52
|
+
.example('$0 exec -- ls', '')
|
|
53
|
+
.example('$0 exec -- rm -rf ./node_modules', '')
|
|
54
|
+
.parserConfiguration({
|
|
55
|
+
'populate--': true,
|
|
56
|
+
})
|
|
57
|
+
.positional('cmd', {
|
|
58
|
+
describe: 'The command to execute. Any command flags must be passed after --',
|
|
59
|
+
type: 'string',
|
|
60
|
+
})
|
|
61
|
+
.positional('args', {
|
|
62
|
+
describe: 'Positional arguments to send to command',
|
|
63
|
+
type: 'string',
|
|
64
|
+
})
|
|
65
|
+
.option(ExecuteCommand.cliCommandOptions),
|
|
70
66
|
handler: async (args) => {
|
|
71
67
|
const argv = args['--'] || [];
|
|
72
68
|
const options = command_js_1.Command.composeOptions(ExecuteCommand.commandName, args, repository.config);
|
|
73
69
|
await new ExecuteCommand(repository, '' + argv.shift(), argv, options).execute();
|
|
74
|
-
}
|
|
70
|
+
},
|
|
75
71
|
});
|
|
76
72
|
}
|
|
77
73
|
ExecuteCommand.initCli = initCli;
|
|
78
|
-
})(ExecuteCommand
|
|
79
|
-
exports.ExecuteCommand = ExecuteCommand;
|
|
74
|
+
})(ExecuteCommand || (exports.ExecuteCommand = ExecuteCommand = {}));
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.InfoCommand = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const envinfo_1 = tslib_1.__importDefault(require("envinfo"));
|
|
7
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
10
8
|
const command_js_1 = require("../core/command.js");
|
|
11
9
|
class InfoCommand extends command_js_1.Command {
|
|
12
10
|
async _execute() {
|
|
@@ -15,27 +13,28 @@ class InfoCommand extends command_js_1.Command {
|
|
|
15
13
|
Binaries: ['Node', 'Yarn', 'npm'],
|
|
16
14
|
Utilities: ['Git'],
|
|
17
15
|
npmPackages: ['rman', 'typescript'],
|
|
18
|
-
npmGlobalPackages: ['typescript']
|
|
16
|
+
npmGlobalPackages: ['typescript'],
|
|
19
17
|
}, { json: true }));
|
|
20
18
|
if (this.options.json) {
|
|
21
19
|
this.logger.output('', '%j', systemInfo);
|
|
22
20
|
return;
|
|
23
21
|
}
|
|
24
|
-
const maxName = Object.keys(systemInfo).reduce((l, p) => Object.keys(systemInfo[p]).reduce((i, x) => l = Math.max(i, x.length), l), 0);
|
|
22
|
+
const maxName = Object.keys(systemInfo).reduce((l, p) => Object.keys(systemInfo[p]).reduce((i, x) => (l = Math.max(i, x.length)), l), 0);
|
|
25
23
|
for (const [categoryName, category] of Object.entries(systemInfo)) {
|
|
26
24
|
this.logger.output('', '', chalk_1.default.whiteBright(categoryName) + ':');
|
|
27
25
|
for (const [n, v] of Object.entries(category)) {
|
|
28
|
-
const label = ' ' + chalk_1.default.reset(n) +
|
|
29
|
-
' '.repeat(maxName - n.length) + ' :';
|
|
26
|
+
const label = ' ' + chalk_1.default.reset(n) + ' '.repeat(maxName - n.length) + ' :';
|
|
30
27
|
if (typeof v === 'string') {
|
|
31
28
|
this.logger.output('', label, chalk_1.default.yellowBright(v));
|
|
32
29
|
continue;
|
|
33
30
|
}
|
|
34
|
-
if (v.version)
|
|
35
|
-
this.logger.output('', label, chalk_1.default.yellowBright(v.version),
|
|
31
|
+
if (v.version) {
|
|
32
|
+
this.logger.output('', label, chalk_1.default.yellowBright(v.version), v.path ? ' ' + chalk_1.default.yellow(v.path) : '');
|
|
33
|
+
}
|
|
36
34
|
if (v.installed) {
|
|
37
|
-
if (v.wanted === 'latest' || semver_1.default.intersects(v.installed, v.wanted))
|
|
35
|
+
if (v.wanted === 'latest' || semver_1.default.intersects(v.installed, v.wanted)) {
|
|
38
36
|
this.logger.output('', label, chalk_1.default.yellowBright(v.installed));
|
|
37
|
+
}
|
|
39
38
|
else
|
|
40
39
|
this.logger.output('', label, chalk_1.default.red(v.installed), ' => ', chalk_1.default.yellowBright(v.wanted));
|
|
41
40
|
}
|
|
@@ -43,25 +42,19 @@ class InfoCommand extends command_js_1.Command {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
|
-
InfoCommand.commandName = 'info';
|
|
47
45
|
exports.InfoCommand = InfoCommand;
|
|
46
|
+
InfoCommand.commandName = 'info';
|
|
48
47
|
(function (InfoCommand) {
|
|
49
48
|
function initCli(repository, program) {
|
|
50
49
|
program.command({
|
|
51
50
|
command: 'info [options...]',
|
|
52
51
|
describe: 'Prints local environment information',
|
|
53
|
-
builder:
|
|
54
|
-
return cmd
|
|
55
|
-
.example("$0 info", "# Prints information")
|
|
56
|
-
.example('$0 info --json', '# Prints information in JSON format');
|
|
57
|
-
},
|
|
52
|
+
builder: cmd => cmd.example('$0 info', '# Prints information').example('$0 info --json', '# Prints information in JSON format'),
|
|
58
53
|
handler: async (args) => {
|
|
59
54
|
const options = command_js_1.Command.composeOptions(InfoCommand.commandName, args, repository.config);
|
|
60
|
-
await new InfoCommand(options)
|
|
61
|
-
|
|
62
|
-
}
|
|
55
|
+
await new InfoCommand(options).execute();
|
|
56
|
+
},
|
|
63
57
|
});
|
|
64
58
|
}
|
|
65
59
|
InfoCommand.initCli = initCli;
|
|
66
|
-
})(InfoCommand
|
|
67
|
-
exports.InfoCommand = InfoCommand;
|
|
60
|
+
})(InfoCommand || (exports.InfoCommand = InfoCommand = {}));
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ListCommand = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const easy_table_1 = tslib_1.__importDefault(require("easy-table"));
|
|
7
|
+
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
8
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
11
9
|
const command_js_1 = require("../core/command.js");
|
|
12
10
|
const git_utils_js_1 = require("../utils/git-utils.js");
|
|
13
11
|
class ListCommand extends command_js_1.Command {
|
|
@@ -46,7 +44,7 @@ class ListCommand extends command_js_1.Command {
|
|
|
46
44
|
location,
|
|
47
45
|
private: p.isPrivate,
|
|
48
46
|
isDirty,
|
|
49
|
-
isCommitted
|
|
47
|
+
isCommitted,
|
|
50
48
|
};
|
|
51
49
|
o = this.onPrepare ? this.onPrepare(p, o) : o;
|
|
52
50
|
if (!o)
|
|
@@ -55,9 +53,12 @@ class ListCommand extends command_js_1.Command {
|
|
|
55
53
|
count++;
|
|
56
54
|
if (!this.options.json) {
|
|
57
55
|
if (this.options.parseable) {
|
|
58
|
-
const a = [
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
const a = [
|
|
57
|
+
location,
|
|
58
|
+
p.name,
|
|
59
|
+
p.version,
|
|
60
|
+
p.isPrivate ? 'PRIVATE' : '',
|
|
61
|
+
isDirty ? 'DIRTY' : isCommitted ? ':COMMITTED' : '',
|
|
61
62
|
];
|
|
62
63
|
npmlog_1.default.output('', a.join('::'));
|
|
63
64
|
}
|
|
@@ -71,8 +72,7 @@ class ListCommand extends command_js_1.Command {
|
|
|
71
72
|
table.cell('Package', chalk_1.default.yellowBright(p.name));
|
|
72
73
|
table.cell('Version', chalk_1.default.yellow(p.version));
|
|
73
74
|
table.cell('Private', p.isPrivate ? chalk_1.default.magentaBright('yes') : '');
|
|
74
|
-
table.cell('Changed', isDirty ? chalk_1.default.magenta('dirty') :
|
|
75
|
-
(isCommitted ? chalk_1.default.yellow('committed') : ''));
|
|
75
|
+
table.cell('Changed', isDirty ? chalk_1.default.magenta('dirty') : isCommitted ? chalk_1.default.yellow('committed') : '');
|
|
76
76
|
table.cell('Path', path_1.default.relative(repository.dirname, p.dirname));
|
|
77
77
|
table.newRow();
|
|
78
78
|
}
|
|
@@ -83,11 +83,11 @@ class ListCommand extends command_js_1.Command {
|
|
|
83
83
|
npmlog_1.default.output('', '%j', obj);
|
|
84
84
|
return obj;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
if (this.options.json) {
|
|
87
87
|
npmlog_1.default.output('', '%j', arr);
|
|
88
88
|
return arr;
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
if (table.rows.length) {
|
|
91
91
|
npmlog_1.default.output('', '%s', table.toString().trim());
|
|
92
92
|
// eslint-disable-next-line no-console
|
|
93
93
|
console.log('');
|
|
@@ -97,47 +97,43 @@ class ListCommand extends command_js_1.Command {
|
|
|
97
97
|
return arr;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
ListCommand.commandName = 'list';
|
|
101
100
|
exports.ListCommand = ListCommand;
|
|
101
|
+
ListCommand.commandName = 'list';
|
|
102
102
|
(function (ListCommand) {
|
|
103
103
|
ListCommand.cliCommandOptions = {
|
|
104
|
-
|
|
104
|
+
short: {
|
|
105
105
|
alias: 's',
|
|
106
|
-
describe: '# Do not show extended information'
|
|
106
|
+
describe: '# Do not show extended information',
|
|
107
107
|
},
|
|
108
|
-
|
|
108
|
+
parseable: {
|
|
109
109
|
alias: 'p',
|
|
110
|
-
describe: '# Show parseable output'
|
|
110
|
+
describe: '# Show parseable output',
|
|
111
111
|
},
|
|
112
|
-
|
|
112
|
+
toposort: {
|
|
113
113
|
alias: 't',
|
|
114
|
-
describe: '# Sort packages in topological order (dependencies before dependents) instead of lexical by directory'
|
|
114
|
+
describe: '# Sort packages in topological order (dependencies before dependents) instead of lexical by directory',
|
|
115
115
|
},
|
|
116
|
-
|
|
116
|
+
graph: {
|
|
117
117
|
alias: 'g',
|
|
118
|
-
describe: '# Show dependency graph as a JSON-formatted adjacency list'
|
|
119
|
-
}
|
|
118
|
+
describe: '# Show dependency graph as a JSON-formatted adjacency list',
|
|
119
|
+
},
|
|
120
120
|
};
|
|
121
121
|
function initCli(repository, program) {
|
|
122
122
|
program.command({
|
|
123
123
|
command: 'list [options...]',
|
|
124
124
|
describe: 'Lists packages in repository',
|
|
125
125
|
aliases: ['ls'],
|
|
126
|
-
builder:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.option(ListCommand.cliCommandOptions);
|
|
133
|
-
},
|
|
126
|
+
builder: cmd => cmd
|
|
127
|
+
.example('$0 list', '# List all packages')
|
|
128
|
+
.example('$0 list --json', '# List all packages in JSON format')
|
|
129
|
+
.conflicts('graph', ['parseable', 'json'])
|
|
130
|
+
.conflicts('short', ['parseable', 'json'])
|
|
131
|
+
.option(ListCommand.cliCommandOptions),
|
|
134
132
|
handler: async (args) => {
|
|
135
133
|
const options = command_js_1.Command.composeOptions(ListCommand.commandName, args, repository.config);
|
|
136
|
-
await new ListCommand(repository, options)
|
|
137
|
-
|
|
138
|
-
}
|
|
134
|
+
await new ListCommand(repository, options).execute();
|
|
135
|
+
},
|
|
139
136
|
});
|
|
140
137
|
}
|
|
141
138
|
ListCommand.initCli = initCli;
|
|
142
|
-
})(ListCommand
|
|
143
|
-
exports.ListCommand = ListCommand;
|
|
139
|
+
})(ListCommand || (exports.ListCommand = ListCommand = {}));
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.MultiTaskCommand = void 0;
|
|
7
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const os_1 = tslib_1.__importDefault(require("os"));
|
|
8
6
|
const power_tasks_1 = require("power-tasks");
|
|
9
7
|
const putil_varhelpers_1 = require("putil-varhelpers");
|
|
10
8
|
const command_js_1 = require("../core/command.js");
|
|
@@ -41,30 +39,30 @@ class MultiTaskCommand extends command_js_1.Command {
|
|
|
41
39
|
exports.MultiTaskCommand = MultiTaskCommand;
|
|
42
40
|
(function (MultiTaskCommand) {
|
|
43
41
|
MultiTaskCommand.cliCommandOptions = {
|
|
44
|
-
|
|
42
|
+
concurrency: {
|
|
45
43
|
describe: '# Set processes count to parallelize tasks. (CPU count if not defined)',
|
|
46
|
-
type: 'number'
|
|
44
|
+
type: 'number',
|
|
47
45
|
},
|
|
48
|
-
|
|
46
|
+
parallel: {
|
|
49
47
|
describe: '# Disregards dependency checking and runs the command for every package at same time.',
|
|
50
|
-
type: 'boolean'
|
|
48
|
+
type: 'boolean',
|
|
51
49
|
},
|
|
52
50
|
'no-bail': {
|
|
53
51
|
describe: '# Continue execution even one fails.',
|
|
54
|
-
type: 'boolean'
|
|
52
|
+
type: 'boolean',
|
|
55
53
|
},
|
|
56
|
-
|
|
54
|
+
bail: {
|
|
57
55
|
hidden: true,
|
|
58
|
-
type: 'boolean'
|
|
56
|
+
type: 'boolean',
|
|
59
57
|
},
|
|
60
58
|
'no-progress': {
|
|
61
|
-
describe:
|
|
59
|
+
describe: 'Disable progress bars',
|
|
62
60
|
type: 'boolean',
|
|
63
61
|
},
|
|
64
|
-
|
|
62
|
+
progress: {
|
|
65
63
|
hidden: true,
|
|
66
64
|
type: 'boolean',
|
|
67
|
-
default: true
|
|
68
|
-
}
|
|
65
|
+
default: true,
|
|
66
|
+
},
|
|
69
67
|
};
|
|
70
|
-
})(MultiTaskCommand
|
|
68
|
+
})(MultiTaskCommand || (exports.MultiTaskCommand = MultiTaskCommand = {}));
|