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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import parseNpmScript from '@netlify/parse-npm-script';
|
|
1
2
|
import chalk from 'chalk';
|
|
2
3
|
import logger from 'npmlog';
|
|
3
4
|
import { Task } from 'power-tasks';
|
|
4
|
-
import parseNpmScript from '@netlify/parse-npm-script';
|
|
5
5
|
import { Command } from '../core/command.js';
|
|
6
6
|
import { exec } from '../utils/exec.js';
|
|
7
7
|
import { MultiTaskCommand } from './multi-task-command.js';
|
|
@@ -25,10 +25,10 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
25
25
|
if (!rootTask?.children)
|
|
26
26
|
return packageTasks;
|
|
27
27
|
const tasks = [];
|
|
28
|
-
const pre = rootTask.children.filter(
|
|
29
|
-
const post = rootTask.children.filter(
|
|
30
|
-
pre.forEach(t => t.options.exclusive = true);
|
|
31
|
-
post.forEach(t => t.options.exclusive = true);
|
|
28
|
+
const pre = rootTask.children.filter(t => t.name?.endsWith(':pre' + this.script));
|
|
29
|
+
const post = rootTask.children.filter(t => t.name?.endsWith(':post' + this.script));
|
|
30
|
+
pre.forEach(t => (t.options.exclusive = true));
|
|
31
|
+
post.forEach(t => (t.options.exclusive = true));
|
|
32
32
|
tasks.push(...pre);
|
|
33
33
|
tasks.push(...packageTasks);
|
|
34
34
|
tasks.push(...post);
|
|
@@ -45,15 +45,14 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
45
45
|
for (const s of scriptInfo.steps) {
|
|
46
46
|
const parsed = Array.isArray(s.parsed) ? s.parsed : [s.parsed];
|
|
47
47
|
for (const cmd of parsed) {
|
|
48
|
-
const task = new Task(async () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}, options);
|
|
53
|
-
}, {
|
|
48
|
+
const task = new Task(async () => await this._exec(pkg, cmd, {
|
|
49
|
+
script: s.name,
|
|
50
|
+
stdio: logger.levelIndex < 1000 ? 'inherit' : 'pipe',
|
|
51
|
+
}, options), {
|
|
54
52
|
name: pkg.name + ':' + s.name,
|
|
55
|
-
dependencies:
|
|
56
|
-
undefined
|
|
53
|
+
dependencies: this.options.parallel || s.name.startsWith('pre') || s.name.startsWith('post')
|
|
54
|
+
? undefined
|
|
55
|
+
: pkg.dependencies,
|
|
57
56
|
});
|
|
58
57
|
children.push(task);
|
|
59
58
|
}
|
|
@@ -66,20 +65,25 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
66
65
|
});
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
async _exec(pkg, command, args,
|
|
68
|
+
async _exec(pkg, command, args,
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70
|
+
options) {
|
|
70
71
|
const name = pkg === this.repository.rootPackage ? 'root' : pkg.name;
|
|
71
72
|
const logLevel = args.logLevel == null ? 'info' : args.logLevel;
|
|
72
|
-
if (logLevel)
|
|
73
|
+
if (logLevel) {
|
|
73
74
|
logger.verbose(this.commandName, chalk.cyan(name), logger.separator, chalk.cyanBright.bold(args.script), chalk.cyanBright.bold('executing'), logger.separator, command);
|
|
75
|
+
}
|
|
74
76
|
const t = Date.now();
|
|
75
77
|
const cwd = args.cwd || pkg.dirname;
|
|
76
78
|
const r = await exec(command, { cwd, stdio: args.stdio, throwOnError: false });
|
|
77
|
-
if (logLevel)
|
|
79
|
+
if (logLevel) {
|
|
78
80
|
if (r.error) {
|
|
79
81
|
logger.error(this.commandName, chalk.cyan(name), logger.separator, chalk.cyanBright.bold(args.script), chalk.red.bold('failed'), logger.separator, command, logger.separator, r.error.message.trim() + ('\n' + r.stdout).trim());
|
|
80
82
|
}
|
|
81
|
-
else
|
|
83
|
+
else {
|
|
82
84
|
logger.log(logLevel, this.commandName, chalk.cyan(name), logger.separator, chalk.cyanBright.bold(args.script), chalk.green.bold('success'), logger.separator, command, chalk.yellow(' (' + (Date.now() - t) + ' ms)'));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
83
87
|
if (r.error && !args.noThrow)
|
|
84
88
|
throw r.error;
|
|
85
89
|
return r;
|
|
@@ -88,34 +92,32 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
88
92
|
RunCommand.commandName = 'run';
|
|
89
93
|
(function (RunCommand) {
|
|
90
94
|
RunCommand.cliCommandOptions = {
|
|
91
|
-
...MultiTaskCommand.cliCommandOptions
|
|
95
|
+
...MultiTaskCommand.cliCommandOptions,
|
|
92
96
|
};
|
|
93
97
|
function initCli(repository, program) {
|
|
94
98
|
program.command({
|
|
95
99
|
command: 'run <script>',
|
|
96
100
|
describe: 'Execute an arbitrary script in each package',
|
|
97
|
-
builder:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
.option(RunCommand.cliCommandOptions);
|
|
105
|
-
},
|
|
101
|
+
builder: cmd => cmd
|
|
102
|
+
.example('$0 run build', '')
|
|
103
|
+
.positional('script', {
|
|
104
|
+
describe: '# The script to execute. Any command flags must be passed after --',
|
|
105
|
+
type: 'string',
|
|
106
|
+
})
|
|
107
|
+
.option(RunCommand.cliCommandOptions),
|
|
106
108
|
handler: async (args) => {
|
|
107
109
|
const runCfg = repository.config?.command?.run;
|
|
108
110
|
if (args.script && runCfg && typeof runCfg === 'object') {
|
|
109
111
|
['parallel', 'bail', 'progress'].forEach(n => {
|
|
110
112
|
if (typeof runCfg[n] === 'string') {
|
|
111
|
-
runCfg[n] = runCfg[n].split(/\s*,\s*/).includes(args.script);
|
|
113
|
+
runCfg[n] = runCfg[n].split(/\s*,\s*/).includes(String(args.script));
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
const options = Command.composeOptions(RunCommand.commandName, args, repository.config);
|
|
116
118
|
const script = '' + args.script;
|
|
117
119
|
await new RunCommand(repository, script, options).execute();
|
|
118
|
-
}
|
|
120
|
+
},
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
123
|
RunCommand.initCli = initCli;
|
|
@@ -34,15 +34,16 @@ export class VersionCommand extends RunCommand {
|
|
|
34
34
|
if (isDirty) {
|
|
35
35
|
if (!this.options.ignoreDirty)
|
|
36
36
|
errorCount++;
|
|
37
|
-
status = this.options.ignoreDirty ?
|
|
38
|
-
chalk.cyan.bold('skip') : chalk.redBright.bold('error');
|
|
37
|
+
status = this.options.ignoreDirty ? chalk.cyan.bold('skip') : chalk.redBright.bold('error');
|
|
39
38
|
message = 'Git directory is not clean';
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
if (!status) {
|
|
43
42
|
const isChanged = committedFiles.find(f => !path.relative(relDir, f).startsWith('..'));
|
|
44
|
-
newVer =
|
|
45
|
-
|
|
43
|
+
newVer =
|
|
44
|
+
isChanged || this.options.all || this.options.unified
|
|
45
|
+
? semver.inc(p.version, this.bump)
|
|
46
|
+
: undefined;
|
|
46
47
|
if (newVer)
|
|
47
48
|
newVersions[p.name] = newVer;
|
|
48
49
|
else {
|
|
@@ -51,7 +52,7 @@ export class VersionCommand extends RunCommand {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
if (status) {
|
|
54
|
-
if (this.options.json)
|
|
55
|
+
if (this.options.json) {
|
|
55
56
|
logger.info(this.commandName, '%j', {
|
|
56
57
|
package: p.name,
|
|
57
58
|
version: p.version,
|
|
@@ -59,8 +60,10 @@ export class VersionCommand extends RunCommand {
|
|
|
59
60
|
status: stripColor(status),
|
|
60
61
|
message: stripColor(message),
|
|
61
62
|
});
|
|
62
|
-
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
63
65
|
logger.log(this.options.ignoreDirty ? 'info' : 'error', this.commandName, logPkgName, chalk.whiteBright(p.version), status, logger.separator, message);
|
|
66
|
+
}
|
|
64
67
|
continue;
|
|
65
68
|
}
|
|
66
69
|
selectedPackages.push(p);
|
|
@@ -71,18 +74,16 @@ export class VersionCommand extends RunCommand {
|
|
|
71
74
|
}
|
|
72
75
|
if (errorCount)
|
|
73
76
|
throw new Error('Unable to bump version due to error(s)');
|
|
74
|
-
const maxVer = Object.values(newVersions).reduce((m, v) =>
|
|
75
|
-
return semver.gt(m, v) ? m : v;
|
|
76
|
-
}, '0.0.0');
|
|
77
|
+
const maxVer = Object.values(newVersions).reduce((m, v) => (semver.gt(m, v) ? m : v), '0.0.0');
|
|
77
78
|
if (this.options.unified) {
|
|
78
|
-
Object.keys(newVersions).forEach(k => newVersions[k] = maxVer);
|
|
79
|
+
Object.keys(newVersions).forEach(k => (newVersions[k] = maxVer));
|
|
79
80
|
}
|
|
80
81
|
dependentPackages.forEach(p2 => {
|
|
81
82
|
if (!selectedPackages.includes(p2))
|
|
82
83
|
selectedPackages.push(p2);
|
|
83
84
|
});
|
|
84
85
|
const tasks = await super._prepareTasks(selectedPackages, { newVersions });
|
|
85
|
-
tasks.forEach(t => t.options.exclusive = true);
|
|
86
|
+
tasks.forEach(t => (t.options.exclusive = true));
|
|
86
87
|
if (!this.options.noTag) {
|
|
87
88
|
tasks.push(new Task(async () => {
|
|
88
89
|
while (this._updatedPackages.size) {
|
|
@@ -96,20 +97,21 @@ export class VersionCommand extends RunCommand {
|
|
|
96
97
|
}
|
|
97
98
|
await super._exec(this.repository.rootPackage, 'git commit -m "' + first.version + '" ' + filenames.map(s => '"' + s + '"').join(' '), {
|
|
98
99
|
stdio: logger.levelIndex < 1000 ? 'inherit' : 'pipe',
|
|
99
|
-
logLevel: 'silly'
|
|
100
|
+
logLevel: 'silly',
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
|
-
if (this.options.unified)
|
|
103
|
+
if (this.options.unified) {
|
|
103
104
|
try {
|
|
104
105
|
await super._exec(this.repository.rootPackage, 'git tag -a "v' + maxVer + '" -m "version ' + maxVer + '"', {
|
|
105
106
|
cwd: this.repository.dirname,
|
|
106
107
|
stdio: logger.levelIndex < 1000 ? 'inherit' : 'pipe',
|
|
107
|
-
logLevel: 'silly'
|
|
108
|
+
logLevel: 'silly',
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
catch {
|
|
111
112
|
//
|
|
112
113
|
}
|
|
114
|
+
}
|
|
113
115
|
}, { exclusive: true }));
|
|
114
116
|
}
|
|
115
117
|
return tasks;
|
|
@@ -150,43 +152,41 @@ export class VersionCommand extends RunCommand {
|
|
|
150
152
|
VersionCommand.commandName = 'version';
|
|
151
153
|
(function (VersionCommand) {
|
|
152
154
|
VersionCommand.cliCommandOptions = {
|
|
153
|
-
|
|
155
|
+
unified: {
|
|
154
156
|
alias: 'u',
|
|
155
157
|
describe: '# Keep all package versions same',
|
|
156
|
-
type: 'boolean'
|
|
158
|
+
type: 'boolean',
|
|
157
159
|
},
|
|
158
|
-
|
|
160
|
+
all: {
|
|
159
161
|
alias: 'a',
|
|
160
162
|
describe: '# Bump version for all packages even no commits',
|
|
161
|
-
type: 'boolean'
|
|
163
|
+
type: 'boolean',
|
|
162
164
|
},
|
|
163
165
|
'ignore-dirty': {
|
|
164
166
|
alias: 'i',
|
|
165
167
|
describe: '# Do not bump version for dirty packages',
|
|
166
|
-
type: 'boolean'
|
|
168
|
+
type: 'boolean',
|
|
167
169
|
},
|
|
168
170
|
'no-tag': {
|
|
169
171
|
alias: 'n',
|
|
170
172
|
describe: '# Do not crate git version tag. (Ignores dirty check)',
|
|
171
|
-
type: 'boolean'
|
|
172
|
-
}
|
|
173
|
+
type: 'boolean',
|
|
174
|
+
},
|
|
173
175
|
};
|
|
174
176
|
function initCli(repository, program) {
|
|
175
177
|
program.command({
|
|
176
178
|
command: 'version [bump] [...options]',
|
|
177
179
|
describe: 'Bump version of packages',
|
|
178
|
-
builder:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
.option(VersionCommand.cliCommandOptions);
|
|
184
|
-
},
|
|
180
|
+
builder: cmd => cmd
|
|
181
|
+
.example('$0 version patch', '# semver keyword')
|
|
182
|
+
.example('$0 version 1.0.1', '# explicit')
|
|
183
|
+
.conflicts('ignore-dirty', ['force-dirty', 'unified'])
|
|
184
|
+
.option(VersionCommand.cliCommandOptions),
|
|
185
185
|
handler: async (args) => {
|
|
186
186
|
const bump = args.bump;
|
|
187
187
|
const options = Command.composeOptions(VersionCommand.commandName, args, repository.config);
|
|
188
188
|
await new VersionCommand(repository, bump, options).execute();
|
|
189
|
-
}
|
|
189
|
+
},
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
VersionCommand.initCli = initCli;
|
package/esm/core/command.js
CHANGED
|
@@ -6,7 +6,7 @@ import npmlog from 'npmlog';
|
|
|
6
6
|
import merge from 'putil-merge';
|
|
7
7
|
import { AsyncEventEmitter, TypedEventEmitterClass } from 'strict-typed-events';
|
|
8
8
|
import { isTTY } from './constants.js';
|
|
9
|
-
const noOp = () =>
|
|
9
|
+
const noOp = () => undefined;
|
|
10
10
|
export class Command extends TypedEventEmitterClass(AsyncEventEmitter) {
|
|
11
11
|
constructor(options) {
|
|
12
12
|
super();
|
|
@@ -20,7 +20,7 @@ export class Command extends TypedEventEmitterClass(AsyncEventEmitter) {
|
|
|
20
20
|
Object.defineProperty(this.logger, 'levelIndex', {
|
|
21
21
|
get() {
|
|
22
22
|
return npmlog.levels[npmlog.level] || 0;
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
get options() {
|
|
@@ -40,8 +40,7 @@ export class Command extends TypedEventEmitterClass(AsyncEventEmitter) {
|
|
|
40
40
|
}
|
|
41
41
|
this._started = true;
|
|
42
42
|
try {
|
|
43
|
-
this.logger.level = this.options.logLevel ||
|
|
44
|
-
(this.options.ci ? 'error' : 'info');
|
|
43
|
+
this.logger.level = this.options.logLevel || (this.options.ci ? 'error' : 'info');
|
|
45
44
|
if (this.options.ci || !isTTY) {
|
|
46
45
|
this.logger.disableColor();
|
|
47
46
|
this.logger.disableUnicode();
|
|
@@ -76,8 +75,7 @@ export class Command extends TypedEventEmitterClass(AsyncEventEmitter) {
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
async enableProgress() {
|
|
79
|
-
if (this.options.ci || !isTTY || (this._screen && this._screen.visible))
|
|
80
|
-
return;
|
|
78
|
+
// if (this.options.ci || !isTTY || (this._screen && this._screen.visible)) return;
|
|
81
79
|
}
|
|
82
80
|
disableProgress() {
|
|
83
81
|
//
|
|
@@ -89,26 +87,25 @@ export class Command extends TypedEventEmitterClass(AsyncEventEmitter) {
|
|
|
89
87
|
(function (Command) {
|
|
90
88
|
Command.globalOptions = {
|
|
91
89
|
'log-level': {
|
|
92
|
-
defaultDescription:
|
|
93
|
-
describe:
|
|
90
|
+
defaultDescription: 'info',
|
|
91
|
+
describe: 'Set log level',
|
|
94
92
|
choices: ['silly', 'verbose', 'info', 'output', 'notice', 'success', 'warn', 'error', 'silent'],
|
|
95
|
-
requiresArg: true
|
|
93
|
+
requiresArg: true,
|
|
96
94
|
},
|
|
97
|
-
|
|
95
|
+
json: {
|
|
98
96
|
alias: 'j',
|
|
99
97
|
describe: '# Stream log as json',
|
|
100
|
-
type: 'boolean'
|
|
98
|
+
type: 'boolean',
|
|
101
99
|
},
|
|
102
|
-
|
|
100
|
+
ci: {
|
|
103
101
|
hidden: true,
|
|
104
|
-
type:
|
|
105
|
-
}
|
|
102
|
+
type: 'boolean',
|
|
103
|
+
},
|
|
106
104
|
};
|
|
107
105
|
function composeOptions(commandName, yargArgs, config) {
|
|
108
106
|
const result = merge({}, config, { filter: (_, key) => key !== 'command' });
|
|
109
107
|
merge(result, yargArgs);
|
|
110
|
-
const cfgCmd = config.command && typeof config.command === 'object' ?
|
|
111
|
-
config.command[commandName] : undefined;
|
|
108
|
+
const cfgCmd = config.command && typeof config.command === 'object' ? config.command[commandName] : undefined;
|
|
112
109
|
if (cfgCmd && typeof cfgCmd === 'object')
|
|
113
110
|
merge(result, cfgCmd);
|
|
114
111
|
return result;
|
package/esm/core/repository.js
CHANGED
|
@@ -29,12 +29,12 @@ export class Repository extends Package {
|
|
|
29
29
|
...pkg.json.dependencies,
|
|
30
30
|
...pkg.json.devDependencies,
|
|
31
31
|
...pkg.json.peerDependencies,
|
|
32
|
-
...pkg.json.optionalDependencies
|
|
32
|
+
...pkg.json.optionalDependencies,
|
|
33
33
|
};
|
|
34
34
|
const configDeps = this.config.packages?.[pkg.name]?.dependencies;
|
|
35
35
|
if (configDeps) {
|
|
36
36
|
if (Array.isArray(configDeps))
|
|
37
|
-
configDeps.forEach(x => o[x] = o[x] || '*');
|
|
37
|
+
configDeps.forEach(x => (o[x] = o[x] || '*'));
|
|
38
38
|
else
|
|
39
39
|
Object.assign(o, configDeps);
|
|
40
40
|
}
|
|
@@ -93,7 +93,7 @@ export class Repository extends Package {
|
|
|
93
93
|
cwd: dirname,
|
|
94
94
|
absolute: true,
|
|
95
95
|
deep: 0,
|
|
96
|
-
onlyDirectories: true
|
|
96
|
+
onlyDirectories: true,
|
|
97
97
|
});
|
|
98
98
|
for (const dir of dirs) {
|
|
99
99
|
const f = path.join(dir, 'package.json');
|
package/esm/utils/exec.js
CHANGED
|
@@ -10,7 +10,7 @@ export async function exec(command, options) {
|
|
|
10
10
|
};
|
|
11
11
|
opts.env = {
|
|
12
12
|
...npmRunPathEnv({ cwd: opts.cwd }),
|
|
13
|
-
...opts.env
|
|
13
|
+
...opts.env,
|
|
14
14
|
};
|
|
15
15
|
if (process.env.TS_NODE_PROJECT)
|
|
16
16
|
delete opts.env.TS_NODE_PROJECT;
|
|
@@ -20,11 +20,11 @@ export async function exec(command, options) {
|
|
|
20
20
|
env: opts.env,
|
|
21
21
|
cwd: opts.cwd,
|
|
22
22
|
shell: opts.shell,
|
|
23
|
-
windowsHide: true
|
|
23
|
+
windowsHide: true,
|
|
24
24
|
};
|
|
25
25
|
const result = {
|
|
26
26
|
code: undefined,
|
|
27
|
-
stdout: ''
|
|
27
|
+
stdout: '',
|
|
28
28
|
};
|
|
29
29
|
let buffer = '';
|
|
30
30
|
const processData = (data, stdio) => {
|
|
@@ -52,11 +52,11 @@ export async function exec(command, options) {
|
|
|
52
52
|
if (opts.onSpawn)
|
|
53
53
|
opts.onSpawn(child);
|
|
54
54
|
}
|
|
55
|
-
child.stdout?.on('data',
|
|
55
|
+
child.stdout?.on('data', data => {
|
|
56
56
|
processData(data, 'stdout');
|
|
57
57
|
processLines('stdout');
|
|
58
58
|
});
|
|
59
|
-
child.stderr?.on('data',
|
|
59
|
+
child.stderr?.on('data', data => {
|
|
60
60
|
processData(data, 'stderr');
|
|
61
61
|
processLines('stderr');
|
|
62
62
|
});
|
|
@@ -100,7 +100,7 @@ export async function exec(command, options) {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
onExit(() => {
|
|
103
|
-
runningChildren.forEach(
|
|
103
|
+
runningChildren.forEach(child => {
|
|
104
104
|
child.kill();
|
|
105
105
|
});
|
|
106
106
|
});
|
package/esm/utils/file-utils.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import fsa from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
export async function fsExists(s) {
|
|
4
|
-
return fsa
|
|
4
|
+
return fsa
|
|
5
|
+
.lstat(s)
|
|
6
|
+
.then(() => true)
|
|
7
|
+
.catch(() => false);
|
|
5
8
|
}
|
|
6
9
|
export async function tryStat(s) {
|
|
7
10
|
return fsa.lstat(s).catch(() => undefined);
|
package/esm/utils/get-dirname.js
CHANGED
|
@@ -10,7 +10,7 @@ export function getDirname() {
|
|
|
10
10
|
if (!e.stack)
|
|
11
11
|
throw Error('Can not parse stack');
|
|
12
12
|
const stack = e.stack.slice(1);
|
|
13
|
-
while (stack) {
|
|
13
|
+
while (stack.length) {
|
|
14
14
|
const frame = stack.shift();
|
|
15
15
|
const filename = frame && frame.getFileName();
|
|
16
16
|
if (filename)
|
package/esm/utils/git-utils.js
CHANGED
|
@@ -7,7 +7,7 @@ export class GitHelper {
|
|
|
7
7
|
async listDirtyFileStatus(options) {
|
|
8
8
|
const x = await exec('git', {
|
|
9
9
|
cwd: this.cwd,
|
|
10
|
-
argv: ['status', '--porcelain']
|
|
10
|
+
argv: ['status', '--porcelain'],
|
|
11
11
|
});
|
|
12
12
|
const result = [];
|
|
13
13
|
const files = x.stdout ? x.stdout.trim().split(/\s*\n\s*/) : [];
|
|
@@ -16,7 +16,7 @@ export class GitHelper {
|
|
|
16
16
|
if (m) {
|
|
17
17
|
result.push({
|
|
18
18
|
filename: options?.absolute ? path.join(this.cwd, m[2]) : m[2],
|
|
19
|
-
status: m[1]
|
|
19
|
+
status: m[1],
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -28,7 +28,7 @@ export class GitHelper {
|
|
|
28
28
|
async listCommitSha() {
|
|
29
29
|
const x = await exec('git', {
|
|
30
30
|
cwd: this.cwd,
|
|
31
|
-
argv: ['cherry']
|
|
31
|
+
argv: ['cherry'],
|
|
32
32
|
});
|
|
33
33
|
const matches = x.stdout ? x.stdout.matchAll(/([a-f0-9]+)/gi) : [];
|
|
34
34
|
const result = [];
|
|
@@ -39,13 +39,15 @@ export class GitHelper {
|
|
|
39
39
|
}
|
|
40
40
|
async listCommittedFiles(options) {
|
|
41
41
|
const shaArr = options?.commits
|
|
42
|
-
?
|
|
42
|
+
? Array.isArray(options?.commits)
|
|
43
|
+
? options?.commits
|
|
44
|
+
: [options?.commits]
|
|
43
45
|
: await this.listCommitSha();
|
|
44
46
|
let result = [];
|
|
45
47
|
for (const s of shaArr) {
|
|
46
48
|
const x = await exec('git', {
|
|
47
49
|
cwd: this.cwd,
|
|
48
|
-
argv: ['show', s, '--name-only', '--pretty="format:"']
|
|
50
|
+
argv: ['show', s, '--name-only', '--pretty="format:"'],
|
|
49
51
|
});
|
|
50
52
|
result.push(...(x.stdout ? x.stdout.trim().split(/\s*\n\s*/) : []));
|
|
51
53
|
}
|
|
@@ -56,7 +58,7 @@ export class GitHelper {
|
|
|
56
58
|
async readFileLastPublished(filePath, commitSha) {
|
|
57
59
|
const x = await exec('git', {
|
|
58
60
|
cwd: this.cwd,
|
|
59
|
-
argv: ['show', (commitSha || 'HEAD') + ':"' + filePath + '"']
|
|
61
|
+
argv: ['show', (commitSha || 'HEAD') + ':"' + filePath + '"'],
|
|
60
62
|
});
|
|
61
63
|
return x.stdout || '';
|
|
62
64
|
}
|
package/esm/utils/npm-utils.js
CHANGED
|
@@ -8,11 +8,12 @@ export class NpmHelper {
|
|
|
8
8
|
async getPackageInfo(packageName) {
|
|
9
9
|
const x = await exec('npm', {
|
|
10
10
|
cwd: this.cwd,
|
|
11
|
-
argv: ['view', packageName, '--json']
|
|
11
|
+
argv: ['view', packageName, '--json'],
|
|
12
12
|
});
|
|
13
13
|
if (x && x.stdout) {
|
|
14
|
-
if (x.code && x.stdout.includes('404'))
|
|
14
|
+
if (x.code && x.stdout.includes('404')) {
|
|
15
15
|
return new PackageNotFoundError('Package ' + packageName + ' not found in repository');
|
|
16
|
+
}
|
|
16
17
|
const b = x.stdout.indexOf('{');
|
|
17
18
|
const e = x.stdout.lastIndexOf('}');
|
|
18
19
|
const s = x.stdout.substring(b, e + 1);
|
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.29.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"contributors": [
|
|
@@ -44,46 +44,15 @@
|
|
|
44
44
|
"js-yaml": "^4.1.0",
|
|
45
45
|
"npmlog": "^7.0.1",
|
|
46
46
|
"path-key": "^4.0.0",
|
|
47
|
-
"power-tasks": "^1.7.
|
|
47
|
+
"power-tasks": "^1.7.6",
|
|
48
48
|
"putil-merge": "^3.12.1",
|
|
49
49
|
"putil-varhelpers": "^1.6.5",
|
|
50
|
-
"semver": "^7.6.
|
|
50
|
+
"semver": "^7.6.3",
|
|
51
51
|
"signal-exit": "^4.1.0",
|
|
52
|
-
"strict-typed-events": "^2.
|
|
52
|
+
"strict-typed-events": "^2.4.0",
|
|
53
53
|
"strip-color": "^0.1.0",
|
|
54
54
|
"yargs": "^17.7.2"
|
|
55
55
|
},
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"@babel/eslint-parser": "^7.24.7",
|
|
58
|
-
"@types/envinfo": "^7.8.4",
|
|
59
|
-
"@types/ini": "^4.1.0",
|
|
60
|
-
"@types/is-ci": "^3.0.4",
|
|
61
|
-
"@types/jest": "^29.5.12",
|
|
62
|
-
"@types/js-yaml": "^4.0.9",
|
|
63
|
-
"@types/node": "^20.14.2",
|
|
64
|
-
"@types/npmlog": "^7.0.0",
|
|
65
|
-
"@types/semver": "^7.5.8",
|
|
66
|
-
"@types/signal-exit": "^3.0.4",
|
|
67
|
-
"@types/strip-color": "^0.1.2",
|
|
68
|
-
"@types/yargs": "^17.0.32",
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
70
|
-
"@typescript-eslint/parser": "^7.12.0",
|
|
71
|
-
"eslint": "^8.57.0",
|
|
72
|
-
"eslint-config-google": "^0.14.0",
|
|
73
|
-
"eslint-plugin-import-x": "^0.5.1",
|
|
74
|
-
"eslint-plugin-security": "^3.0.0",
|
|
75
|
-
"eslint-plugin-simple-import-sort": "^12.1.0",
|
|
76
|
-
"eslint-plugin-unused-imports": "^3.2.0",
|
|
77
|
-
"jest": "^29.7.0",
|
|
78
|
-
"prettier": "^3.3.1",
|
|
79
|
-
"ts-cleanup": "^0.2.6",
|
|
80
|
-
"ts-gems": "^3.4.0",
|
|
81
|
-
"ts-jest": "^29.1.4",
|
|
82
|
-
"ts-loader": "^9.5.1",
|
|
83
|
-
"ts-node": "^10.9.2",
|
|
84
|
-
"tsconfig-paths": "^4.2.0",
|
|
85
|
-
"typescript": "^5.4.5"
|
|
86
|
-
},
|
|
87
56
|
"engines": {
|
|
88
57
|
"node": ">=16.0",
|
|
89
58
|
"npm": ">=7.0.0"
|
|
@@ -94,22 +63,5 @@
|
|
|
94
63
|
"esm/",
|
|
95
64
|
"LICENSE",
|
|
96
65
|
"README.md"
|
|
97
|
-
]
|
|
98
|
-
|
|
99
|
-
"compile": "tsc -b tsconfig.json",
|
|
100
|
-
"lint": "eslint .",
|
|
101
|
-
"clean": "npm run clean:src && npm run clean:dist",
|
|
102
|
-
"clean:dist": "rimraf cjs esm coverage",
|
|
103
|
-
"clean:src": "ts-cleanup -s src --all | ts-cleanup -s test",
|
|
104
|
-
"prebuild": "npm run clean:dist && npm run lint",
|
|
105
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
106
|
-
"build:cjs": "tsc -b tsconfig-build-cjs.json",
|
|
107
|
-
"build:esm": "tsc -b tsconfig-build-esm.json",
|
|
108
|
-
"postbuild": "cp package.cjs.json ./cjs/package.json",
|
|
109
|
-
"test": "jest",
|
|
110
|
-
"cover": "rimraf coverage",
|
|
111
|
-
"precover": "jest --maxWorkers=1 --coverage",
|
|
112
|
-
"precitest": "rimraf coverage",
|
|
113
|
-
"citest": "jest --coverage --coverageReporters=lcov"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
66
|
+
]
|
|
67
|
+
}
|
package/esm/cli.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import { Repository } from '../core/repository.js';
|
|
3
|
-
import { RunCommand } from './run-command.js';
|
|
4
|
-
export declare class BuildCommand extends RunCommand<any> {
|
|
5
|
-
readonly repository: Repository;
|
|
6
|
-
static commandName: string;
|
|
7
|
-
constructor(repository: Repository, options?: RunCommand.Options);
|
|
8
|
-
}
|
|
9
|
-
export declare namespace BuildCommand {
|
|
10
|
-
function initCli(repository: Repository, program: yargs.Argv): void;
|
|
11
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import { Package } from '../core/package.js';
|
|
3
|
-
import { Repository } from '../core/repository.js';
|
|
4
|
-
import { ListCommand } from './list-command.js';
|
|
5
|
-
export declare class ChangedCommand extends ListCommand {
|
|
6
|
-
readonly repository: Repository;
|
|
7
|
-
static commandName: string;
|
|
8
|
-
constructor(repository: Repository, options?: ListCommand.Options);
|
|
9
|
-
protected _filter(pkg: Package, inf: {
|
|
10
|
-
isDirty?: boolean;
|
|
11
|
-
isCommitted?: boolean;
|
|
12
|
-
}): boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare namespace ChangedCommand {
|
|
15
|
-
function initCli(repository: Repository, program: yargs.Argv): void;
|
|
16
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Task } from 'power-tasks';
|
|
2
|
-
import yargs from 'yargs';
|
|
3
|
-
import { Package } from '../core/package.js';
|
|
4
|
-
import { Repository } from '../core/repository.js';
|
|
5
|
-
import { ExecuteCommandResult } from '../utils/exec.js';
|
|
6
|
-
import { RunCommand } from './run-command.js';
|
|
7
|
-
export declare class CleanInstallCommand extends RunCommand<CleanInstallCommand.Options> {
|
|
8
|
-
readonly repository: Repository;
|
|
9
|
-
static commandName: string;
|
|
10
|
-
constructor(repository: Repository, options?: CleanInstallCommand.Options);
|
|
11
|
-
protected _prepareTasks(packages: Package[]): Promise<Task[]>;
|
|
12
|
-
protected _exec(pkg: Package, command: string, args: {
|
|
13
|
-
cwd?: string;
|
|
14
|
-
dependencies?: string[];
|
|
15
|
-
command: string;
|
|
16
|
-
}, ctx?: any): Promise<ExecuteCommandResult>;
|
|
17
|
-
protected _fsDelete(fileOrDir: string): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export declare namespace CleanInstallCommand {
|
|
20
|
-
interface Options extends RunCommand.Options {
|
|
21
|
-
}
|
|
22
|
-
const cliCommandOptions: Record<string, yargs.Options>;
|
|
23
|
-
function initCli(repository: Repository, program: yargs.Argv): void;
|
|
24
|
-
}
|