rman 0.17.0 → 0.19.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.js → rman.mjs} +1 -1
- package/cjs/cli.js +27 -26
- package/cjs/commands/build-command.js +4 -4
- package/cjs/commands/changed-command.js +5 -5
- package/cjs/commands/ci-command.js +9 -9
- package/cjs/commands/execute-command.js +8 -8
- package/cjs/commands/info-command.js +3 -3
- package/cjs/commands/list-command.js +7 -6
- package/cjs/commands/multi-task-command.js +4 -4
- package/cjs/commands/publish-command.js +7 -7
- package/cjs/commands/run-command.js +8 -8
- package/cjs/commands/version-command.js +10 -10
- package/cjs/core/command.js +8 -8
- package/cjs/core/constants.js +2 -2
- package/cjs/core/repository.js +7 -7
- package/cjs/index.js +1 -1
- package/cjs/utils/exec.js +2 -2
- package/cjs/utils/get-dirname.js +1 -3
- package/cjs/utils/git-utils.js +5 -5
- package/cjs/utils/npm-run-path.js +1 -1
- package/cjs/utils/npm-utils.js +2 -2
- package/esm/cli.js +15 -14
- package/esm/commands/build-command.d.ts +2 -2
- package/esm/commands/build-command.js +2 -2
- package/esm/commands/changed-command.d.ts +3 -3
- package/esm/commands/changed-command.js +2 -2
- package/esm/commands/ci-command.d.ts +5 -5
- package/esm/commands/ci-command.js +4 -4
- package/esm/commands/execute-command.d.ts +4 -4
- package/esm/commands/execute-command.js +4 -4
- package/esm/commands/info-command.d.ts +2 -2
- package/esm/commands/info-command.js +1 -1
- package/esm/commands/list-command.d.ts +4 -4
- package/esm/commands/list-command.js +4 -3
- package/esm/commands/multi-task-command.d.ts +4 -4
- package/esm/commands/multi-task-command.js +2 -2
- package/esm/commands/publish-command.d.ts +5 -5
- package/esm/commands/publish-command.js +3 -3
- package/esm/commands/run-command.d.ts +5 -5
- package/esm/commands/run-command.js +4 -4
- package/esm/commands/version-command.d.ts +5 -5
- package/esm/commands/version-command.js +7 -7
- package/esm/core/command.d.ts +1 -1
- package/esm/core/command.js +6 -6
- package/esm/core/constants.d.ts +0 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/repository.d.ts +1 -1
- package/esm/core/repository.js +4 -4
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/utils/exec.js +1 -1
- package/esm/utils/get-dirname.js +1 -3
- package/esm/utils/git-utils.js +1 -1
- package/esm/utils/npm-run-path.js +1 -1
- package/esm/utils/npm-utils.js +1 -1
- package/package.json +5 -5
- package/cjs/core/types.js +0 -2
- package/cjs/debug.js +0 -5
- package/esm/core/types.d.ts +0 -14
- package/esm/core/types.js +0 -1
- package/esm/debug.d.ts +0 -1
- package/esm/debug.js +0 -3
package/bin/{rman.js → rman.mjs}
RENAMED
package/cjs/cli.js
CHANGED
|
@@ -4,30 +4,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.runCli = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
10
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
11
9
|
const npmlog_1 = __importDefault(require("npmlog"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
12
|
+
const build_command_js_1 = require("./commands/build-command.js");
|
|
13
|
+
const changed_command_js_1 = require("./commands/changed-command.js");
|
|
14
|
+
const ci_command_js_1 = require("./commands/ci-command.js");
|
|
15
|
+
const execute_command_js_1 = require("./commands/execute-command.js");
|
|
16
|
+
const info_command_js_1 = require("./commands/info-command.js");
|
|
17
|
+
const list_command_js_1 = require("./commands/list-command.js");
|
|
18
|
+
const publish_command_js_1 = require("./commands/publish-command.js");
|
|
19
|
+
const run_command_js_1 = require("./commands/run-command.js");
|
|
20
|
+
const version_command_js_1 = require("./commands/version-command.js");
|
|
21
|
+
const command_js_1 = require("./core/command.js");
|
|
22
|
+
const repository_js_1 = require("./core/repository.js");
|
|
12
23
|
const get_dirname_js_1 = require("./utils/get-dirname.js");
|
|
13
|
-
const repository_1 = require("./core/repository");
|
|
14
|
-
const info_command_1 = require("./commands/info-command");
|
|
15
|
-
const command_1 = require("./core/command");
|
|
16
|
-
const list_command_1 = require("./commands/list-command");
|
|
17
|
-
const changed_command_1 = require("./commands/changed-command");
|
|
18
|
-
const execute_command_1 = require("./commands/execute-command");
|
|
19
|
-
const run_command_1 = require("./commands/run-command");
|
|
20
|
-
const version_command_1 = require("./commands/version-command");
|
|
21
|
-
const publish_command_1 = require("./commands/publish-command");
|
|
22
|
-
const ci_command_1 = require("./commands/ci-command");
|
|
23
|
-
const build_command_1 = require("./commands/build-command");
|
|
24
24
|
async function runCli(options) {
|
|
25
25
|
try {
|
|
26
26
|
const s = path_1.default.resolve((0, get_dirname_js_1.getDirname)(), '../package.json');
|
|
27
27
|
const pkgJson = JSON.parse(await promises_1.default.readFile(s, 'utf-8'));
|
|
28
|
-
const repository =
|
|
28
|
+
const repository = repository_js_1.Repository.create(options?.cwd);
|
|
29
29
|
const _argv = options?.argv || process.argv.slice(2);
|
|
30
|
-
const globalKeys = Object.keys(
|
|
30
|
+
const globalKeys = Object.keys(command_js_1.Command.globalOptions).concat(["help", "version"]);
|
|
31
31
|
const program = (0, yargs_1.default)(_argv)
|
|
32
32
|
// .scriptName('rman')
|
|
33
33
|
.strict()
|
|
@@ -39,21 +39,22 @@ async function runCli(options) {
|
|
|
39
39
|
const text = (msg
|
|
40
40
|
? msg + '\n\n' + chalk_1.default.whiteBright('Run with --help for available options')
|
|
41
41
|
: (err ? err.message : ''));
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
42
43
|
console.log('\n' + chalk_1.default.red(text));
|
|
43
44
|
throw msg;
|
|
44
45
|
})
|
|
45
46
|
// group options under "Global Options:" header
|
|
46
|
-
.options(
|
|
47
|
+
.options(command_js_1.Command.globalOptions)
|
|
47
48
|
.group(globalKeys, "Global Options:");
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
info_command_js_1.InfoCommand.initCli(repository, program);
|
|
50
|
+
list_command_js_1.ListCommand.initCli(repository, program);
|
|
51
|
+
changed_command_js_1.ChangedCommand.initCli(repository, program);
|
|
52
|
+
execute_command_js_1.ExecuteCommand.initCli(repository, program);
|
|
53
|
+
run_command_js_1.RunCommand.initCli(repository, program);
|
|
54
|
+
version_command_js_1.VersionCommand.initCli(repository, program);
|
|
55
|
+
publish_command_js_1.PublishCommand.initCli(repository, program);
|
|
56
|
+
ci_command_js_1.CleanInstallCommand.initCli(repository, program);
|
|
57
|
+
build_command_js_1.BuildCommand.initCli(repository, program);
|
|
57
58
|
if (!_argv.length)
|
|
58
59
|
program.showHelp();
|
|
59
60
|
else
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuildCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
class BuildCommand extends
|
|
4
|
+
const command_js_1 = require("../core/command.js");
|
|
5
|
+
const run_command_js_1 = require("./run-command.js");
|
|
6
|
+
class BuildCommand extends run_command_js_1.RunCommand {
|
|
7
7
|
constructor(repository, options) {
|
|
8
8
|
super(repository, 'build', options);
|
|
9
9
|
this.repository = repository;
|
|
@@ -22,7 +22,7 @@ BuildCommand.commandName = 'build';
|
|
|
22
22
|
.option(BuildCommand.cliCommandOptions);
|
|
23
23
|
},
|
|
24
24
|
handler: async (args) => {
|
|
25
|
-
const options =
|
|
25
|
+
const options = command_js_1.Command.composeOptions(BuildCommand.commandName, args, repository.config);
|
|
26
26
|
await new BuildCommand(repository, options)
|
|
27
27
|
.execute();
|
|
28
28
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChangedCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
class ChangedCommand extends
|
|
4
|
+
const command_js_1 = require("../core/command.js");
|
|
5
|
+
const list_command_js_1 = require("./list-command.js");
|
|
6
|
+
class ChangedCommand extends list_command_js_1.ListCommand {
|
|
7
7
|
constructor(repository, options) {
|
|
8
8
|
super(repository, options);
|
|
9
9
|
this.repository = repository;
|
|
@@ -25,10 +25,10 @@ ChangedCommand.commandName = 'changed';
|
|
|
25
25
|
return cmd
|
|
26
26
|
.example("$0 changed", "# List changed packages")
|
|
27
27
|
.example('$0 changed --json', '# List changed packages in JSON format')
|
|
28
|
-
.option(
|
|
28
|
+
.option(list_command_js_1.ListCommand.cliCommandOptions);
|
|
29
29
|
},
|
|
30
30
|
handler: async (args) => {
|
|
31
|
-
const options =
|
|
31
|
+
const options = command_js_1.Command.composeOptions(ChangedCommand.commandName, args, repository.config);
|
|
32
32
|
await new ChangedCommand(repository, options)
|
|
33
33
|
.execute();
|
|
34
34
|
}
|
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CleanInstallCommand = void 0;
|
|
7
|
-
const power_tasks_1 = require("power-tasks");
|
|
8
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
8
|
const npmlog_1 = __importDefault(require("npmlog"));
|
|
10
|
-
const command_1 = require("../core/command");
|
|
11
|
-
const run_command_1 = require("./run-command");
|
|
12
|
-
const file_utils_1 = require("../utils/file-utils");
|
|
13
9
|
const path_1 = __importDefault(require("path"));
|
|
14
|
-
|
|
10
|
+
const power_tasks_1 = require("power-tasks");
|
|
11
|
+
const command_js_1 = require("../core/command.js");
|
|
12
|
+
const file_utils_js_1 = require("../utils/file-utils.js");
|
|
13
|
+
const run_command_js_1 = require("./run-command.js");
|
|
14
|
+
class CleanInstallCommand extends run_command_js_1.RunCommand {
|
|
15
15
|
constructor(repository, options) {
|
|
16
16
|
super(repository, 'clean_', options);
|
|
17
17
|
this.repository = repository;
|
|
@@ -50,9 +50,9 @@ class CleanInstallCommand extends run_command_1.RunCommand {
|
|
|
50
50
|
return super._exec(args, ctx);
|
|
51
51
|
}
|
|
52
52
|
async _fsDelete(fileOrDir) {
|
|
53
|
-
if (await (0,
|
|
53
|
+
if (await (0, file_utils_js_1.fsExists)(fileOrDir)) {
|
|
54
54
|
npmlog_1.default.info(this.commandName, chalk_1.default.yellow('clean'), 'Deleting ' + path_1.default.relative(this.repository.dirname, fileOrDir));
|
|
55
|
-
await (0,
|
|
55
|
+
await (0, file_utils_js_1.fsDelete)(fileOrDir);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -60,7 +60,7 @@ exports.CleanInstallCommand = CleanInstallCommand;
|
|
|
60
60
|
CleanInstallCommand.commandName = 'ci';
|
|
61
61
|
(function (CleanInstallCommand) {
|
|
62
62
|
CleanInstallCommand.cliCommandOptions = {
|
|
63
|
-
...
|
|
63
|
+
...run_command_js_1.RunCommand.cliCommandOptions
|
|
64
64
|
};
|
|
65
65
|
function initCli(repository, program) {
|
|
66
66
|
program.command({
|
|
@@ -72,7 +72,7 @@ CleanInstallCommand.commandName = 'ci';
|
|
|
72
72
|
.option(CleanInstallCommand.cliCommandOptions);
|
|
73
73
|
},
|
|
74
74
|
handler: async (args) => {
|
|
75
|
-
const options =
|
|
75
|
+
const options = command_js_1.Command.composeOptions(CleanInstallCommand.commandName, args, repository.config);
|
|
76
76
|
await new CleanInstallCommand(repository, options).execute();
|
|
77
77
|
}
|
|
78
78
|
});
|
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ExecuteCommand = void 0;
|
|
7
|
-
const npmlog_1 = __importDefault(require("npmlog"));
|
|
8
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const
|
|
8
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
10
9
|
const power_tasks_1 = require("power-tasks");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
const command_js_1 = require("../core/command.js");
|
|
11
|
+
const exec_js_1 = require("../utils/exec.js");
|
|
12
|
+
const multi_task_command_js_1 = require("./multi-task-command.js");
|
|
13
|
+
class ExecuteCommand extends multi_task_command_js_1.MultiTaskCommand {
|
|
14
14
|
constructor(repository, cmd, argv, options) {
|
|
15
15
|
super(repository, options);
|
|
16
16
|
this.repository = repository;
|
|
@@ -23,7 +23,7 @@ class ExecuteCommand extends multi_task_command_1.MultiTaskCommand {
|
|
|
23
23
|
const task = new power_tasks_1.Task(async () => {
|
|
24
24
|
const t = Date.now();
|
|
25
25
|
npmlog_1.default.verbose(this.commandName, p.name, chalk_1.default.cyanBright.bold('executing'), npmlog_1.default.separator, this.cmd + ' ' + (this.argv?.join(' ') || ''));
|
|
26
|
-
const r = await (0,
|
|
26
|
+
const r = await (0, exec_js_1.exec)(this.cmd, {
|
|
27
27
|
cwd: p.dirname,
|
|
28
28
|
argv: this.argv,
|
|
29
29
|
stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe'
|
|
@@ -44,7 +44,7 @@ exports.ExecuteCommand = ExecuteCommand;
|
|
|
44
44
|
ExecuteCommand.commandName = 'exec';
|
|
45
45
|
(function (ExecuteCommand) {
|
|
46
46
|
ExecuteCommand.cliCommandOptions = {
|
|
47
|
-
...
|
|
47
|
+
...multi_task_command_js_1.MultiTaskCommand.cliCommandOptions
|
|
48
48
|
};
|
|
49
49
|
function initCli(repository, program) {
|
|
50
50
|
program.command({
|
|
@@ -69,7 +69,7 @@ ExecuteCommand.commandName = 'exec';
|
|
|
69
69
|
},
|
|
70
70
|
handler: async (args) => {
|
|
71
71
|
const argv = args['--'] || [];
|
|
72
|
-
const options =
|
|
72
|
+
const options = command_js_1.Command.composeOptions(ExecuteCommand.commandName, args, repository.config);
|
|
73
73
|
await new ExecuteCommand(repository, '' + argv.shift(), argv, options).execute();
|
|
74
74
|
}
|
|
75
75
|
});
|
|
@@ -7,8 +7,8 @@ exports.InfoCommand = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const envinfo_1 = __importDefault(require("envinfo"));
|
|
9
9
|
const semver_1 = __importDefault(require("semver"));
|
|
10
|
-
const
|
|
11
|
-
class InfoCommand extends
|
|
10
|
+
const command_js_1 = require("../core/command.js");
|
|
11
|
+
class InfoCommand extends command_js_1.Command {
|
|
12
12
|
async _execute() {
|
|
13
13
|
const systemInfo = JSON.parse(await envinfo_1.default.run({
|
|
14
14
|
System: ['OS', 'CPU', 'Memory', 'Shell'],
|
|
@@ -56,7 +56,7 @@ InfoCommand.commandName = 'info';
|
|
|
56
56
|
.example('$0 info --json', '# Prints information in JSON format');
|
|
57
57
|
},
|
|
58
58
|
handler: async (args) => {
|
|
59
|
-
const options =
|
|
59
|
+
const options = command_js_1.Command.composeOptions(InfoCommand.commandName, args, repository.config);
|
|
60
60
|
await new InfoCommand(options)
|
|
61
61
|
.execute();
|
|
62
62
|
}
|
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ListCommand = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
8
|
const easy_table_1 = __importDefault(require("easy-table"));
|
|
10
9
|
const npmlog_1 = __importDefault(require("npmlog"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const command_js_1 = require("../core/command.js");
|
|
12
|
+
const git_utils_js_1 = require("../utils/git-utils.js");
|
|
13
|
+
class ListCommand extends command_js_1.Command {
|
|
14
14
|
constructor(repository, options) {
|
|
15
15
|
super(options);
|
|
16
16
|
this.repository = repository;
|
|
@@ -22,7 +22,7 @@ class ListCommand extends command_1.Command {
|
|
|
22
22
|
async _execute() {
|
|
23
23
|
const { repository } = this;
|
|
24
24
|
const packages = repository.getPackages({ toposort: this.options.toposort });
|
|
25
|
-
const git = new
|
|
25
|
+
const git = new git_utils_js_1.GitHelper({ cwd: repository.dirname });
|
|
26
26
|
const dirtyFiles = await git.listDirtyFiles({ absolute: true });
|
|
27
27
|
const committedFiles = await git.listCommittedFiles({ absolute: true });
|
|
28
28
|
const table = new easy_table_1.default();
|
|
@@ -89,6 +89,7 @@ class ListCommand extends command_1.Command {
|
|
|
89
89
|
}
|
|
90
90
|
else if (table.rows.length) {
|
|
91
91
|
npmlog_1.default.output('', '%s', table.toString().trim());
|
|
92
|
+
// eslint-disable-next-line no-console
|
|
92
93
|
console.log('');
|
|
93
94
|
npmlog_1.default.info('list', '%i Package(s) found', count);
|
|
94
95
|
return arr;
|
|
@@ -131,7 +132,7 @@ ListCommand.commandName = 'list';
|
|
|
131
132
|
.option(ListCommand.cliCommandOptions);
|
|
132
133
|
},
|
|
133
134
|
handler: async (args) => {
|
|
134
|
-
const options =
|
|
135
|
+
const options = command_js_1.Command.composeOptions(ListCommand.commandName, args, repository.config);
|
|
135
136
|
await new ListCommand(repository, options)
|
|
136
137
|
.execute();
|
|
137
138
|
}
|
|
@@ -7,13 +7,13 @@ exports.MultiTaskCommand = void 0;
|
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const power_tasks_1 = require("power-tasks");
|
|
9
9
|
const putil_varhelpers_1 = require("putil-varhelpers");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
class MultiTaskCommand extends
|
|
10
|
+
const command_js_1 = require("../core/command.js");
|
|
11
|
+
const constants_js_1 = require("../core/constants.js");
|
|
12
|
+
class MultiTaskCommand extends command_js_1.Command {
|
|
13
13
|
constructor(repository, options) {
|
|
14
14
|
super(options);
|
|
15
15
|
this.repository = repository;
|
|
16
|
-
if (this.options.ci || !
|
|
16
|
+
if (this.options.ci || !constants_js_1.isTTY)
|
|
17
17
|
this.options.progress = false;
|
|
18
18
|
// noinspection SuspiciousTypeOfGuard
|
|
19
19
|
this.options.concurrency = (0, putil_varhelpers_1.toNumber)(options?.concurrency);
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.PublishCommand = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const npmlog_1 = __importDefault(require("npmlog"));
|
|
9
|
-
const command_1 = require("../core/command");
|
|
10
|
-
const run_command_1 = require("./run-command");
|
|
11
9
|
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
const command_js_1 = require("../core/command.js");
|
|
11
|
+
const npm_utils_js_1 = require("../utils/npm-utils.js");
|
|
12
|
+
const run_command_js_1 = require("./run-command.js");
|
|
13
|
+
class PublishCommand extends run_command_js_1.RunCommand {
|
|
14
14
|
constructor(repository, options) {
|
|
15
15
|
super(repository, 'publish', {
|
|
16
16
|
...options,
|
|
@@ -30,7 +30,7 @@ class PublishCommand extends run_command_1.RunCommand {
|
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
32
|
npmlog_1.default.info(this.commandName, logPkgName, npmlog_1.default.separator, `Fetching package information from repository`);
|
|
33
|
-
const npmHelper = new
|
|
33
|
+
const npmHelper = new npm_utils_js_1.NpmHelper({ cwd: p.dirname });
|
|
34
34
|
promises.push(npmHelper.getPackageInfo(p.json.name)
|
|
35
35
|
.then(r => {
|
|
36
36
|
const sameVersion = !!(r && r.version === p.version);
|
|
@@ -80,7 +80,7 @@ exports.PublishCommand = PublishCommand;
|
|
|
80
80
|
PublishCommand.commandName = 'publish';
|
|
81
81
|
(function (PublishCommand) {
|
|
82
82
|
PublishCommand.cliCommandOptions = {
|
|
83
|
-
...
|
|
83
|
+
...run_command_js_1.RunCommand.cliCommandOptions,
|
|
84
84
|
'contents': {
|
|
85
85
|
describe: '# Subdirectory to publish',
|
|
86
86
|
type: 'string'
|
|
@@ -108,7 +108,7 @@ PublishCommand.commandName = 'publish';
|
|
|
108
108
|
.option(PublishCommand.cliCommandOptions);
|
|
109
109
|
},
|
|
110
110
|
handler: async (args) => {
|
|
111
|
-
const options =
|
|
111
|
+
const options = command_js_1.Command.composeOptions(PublishCommand.commandName, args, repository.config);
|
|
112
112
|
await new PublishCommand(repository, options).execute();
|
|
113
113
|
}
|
|
114
114
|
});
|
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RunCommand = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
8
|
const npmlog_1 = __importDefault(require("npmlog"));
|
|
8
9
|
const power_tasks_1 = require("power-tasks");
|
|
9
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
10
10
|
const parse_npm_script_1 = __importDefault(require("@netlify/parse-npm-script"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
class RunCommand extends
|
|
11
|
+
const command_js_1 = require("../core/command.js");
|
|
12
|
+
const exec_js_1 = require("../utils/exec.js");
|
|
13
|
+
const multi_task_command_js_1 = require("./multi-task-command.js");
|
|
14
|
+
class RunCommand extends multi_task_command_js_1.MultiTaskCommand {
|
|
15
15
|
constructor(repository, script, options) {
|
|
16
16
|
super(repository, options);
|
|
17
17
|
this.repository = repository;
|
|
@@ -93,7 +93,7 @@ class RunCommand extends multi_task_command_1.MultiTaskCommand {
|
|
|
93
93
|
if (logLevel)
|
|
94
94
|
npmlog_1.default.verbose(this.commandName, chalk_1.default.cyan(args.name), chalk_1.default.cyanBright.bold('executing'), npmlog_1.default.separator, args.command);
|
|
95
95
|
const t = Date.now();
|
|
96
|
-
const r = await (0,
|
|
96
|
+
const r = await (0, exec_js_1.exec)(args.command, { cwd: args.cwd, stdio: args.stdio, throwOnError: false });
|
|
97
97
|
if (logLevel)
|
|
98
98
|
if (r.error) {
|
|
99
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());
|
|
@@ -109,7 +109,7 @@ exports.RunCommand = RunCommand;
|
|
|
109
109
|
RunCommand.commandName = 'run';
|
|
110
110
|
(function (RunCommand) {
|
|
111
111
|
RunCommand.cliCommandOptions = {
|
|
112
|
-
...
|
|
112
|
+
...multi_task_command_js_1.MultiTaskCommand.cliCommandOptions
|
|
113
113
|
};
|
|
114
114
|
function initCli(repository, program) {
|
|
115
115
|
program.command({
|
|
@@ -133,7 +133,7 @@ RunCommand.commandName = 'run';
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
const options =
|
|
136
|
+
const options = command_js_1.Command.composeOptions(RunCommand.commandName, args, repository.config);
|
|
137
137
|
const script = '' + args.script;
|
|
138
138
|
await new RunCommand(repository, script, options).execute();
|
|
139
139
|
}
|
|
@@ -4,17 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.VersionCommand = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const
|
|
8
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
9
|
const npmlog_1 = __importDefault(require("npmlog"));
|
|
11
|
-
const
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
12
11
|
const power_tasks_1 = require("power-tasks");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
12
|
+
const semver_1 = __importDefault(require("semver"));
|
|
13
|
+
const strip_color_1 = __importDefault(require("strip-color"));
|
|
14
|
+
const command_js_1 = require("../core/command.js");
|
|
15
|
+
const git_utils_js_1 = require("../utils/git-utils.js");
|
|
16
|
+
const run_command_js_1 = require("./run-command.js");
|
|
17
|
+
class VersionCommand extends run_command_js_1.RunCommand {
|
|
18
18
|
constructor(repository, bump, options) {
|
|
19
19
|
super(repository, 'version', options);
|
|
20
20
|
this.repository = repository;
|
|
@@ -22,7 +22,7 @@ class VersionCommand extends run_command_1.RunCommand {
|
|
|
22
22
|
}
|
|
23
23
|
async _prepareTasks(packages) {
|
|
24
24
|
const { repository } = this;
|
|
25
|
-
const git = new
|
|
25
|
+
const git = new git_utils_js_1.GitHelper({ cwd: repository.dirname });
|
|
26
26
|
const dirtyFiles = await git.listDirtyFiles();
|
|
27
27
|
const committedFiles = await git.listCommittedFiles();
|
|
28
28
|
const newVersions = {};
|
|
@@ -162,7 +162,7 @@ VersionCommand.commandName = 'version';
|
|
|
162
162
|
},
|
|
163
163
|
handler: async (args) => {
|
|
164
164
|
const bump = args.bump;
|
|
165
|
-
const options =
|
|
165
|
+
const options = command_js_1.Command.composeOptions(VersionCommand.commandName, args, repository.config);
|
|
166
166
|
await new VersionCommand(repository, bump, options).execute();
|
|
167
167
|
}
|
|
168
168
|
});
|
package/cjs/core/command.js
CHANGED
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Command = void 0;
|
|
7
|
-
|
|
8
|
-
const npmlog_1 = __importDefault(require("npmlog"));
|
|
9
|
-
const is_ci_1 = __importDefault(require("is-ci"));
|
|
10
|
-
const putil_merge_1 = __importDefault(require("putil-merge"));
|
|
11
|
-
require("./logger");
|
|
12
|
-
const constants_1 = require("./constants");
|
|
7
|
+
require("./logger.js");
|
|
13
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
14
9
|
const figures_1 = __importDefault(require("figures"));
|
|
10
|
+
const is_ci_1 = __importDefault(require("is-ci"));
|
|
11
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
12
|
+
const putil_merge_1 = __importDefault(require("putil-merge"));
|
|
13
|
+
const strict_typed_events_1 = require("strict-typed-events");
|
|
14
|
+
const constants_js_1 = require("./constants.js");
|
|
15
15
|
const noOp = () => void (0);
|
|
16
16
|
class Command extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict_typed_events_1.AsyncEventEmitter) {
|
|
17
17
|
constructor(options) {
|
|
@@ -48,7 +48,7 @@ class Command extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict_t
|
|
|
48
48
|
try {
|
|
49
49
|
this.logger.level = this.options.logLevel ||
|
|
50
50
|
(this.options.ci ? 'error' : 'info');
|
|
51
|
-
if (this.options.ci || !
|
|
51
|
+
if (this.options.ci || !constants_js_1.isTTY) {
|
|
52
52
|
this.logger.disableColor();
|
|
53
53
|
this.logger.disableUnicode();
|
|
54
54
|
}
|
|
@@ -80,7 +80,7 @@ class Command extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict_t
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
async enableProgress() {
|
|
83
|
-
if (this.options.ci || !
|
|
83
|
+
if (this.options.ci || !constants_js_1.isTTY || (this._screen && this._screen.visible))
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
disableProgress() {
|
package/cjs/core/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTTY =
|
|
4
|
-
|
|
3
|
+
exports.isTTY = void 0;
|
|
4
|
+
// export const DOTS = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
5
5
|
exports.isTTY = process.stdout.isTTY && process.env.TERM !== 'dumb';
|
package/cjs/core/repository.js
CHANGED
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Repository = void 0;
|
|
7
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
8
10
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
11
|
const putil_merge_1 = __importDefault(require("putil-merge"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
class Repository extends package_1.Package {
|
|
12
|
+
const get_dirname_js_1 = require("../utils/get-dirname.js");
|
|
13
|
+
const package_js_1 = require("./package.js");
|
|
14
|
+
class Repository extends package_js_1.Package {
|
|
15
15
|
constructor(dirname, config, packages) {
|
|
16
16
|
super(dirname);
|
|
17
17
|
this.dirname = dirname;
|
|
@@ -96,14 +96,14 @@ class Repository extends package_1.Package {
|
|
|
96
96
|
for (const dir of dirs) {
|
|
97
97
|
const f = path_1.default.join(dir, 'package.json');
|
|
98
98
|
if (fs_1.default.existsSync(f))
|
|
99
|
-
packages.push(new
|
|
99
|
+
packages.push(new package_js_1.Package(dir));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return packages;
|
|
103
103
|
}
|
|
104
104
|
static _readConfig(dirname) {
|
|
105
105
|
const result = {};
|
|
106
|
-
const pkgJson = (0,
|
|
106
|
+
const pkgJson = (0, get_dirname_js_1.getPackageJson)(dirname);
|
|
107
107
|
if (pkgJson && typeof pkgJson.rman === 'object')
|
|
108
108
|
(0, putil_merge_1.default)(result, pkgJson.rman, { deep: true });
|
|
109
109
|
let filename = path_1.default.resolve(dirname, '.rman.yml');
|
package/cjs/index.js
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./core/repository"), exports);
|
|
17
|
+
__exportStar(require("./core/repository.js"), exports);
|
package/cjs/utils/exec.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.exec = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const signal_exit_1 = __importDefault(require("signal-exit"));
|
|
9
|
-
const
|
|
9
|
+
const npm_run_path_js_1 = require("./npm-run-path.js");
|
|
10
10
|
const runningChildren = new Map();
|
|
11
11
|
async function exec(command, options) {
|
|
12
12
|
const opts = {
|
|
@@ -15,7 +15,7 @@ async function exec(command, options) {
|
|
|
15
15
|
...options,
|
|
16
16
|
};
|
|
17
17
|
opts.env = {
|
|
18
|
-
...(0,
|
|
18
|
+
...(0, npm_run_path_js_1.npmRunPathEnv)({ cwd: opts.cwd }),
|
|
19
19
|
...opts.env
|
|
20
20
|
};
|
|
21
21
|
opts.cwd = opts.cwd || process.cwd();
|
package/cjs/utils/get-dirname.js
CHANGED
|
@@ -4,10 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getPackageJson = exports.getDirname = void 0;
|
|
7
|
-
// noinspection ES6UnusedImports
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
11
9
|
function getDirname() {
|
|
12
10
|
const pst = Error.prepareStackTrace;
|
|
13
11
|
Error.prepareStackTrace = function (_, stack) {
|
package/cjs/utils/git-utils.js
CHANGED
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GitHelper = void 0;
|
|
7
|
-
const exec_1 = require("./exec");
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const exec_js_1 = require("./exec.js");
|
|
9
9
|
class GitHelper {
|
|
10
10
|
constructor(options) {
|
|
11
11
|
this.cwd = options?.cwd || process.cwd();
|
|
12
12
|
}
|
|
13
13
|
async listDirtyFileStatus(options) {
|
|
14
|
-
const x = await (0,
|
|
14
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
15
15
|
cwd: this.cwd,
|
|
16
16
|
argv: ['status', '--porcelain']
|
|
17
17
|
});
|
|
@@ -32,7 +32,7 @@ class GitHelper {
|
|
|
32
32
|
return (await this.listDirtyFileStatus(options)).map(x => x.filename);
|
|
33
33
|
}
|
|
34
34
|
async listCommitSha() {
|
|
35
|
-
const x = await (0,
|
|
35
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
36
36
|
cwd: this.cwd,
|
|
37
37
|
argv: ['cherry']
|
|
38
38
|
});
|
|
@@ -49,7 +49,7 @@ class GitHelper {
|
|
|
49
49
|
: await this.listCommitSha();
|
|
50
50
|
let result = [];
|
|
51
51
|
for (const s of shaArr) {
|
|
52
|
-
const x = await (0,
|
|
52
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
53
53
|
cwd: this.cwd,
|
|
54
54
|
argv: ['show', s, '--name-only', '--pretty="format:"']
|
|
55
55
|
});
|
|
@@ -60,7 +60,7 @@ class GitHelper {
|
|
|
60
60
|
return result;
|
|
61
61
|
}
|
|
62
62
|
async readFileLastPublished(filePath, commitSha) {
|
|
63
|
-
const x = await (0,
|
|
63
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
64
64
|
cwd: this.cwd,
|
|
65
65
|
argv: ['show', (commitSha || 'HEAD') + ':"' + filePath + '"']
|
|
66
66
|
});
|
|
@@ -8,9 +8,9 @@ exports.npmRunPathEnv = exports.npmRunPath = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* Inspired from [npm-run-path](https://github.com/sindresorhus/npm-run-path)
|
|
10
10
|
*/
|
|
11
|
-
const process_1 = __importDefault(require("process"));
|
|
12
11
|
const path_1 = __importDefault(require("path"));
|
|
13
12
|
const path_key_1 = __importDefault(require("path-key"));
|
|
13
|
+
const process_1 = __importDefault(require("process"));
|
|
14
14
|
/**
|
|
15
15
|
Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
|
|
16
16
|
@returns The augmented path string.
|