rman 0.28.1 → 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 +3 -8
- package/cjs/commands/changed-command.js +6 -9
- package/cjs/commands/ci-command.js +8 -14
- package/cjs/commands/execute-command.js +23 -27
- package/cjs/commands/info-command.js +15 -21
- package/cjs/commands/list-command.js +32 -35
- package/cjs/commands/multi-task-command.js +13 -15
- package/cjs/commands/publish-command.js +24 -26
- package/cjs/commands/run-command.js +34 -34
- package/cjs/commands/version-command.js +35 -37
- package/cjs/core/command.js +19 -24
- 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 +3 -8
- package/esm/commands/changed-command.js +6 -9
- package/esm/commands/ci-command.js +4 -8
- package/esm/commands/execute-command.js +20 -22
- package/esm/commands/info-command.js +11 -15
- package/esm/commands/list-command.js +27 -28
- package/esm/commands/multi-task-command.js +11 -11
- package/esm/commands/publish-command.js +20 -20
- package/esm/commands/run-command.js +31 -29
- package/esm/commands/version-command.js +29 -29
- 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 +6 -54
- 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;
|
|
@@ -16,16 +16,11 @@ BuildCommand.commandName = 'build';
|
|
|
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;
|
|
@@ -21,17 +21,14 @@ ChangedCommand.commandName = 'changed';
|
|
|
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;
|
|
@@ -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;
|
|
@@ -57,21 +55,17 @@ exports.CleanInstallCommand = CleanInstallCommand;
|
|
|
57
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;
|
|
@@ -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,14 +24,14 @@ 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
|
}
|
|
@@ -44,34 +42,32 @@ exports.ExecuteCommand = ExecuteCommand;
|
|
|
44
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;
|
|
@@ -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
|
}
|
|
@@ -50,16 +49,11 @@ InfoCommand.commandName = 'info';
|
|
|
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;
|
|
@@ -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('');
|
|
@@ -101,41 +101,38 @@ exports.ListCommand = ListCommand;
|
|
|
101
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;
|
|
@@ -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
68
|
})(MultiTaskCommand || (exports.MultiTaskCommand = MultiTaskCommand = {}));
|
|
@@ -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.PublishCommand = 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 command_js_1 = require("../core/command.js");
|
|
11
9
|
const npm_utils_js_1 = require("../utils/npm-utils.js");
|
|
12
10
|
const run_command_js_1 = require("./run-command.js");
|
|
@@ -15,7 +13,7 @@ class PublishCommand extends run_command_js_1.RunCommand {
|
|
|
15
13
|
super(repository, 'publish', {
|
|
16
14
|
...options,
|
|
17
15
|
bail: false,
|
|
18
|
-
parallel: true
|
|
16
|
+
parallel: true,
|
|
19
17
|
});
|
|
20
18
|
this.repository = repository;
|
|
21
19
|
}
|
|
@@ -31,16 +29,17 @@ class PublishCommand extends run_command_js_1.RunCommand {
|
|
|
31
29
|
}
|
|
32
30
|
npmlog_1.default.info(this.commandName, logPkgName, npmlog_1.default.separator, `Fetching package information from repository`);
|
|
33
31
|
const npmHelper = new npm_utils_js_1.NpmHelper({ cwd: p.dirname });
|
|
34
|
-
promises.push(npmHelper
|
|
32
|
+
promises.push(npmHelper
|
|
33
|
+
.getPackageInfo(p.json.name)
|
|
35
34
|
.then(r => {
|
|
36
35
|
const sameVersion = !!(r && r.version === p.version);
|
|
37
36
|
if (this.options.checkOnly) {
|
|
38
37
|
npmlog_1.default.info(this.commandName, logPkgName, npmlog_1.default.separator, !r.version
|
|
39
38
|
? chalk_1.default.yellow('No package information found in repository')
|
|
40
|
-
:
|
|
39
|
+
: sameVersion
|
|
41
40
|
? `No publish needed. Version (${chalk_1.default.magenta(p.version)}) same in repository`
|
|
42
|
-
:
|
|
43
|
-
` Version "${chalk_1.default.magenta(p.version)}" differs from version in repository (${chalk_1.default.magenta(r.version)})`)
|
|
41
|
+
: `Publishing is possible.` +
|
|
42
|
+
` Version "${chalk_1.default.magenta(p.version)}" differs from version in repository (${chalk_1.default.magenta(r.version)})`);
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
45
|
if (r && r.version === p.version) {
|
|
@@ -51,7 +50,8 @@ class PublishCommand extends run_command_js_1.RunCommand {
|
|
|
51
50
|
` Version "${chalk_1.default.magenta(p.version)}" differs from version in repository (${chalk_1.default.magenta(r.version)})`);
|
|
52
51
|
selectedPackages.push(p);
|
|
53
52
|
}
|
|
54
|
-
})
|
|
53
|
+
})
|
|
54
|
+
.catch(e => {
|
|
55
55
|
if (e.name !== 'PackageNotFoundError')
|
|
56
56
|
throw e;
|
|
57
57
|
}));
|
|
@@ -80,36 +80,34 @@ PublishCommand.commandName = 'publish';
|
|
|
80
80
|
(function (PublishCommand) {
|
|
81
81
|
PublishCommand.cliCommandOptions = {
|
|
82
82
|
...run_command_js_1.RunCommand.cliCommandOptions,
|
|
83
|
-
|
|
83
|
+
contents: {
|
|
84
84
|
describe: '# Subdirectory to publish',
|
|
85
|
-
type: 'string'
|
|
85
|
+
type: 'string',
|
|
86
86
|
},
|
|
87
|
-
|
|
87
|
+
access: {
|
|
88
88
|
describe: '# Tells the registry whether this package should be published as public or restricted. ' +
|
|
89
|
-
|
|
89
|
+
"Only applies to scoped packages, which default to restricted. If you don't have a paid account, " +
|
|
90
90
|
'you must publish with --access public to publish scoped packages.',
|
|
91
91
|
type: 'string',
|
|
92
|
-
choices: ['public', 'restricted']
|
|
92
|
+
choices: ['public', 'restricted'],
|
|
93
93
|
},
|
|
94
94
|
'check-only': {
|
|
95
95
|
describe: '# Only performs version checking and do not apply "publish" to the registry.',
|
|
96
|
-
type: 'boolean'
|
|
97
|
-
}
|
|
96
|
+
type: 'boolean',
|
|
97
|
+
},
|
|
98
98
|
};
|
|
99
99
|
function initCli(repository, program) {
|
|
100
100
|
program.command({
|
|
101
101
|
command: 'publish [...options]',
|
|
102
102
|
describe: 'Publish packages in the current project',
|
|
103
|
-
builder:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
.option(PublishCommand.cliCommandOptions);
|
|
108
|
-
},
|
|
103
|
+
builder: cmd => cmd
|
|
104
|
+
.example('$0 publish', '')
|
|
105
|
+
.example('$0 publish --contents dist', '# publish package from built directory')
|
|
106
|
+
.option(PublishCommand.cliCommandOptions),
|
|
109
107
|
handler: async (args) => {
|
|
110
108
|
const options = command_js_1.Command.composeOptions(PublishCommand.commandName, args, repository.config);
|
|
111
109
|
await new PublishCommand(repository, options).execute();
|
|
112
|
-
}
|
|
110
|
+
},
|
|
113
111
|
});
|
|
114
112
|
}
|
|
115
113
|
PublishCommand.initCli = initCli;
|