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.
Files changed (65) hide show
  1. package/bin/rman.mjs +1 -1
  2. package/cjs/cli.js +18 -18
  3. package/cjs/commands/build-command.js +3 -8
  4. package/cjs/commands/changed-command.js +6 -9
  5. package/cjs/commands/ci-command.js +8 -14
  6. package/cjs/commands/execute-command.js +23 -27
  7. package/cjs/commands/info-command.js +15 -21
  8. package/cjs/commands/list-command.js +32 -35
  9. package/cjs/commands/multi-task-command.js +13 -15
  10. package/cjs/commands/publish-command.js +24 -26
  11. package/cjs/commands/run-command.js +34 -34
  12. package/cjs/commands/version-command.js +35 -37
  13. package/cjs/core/command.js +19 -24
  14. package/cjs/core/logger.js +2 -4
  15. package/cjs/core/package.js +3 -5
  16. package/cjs/core/repository.js +9 -11
  17. package/cjs/index.js +2 -15
  18. package/cjs/utils/exec.js +7 -8
  19. package/cjs/utils/file-utils.js +10 -10
  20. package/cjs/utils/get-dirname.js +6 -9
  21. package/cjs/utils/git-utils.js +10 -10
  22. package/cjs/utils/npm-run-path.js +6 -9
  23. package/cjs/utils/npm-utils.js +3 -2
  24. package/esm/cli.js +12 -9
  25. package/esm/commands/build-command.js +3 -8
  26. package/esm/commands/changed-command.js +6 -9
  27. package/esm/commands/ci-command.js +4 -8
  28. package/esm/commands/execute-command.js +20 -22
  29. package/esm/commands/info-command.js +11 -15
  30. package/esm/commands/list-command.js +27 -28
  31. package/esm/commands/multi-task-command.js +11 -11
  32. package/esm/commands/publish-command.js +20 -20
  33. package/esm/commands/run-command.js +31 -29
  34. package/esm/commands/version-command.js +29 -29
  35. package/esm/core/command.js +13 -16
  36. package/esm/core/repository.js +3 -3
  37. package/esm/utils/exec.js +6 -6
  38. package/esm/utils/file-utils.js +4 -1
  39. package/esm/utils/get-dirname.js +1 -1
  40. package/esm/utils/git-utils.js +8 -6
  41. package/esm/utils/npm-utils.js +3 -2
  42. package/package.json +6 -54
  43. package/esm/cli.d.ts +0 -4
  44. package/esm/commands/build-command.d.ts +0 -11
  45. package/esm/commands/changed-command.d.ts +0 -16
  46. package/esm/commands/ci-command.d.ts +0 -24
  47. package/esm/commands/execute-command.d.ts +0 -19
  48. package/esm/commands/info-command.d.ts +0 -10
  49. package/esm/commands/list-command.d.ts +0 -38
  50. package/esm/commands/multi-task-command.d.ts +0 -22
  51. package/esm/commands/publish-command.d.ts +0 -22
  52. package/esm/commands/run-command.d.ts +0 -28
  53. package/esm/commands/version-command.d.ts +0 -25
  54. package/esm/core/command.d.ts +0 -35
  55. package/esm/core/constants.d.ts +0 -1
  56. package/esm/core/logger.d.ts +0 -12
  57. package/esm/core/package.d.ts +0 -13
  58. package/esm/core/repository.d.ts +0 -19
  59. package/esm/index.d.ts +0 -1
  60. package/esm/utils/exec.d.ts +0 -19
  61. package/esm/utils/file-utils.d.ts +0 -5
  62. package/esm/utils/get-dirname.d.ts +0 -2
  63. package/esm/utils/git-utils.d.ts +0 -25
  64. package/esm/utils/npm-run-path.d.ts +0 -67
  65. package/esm/utils/npm-utils.d.ts +0 -12
@@ -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.RunCommand = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const npmlog_1 = __importDefault(require("npmlog"));
4
+ const tslib_1 = require("tslib");
5
+ const parse_npm_script_1 = tslib_1.__importDefault(require("@netlify/parse-npm-script"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
9
8
  const power_tasks_1 = require("power-tasks");
10
- const parse_npm_script_1 = __importDefault(require("@netlify/parse-npm-script"));
11
9
  const command_js_1 = require("../core/command.js");
12
10
  const exec_js_1 = require("../utils/exec.js");
13
11
  const multi_task_command_js_1 = require("./multi-task-command.js");
@@ -31,10 +29,10 @@ class RunCommand extends multi_task_command_js_1.MultiTaskCommand {
31
29
  if (!rootTask?.children)
32
30
  return packageTasks;
33
31
  const tasks = [];
34
- const pre = rootTask.children.filter((t => t.name?.endsWith(':pre' + this.script)));
35
- const post = rootTask.children.filter((t => t.name?.endsWith(':post' + this.script)));
36
- pre.forEach(t => t.options.exclusive = true);
37
- post.forEach(t => t.options.exclusive = true);
32
+ const pre = rootTask.children.filter(t => t.name?.endsWith(':pre' + this.script));
33
+ const post = rootTask.children.filter(t => t.name?.endsWith(':post' + this.script));
34
+ pre.forEach(t => (t.options.exclusive = true));
35
+ post.forEach(t => (t.options.exclusive = true));
38
36
  tasks.push(...pre);
39
37
  tasks.push(...packageTasks);
40
38
  tasks.push(...post);
@@ -51,15 +49,14 @@ class RunCommand extends multi_task_command_js_1.MultiTaskCommand {
51
49
  for (const s of scriptInfo.steps) {
52
50
  const parsed = Array.isArray(s.parsed) ? s.parsed : [s.parsed];
53
51
  for (const cmd of parsed) {
54
- const task = new power_tasks_1.Task(async () => {
55
- return await this._exec(pkg, cmd, {
56
- script: s.name,
57
- stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe'
58
- }, options);
59
- }, {
52
+ const task = new power_tasks_1.Task(async () => await this._exec(pkg, cmd, {
53
+ script: s.name,
54
+ stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe',
55
+ }, options), {
60
56
  name: pkg.name + ':' + s.name,
61
- dependencies: (this.options.parallel || s.name.startsWith('pre') || s.name.startsWith('post')) ?
62
- undefined : pkg.dependencies
57
+ dependencies: this.options.parallel || s.name.startsWith('pre') || s.name.startsWith('post')
58
+ ? undefined
59
+ : pkg.dependencies,
63
60
  });
64
61
  children.push(task);
65
62
  }
@@ -72,20 +69,25 @@ class RunCommand extends multi_task_command_js_1.MultiTaskCommand {
72
69
  });
73
70
  }
74
71
  }
75
- async _exec(pkg, command, args, options) {
72
+ async _exec(pkg, command, args,
73
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
74
+ options) {
76
75
  const name = pkg === this.repository.rootPackage ? 'root' : pkg.name;
77
76
  const logLevel = args.logLevel == null ? 'info' : args.logLevel;
78
- if (logLevel)
77
+ if (logLevel) {
79
78
  npmlog_1.default.verbose(this.commandName, chalk_1.default.cyan(name), npmlog_1.default.separator, chalk_1.default.cyanBright.bold(args.script), chalk_1.default.cyanBright.bold('executing'), npmlog_1.default.separator, command);
79
+ }
80
80
  const t = Date.now();
81
81
  const cwd = args.cwd || pkg.dirname;
82
82
  const r = await (0, exec_js_1.exec)(command, { cwd, stdio: args.stdio, throwOnError: false });
83
- if (logLevel)
83
+ if (logLevel) {
84
84
  if (r.error) {
85
85
  npmlog_1.default.error(this.commandName, chalk_1.default.cyan(name), npmlog_1.default.separator, chalk_1.default.cyanBright.bold(args.script), chalk_1.default.red.bold('failed'), npmlog_1.default.separator, command, npmlog_1.default.separator, r.error.message.trim() + ('\n' + r.stdout).trim());
86
86
  }
87
- else
87
+ else {
88
88
  npmlog_1.default.log(logLevel, this.commandName, chalk_1.default.cyan(name), npmlog_1.default.separator, chalk_1.default.cyanBright.bold(args.script), chalk_1.default.green.bold('success'), npmlog_1.default.separator, command, chalk_1.default.yellow(' (' + (Date.now() - t) + ' ms)'));
89
+ }
90
+ }
89
91
  if (r.error && !args.noThrow)
90
92
  throw r.error;
91
93
  return r;
@@ -95,34 +97,32 @@ exports.RunCommand = RunCommand;
95
97
  RunCommand.commandName = 'run';
96
98
  (function (RunCommand) {
97
99
  RunCommand.cliCommandOptions = {
98
- ...multi_task_command_js_1.MultiTaskCommand.cliCommandOptions
100
+ ...multi_task_command_js_1.MultiTaskCommand.cliCommandOptions,
99
101
  };
100
102
  function initCli(repository, program) {
101
103
  program.command({
102
104
  command: 'run <script>',
103
105
  describe: 'Execute an arbitrary script in each package',
104
- builder: (cmd) => {
105
- return cmd
106
- .example("$0 run build", '')
107
- .positional("script", {
108
- describe: "# The script to execute. Any command flags must be passed after --",
109
- type: "string",
110
- })
111
- .option(RunCommand.cliCommandOptions);
112
- },
106
+ builder: cmd => cmd
107
+ .example('$0 run build', '')
108
+ .positional('script', {
109
+ describe: '# The script to execute. Any command flags must be passed after --',
110
+ type: 'string',
111
+ })
112
+ .option(RunCommand.cliCommandOptions),
113
113
  handler: async (args) => {
114
114
  const runCfg = repository.config?.command?.run;
115
115
  if (args.script && runCfg && typeof runCfg === 'object') {
116
116
  ['parallel', 'bail', 'progress'].forEach(n => {
117
117
  if (typeof runCfg[n] === 'string') {
118
- runCfg[n] = runCfg[n].split(/\s*,\s*/).includes(args.script);
118
+ runCfg[n] = runCfg[n].split(/\s*,\s*/).includes(String(args.script));
119
119
  }
120
120
  });
121
121
  }
122
122
  const options = command_js_1.Command.composeOptions(RunCommand.commandName, args, repository.config);
123
123
  const script = '' + args.script;
124
124
  await new RunCommand(repository, script, options).execute();
125
- }
125
+ },
126
126
  });
127
127
  }
128
128
  RunCommand.initCli = initCli;
@@ -1,15 +1,13 @@
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.VersionCommand = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const npmlog_1 = __importDefault(require("npmlog"));
9
- const path_1 = __importDefault(require("path"));
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
- const semver_1 = __importDefault(require("semver"));
12
- const strip_color_1 = __importDefault(require("strip-color"));
9
+ const semver_1 = tslib_1.__importDefault(require("semver"));
10
+ const strip_color_1 = tslib_1.__importDefault(require("strip-color"));
13
11
  const command_js_1 = require("../core/command.js");
14
12
  const git_utils_js_1 = require("../utils/git-utils.js");
15
13
  const run_command_js_1 = require("./run-command.js");
@@ -40,15 +38,16 @@ class VersionCommand extends run_command_js_1.RunCommand {
40
38
  if (isDirty) {
41
39
  if (!this.options.ignoreDirty)
42
40
  errorCount++;
43
- status = this.options.ignoreDirty ?
44
- chalk_1.default.cyan.bold('skip') : chalk_1.default.redBright.bold('error');
41
+ status = this.options.ignoreDirty ? chalk_1.default.cyan.bold('skip') : chalk_1.default.redBright.bold('error');
45
42
  message = 'Git directory is not clean';
46
43
  }
47
44
  }
48
45
  if (!status) {
49
46
  const isChanged = committedFiles.find(f => !path_1.default.relative(relDir, f).startsWith('..'));
50
- newVer = (isChanged || this.options.all || this.options.unified) ?
51
- semver_1.default.inc(p.version, this.bump) : undefined;
47
+ newVer =
48
+ isChanged || this.options.all || this.options.unified
49
+ ? semver_1.default.inc(p.version, this.bump)
50
+ : undefined;
52
51
  if (newVer)
53
52
  newVersions[p.name] = newVer;
54
53
  else {
@@ -57,7 +56,7 @@ class VersionCommand extends run_command_js_1.RunCommand {
57
56
  }
58
57
  }
59
58
  if (status) {
60
- if (this.options.json)
59
+ if (this.options.json) {
61
60
  npmlog_1.default.info(this.commandName, '%j', {
62
61
  package: p.name,
63
62
  version: p.version,
@@ -65,8 +64,10 @@ class VersionCommand extends run_command_js_1.RunCommand {
65
64
  status: (0, strip_color_1.default)(status),
66
65
  message: (0, strip_color_1.default)(message),
67
66
  });
68
- else
67
+ }
68
+ else {
69
69
  npmlog_1.default.log(this.options.ignoreDirty ? 'info' : 'error', this.commandName, logPkgName, chalk_1.default.whiteBright(p.version), status, npmlog_1.default.separator, message);
70
+ }
70
71
  continue;
71
72
  }
72
73
  selectedPackages.push(p);
@@ -77,18 +78,16 @@ class VersionCommand extends run_command_js_1.RunCommand {
77
78
  }
78
79
  if (errorCount)
79
80
  throw new Error('Unable to bump version due to error(s)');
80
- const maxVer = Object.values(newVersions).reduce((m, v) => {
81
- return semver_1.default.gt(m, v) ? m : v;
82
- }, '0.0.0');
81
+ const maxVer = Object.values(newVersions).reduce((m, v) => (semver_1.default.gt(m, v) ? m : v), '0.0.0');
83
82
  if (this.options.unified) {
84
- Object.keys(newVersions).forEach(k => newVersions[k] = maxVer);
83
+ Object.keys(newVersions).forEach(k => (newVersions[k] = maxVer));
85
84
  }
86
85
  dependentPackages.forEach(p2 => {
87
86
  if (!selectedPackages.includes(p2))
88
87
  selectedPackages.push(p2);
89
88
  });
90
89
  const tasks = await super._prepareTasks(selectedPackages, { newVersions });
91
- tasks.forEach(t => t.options.exclusive = true);
90
+ tasks.forEach(t => (t.options.exclusive = true));
92
91
  if (!this.options.noTag) {
93
92
  tasks.push(new power_tasks_1.Task(async () => {
94
93
  while (this._updatedPackages.size) {
@@ -102,20 +101,21 @@ class VersionCommand extends run_command_js_1.RunCommand {
102
101
  }
103
102
  await super._exec(this.repository.rootPackage, 'git commit -m "' + first.version + '" ' + filenames.map(s => '"' + s + '"').join(' '), {
104
103
  stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe',
105
- logLevel: 'silly'
104
+ logLevel: 'silly',
106
105
  });
107
106
  }
108
- if (this.options.unified)
107
+ if (this.options.unified) {
109
108
  try {
110
109
  await super._exec(this.repository.rootPackage, 'git tag -a "v' + maxVer + '" -m "version ' + maxVer + '"', {
111
110
  cwd: this.repository.dirname,
112
111
  stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe',
113
- logLevel: 'silly'
112
+ logLevel: 'silly',
114
113
  });
115
114
  }
116
115
  catch {
117
116
  //
118
117
  }
118
+ }
119
119
  }, { exclusive: true }));
120
120
  }
121
121
  return tasks;
@@ -157,43 +157,41 @@ exports.VersionCommand = VersionCommand;
157
157
  VersionCommand.commandName = 'version';
158
158
  (function (VersionCommand) {
159
159
  VersionCommand.cliCommandOptions = {
160
- 'unified': {
160
+ unified: {
161
161
  alias: 'u',
162
162
  describe: '# Keep all package versions same',
163
- type: 'boolean'
163
+ type: 'boolean',
164
164
  },
165
- 'all': {
165
+ all: {
166
166
  alias: 'a',
167
167
  describe: '# Bump version for all packages even no commits',
168
- type: 'boolean'
168
+ type: 'boolean',
169
169
  },
170
170
  'ignore-dirty': {
171
171
  alias: 'i',
172
172
  describe: '# Do not bump version for dirty packages',
173
- type: 'boolean'
173
+ type: 'boolean',
174
174
  },
175
175
  'no-tag': {
176
176
  alias: 'n',
177
177
  describe: '# Do not crate git version tag. (Ignores dirty check)',
178
- type: 'boolean'
179
- }
178
+ type: 'boolean',
179
+ },
180
180
  };
181
181
  function initCli(repository, program) {
182
182
  program.command({
183
183
  command: 'version [bump] [...options]',
184
184
  describe: 'Bump version of packages',
185
- builder: (cmd) => {
186
- return cmd
187
- .example("$0 version patch", "# semver keyword")
188
- .example('$0 version 1.0.1', '# explicit')
189
- .conflicts('ignore-dirty', ['force-dirty', 'unified'])
190
- .option(VersionCommand.cliCommandOptions);
191
- },
185
+ builder: cmd => cmd
186
+ .example('$0 version patch', '# semver keyword')
187
+ .example('$0 version 1.0.1', '# explicit')
188
+ .conflicts('ignore-dirty', ['force-dirty', 'unified'])
189
+ .option(VersionCommand.cliCommandOptions),
192
190
  handler: async (args) => {
193
191
  const bump = args.bump;
194
192
  const options = command_js_1.Command.composeOptions(VersionCommand.commandName, args, repository.config);
195
193
  await new VersionCommand(repository, bump, options).execute();
196
- }
194
+ },
197
195
  });
198
196
  }
199
197
  VersionCommand.initCli = initCli;
@@ -1,18 +1,16 @@
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.Command = void 0;
4
+ const tslib_1 = require("tslib");
7
5
  require("./logger.js");
8
- const chalk_1 = __importDefault(require("chalk"));
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"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const figures_1 = tslib_1.__importDefault(require("figures"));
8
+ const is_ci_1 = tslib_1.__importDefault(require("is-ci"));
9
+ const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
10
+ const putil_merge_1 = tslib_1.__importDefault(require("putil-merge"));
13
11
  const strict_typed_events_1 = require("strict-typed-events");
14
12
  const constants_js_1 = require("./constants.js");
15
- const noOp = () => void (0);
13
+ const noOp = () => undefined;
16
14
  class Command extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict_typed_events_1.AsyncEventEmitter) {
17
15
  constructor(options) {
18
16
  super();
@@ -26,7 +24,7 @@ class Command extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict_t
26
24
  Object.defineProperty(this.logger, 'levelIndex', {
27
25
  get() {
28
26
  return npmlog_1.default.levels[npmlog_1.default.level] || 0;
29
- }
27
+ },
30
28
  });
31
29
  }
32
30
  get options() {
@@ -46,8 +44,7 @@ class Command extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict_t
46
44
  }
47
45
  this._started = true;
48
46
  try {
49
- this.logger.level = this.options.logLevel ||
50
- (this.options.ci ? 'error' : 'info');
47
+ this.logger.level = this.options.logLevel || (this.options.ci ? 'error' : 'info');
51
48
  if (this.options.ci || !constants_js_1.isTTY) {
52
49
  this.logger.disableColor();
53
50
  this.logger.disableUnicode();
@@ -82,8 +79,7 @@ class Command extends (0, strict_typed_events_1.TypedEventEmitterClass)(strict_t
82
79
  }
83
80
  }
84
81
  async enableProgress() {
85
- if (this.options.ci || !constants_js_1.isTTY || (this._screen && this._screen.visible))
86
- return;
82
+ // if (this.options.ci || !isTTY || (this._screen && this._screen.visible)) return;
87
83
  }
88
84
  disableProgress() {
89
85
  //
@@ -96,26 +92,25 @@ exports.Command = Command;
96
92
  (function (Command) {
97
93
  Command.globalOptions = {
98
94
  'log-level': {
99
- defaultDescription: "info",
100
- describe: "Set log level",
95
+ defaultDescription: 'info',
96
+ describe: 'Set log level',
101
97
  choices: ['silly', 'verbose', 'info', 'output', 'notice', 'success', 'warn', 'error', 'silent'],
102
- requiresArg: true
98
+ requiresArg: true,
103
99
  },
104
- 'json': {
100
+ json: {
105
101
  alias: 'j',
106
102
  describe: '# Stream log as json',
107
- type: 'boolean'
103
+ type: 'boolean',
108
104
  },
109
- 'ci': {
105
+ ci: {
110
106
  hidden: true,
111
- type: "boolean"
112
- }
107
+ type: 'boolean',
108
+ },
113
109
  };
114
110
  function composeOptions(commandName, yargArgs, config) {
115
111
  const result = (0, putil_merge_1.default)({}, config, { filter: (_, key) => key !== 'command' });
116
112
  (0, putil_merge_1.default)(result, yargArgs);
117
- const cfgCmd = config.command && typeof config.command === 'object' ?
118
- config.command[commandName] : undefined;
113
+ const cfgCmd = config.command && typeof config.command === 'object' ? config.command[commandName] : undefined;
119
114
  if (cfgCmd && typeof cfgCmd === 'object')
120
115
  (0, putil_merge_1.default)(result, cfgCmd);
121
116
  return result;
@@ -1,7 +1,5 @@
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
- const npmlog_1 = __importDefault(require("npmlog"));
3
+ const tslib_1 = require("tslib");
4
+ const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
7
5
  npmlog_1.default.addLevel('output', 3300, {}, '');
@@ -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.Package = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
4
+ const tslib_1 = require("tslib");
5
+ const fs_1 = tslib_1.__importDefault(require("fs"));
6
+ const path_1 = tslib_1.__importDefault(require("path"));
9
7
  class Package {
10
8
  constructor(dirname) {
11
9
  this.dirname = dirname;
@@ -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
3
  exports.Repository = void 0;
7
- const fast_glob_1 = __importDefault(require("fast-glob"));
8
- const fs_1 = __importDefault(require("fs"));
9
- const js_yaml_1 = __importDefault(require("js-yaml"));
10
- const path_1 = __importDefault(require("path"));
11
- const putil_merge_1 = __importDefault(require("putil-merge"));
4
+ const tslib_1 = require("tslib");
5
+ const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
6
+ const fs_1 = tslib_1.__importDefault(require("fs"));
7
+ const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
8
+ const path_1 = tslib_1.__importDefault(require("path"));
9
+ const putil_merge_1 = tslib_1.__importDefault(require("putil-merge"));
12
10
  const get_dirname_js_1 = require("../utils/get-dirname.js");
13
11
  const package_js_1 = require("./package.js");
14
12
  class Repository extends package_js_1.Package {
@@ -35,12 +33,12 @@ class Repository extends package_js_1.Package {
35
33
  ...pkg.json.dependencies,
36
34
  ...pkg.json.devDependencies,
37
35
  ...pkg.json.peerDependencies,
38
- ...pkg.json.optionalDependencies
36
+ ...pkg.json.optionalDependencies,
39
37
  };
40
38
  const configDeps = this.config.packages?.[pkg.name]?.dependencies;
41
39
  if (configDeps) {
42
40
  if (Array.isArray(configDeps))
43
- configDeps.forEach(x => o[x] = o[x] || '*');
41
+ configDeps.forEach(x => (o[x] = o[x] || '*'));
44
42
  else
45
43
  Object.assign(o, configDeps);
46
44
  }
@@ -99,7 +97,7 @@ class Repository extends package_js_1.Package {
99
97
  cwd: dirname,
100
98
  absolute: true,
101
99
  deep: 0,
102
- onlyDirectories: true
100
+ onlyDirectories: true,
103
101
  });
104
102
  for (const dir of dirs) {
105
103
  const f = path_1.default.join(dir, 'package.json');
package/cjs/index.js CHANGED
@@ -1,17 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./core/repository.js"), exports);
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./core/repository.js"), exports);
package/cjs/utils/exec.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exec = void 0;
3
+ exports.exec = exec;
4
4
  const child_process_1 = require("child_process");
5
5
  const signal_exit_1 = require("signal-exit");
6
6
  const npm_run_path_js_1 = require("./npm-run-path.js");
@@ -13,7 +13,7 @@ async function exec(command, options) {
13
13
  };
14
14
  opts.env = {
15
15
  ...(0, npm_run_path_js_1.npmRunPathEnv)({ cwd: opts.cwd }),
16
- ...opts.env
16
+ ...opts.env,
17
17
  };
18
18
  if (process.env.TS_NODE_PROJECT)
19
19
  delete opts.env.TS_NODE_PROJECT;
@@ -23,11 +23,11 @@ async function exec(command, options) {
23
23
  env: opts.env,
24
24
  cwd: opts.cwd,
25
25
  shell: opts.shell,
26
- windowsHide: true
26
+ windowsHide: true,
27
27
  };
28
28
  const result = {
29
29
  code: undefined,
30
- stdout: ''
30
+ stdout: '',
31
31
  };
32
32
  let buffer = '';
33
33
  const processData = (data, stdio) => {
@@ -55,11 +55,11 @@ async function exec(command, options) {
55
55
  if (opts.onSpawn)
56
56
  opts.onSpawn(child);
57
57
  }
58
- child.stdout?.on('data', (data) => {
58
+ child.stdout?.on('data', data => {
59
59
  processData(data, 'stdout');
60
60
  processLines('stdout');
61
61
  });
62
- child.stderr?.on('data', (data) => {
62
+ child.stderr?.on('data', data => {
63
63
  processData(data, 'stderr');
64
64
  processLines('stderr');
65
65
  });
@@ -102,9 +102,8 @@ async function exec(command, options) {
102
102
  });
103
103
  });
104
104
  }
105
- exports.exec = exec;
106
105
  (0, signal_exit_1.onExit)(() => {
107
- runningChildren.forEach((child) => {
106
+ runningChildren.forEach(child => {
108
107
  child.kill();
109
108
  });
110
109
  });
@@ -1,19 +1,20 @@
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.fsDelete = exports.tryStat = exports.fsExists = void 0;
7
- const promises_1 = __importDefault(require("fs/promises"));
8
- const path_1 = __importDefault(require("path"));
3
+ exports.fsExists = fsExists;
4
+ exports.tryStat = tryStat;
5
+ exports.fsDelete = fsDelete;
6
+ const tslib_1 = require("tslib");
7
+ const promises_1 = tslib_1.__importDefault(require("fs/promises"));
8
+ const path_1 = tslib_1.__importDefault(require("path"));
9
9
  async function fsExists(s) {
10
- return promises_1.default.lstat(s).then(() => true).catch(() => false);
10
+ return promises_1.default
11
+ .lstat(s)
12
+ .then(() => true)
13
+ .catch(() => false);
11
14
  }
12
- exports.fsExists = fsExists;
13
15
  async function tryStat(s) {
14
16
  return promises_1.default.lstat(s).catch(() => undefined);
15
17
  }
16
- exports.tryStat = tryStat;
17
18
  async function fsDelete(fileOrDir) {
18
19
  const stat = await tryStat(fileOrDir);
19
20
  if (stat) {
@@ -31,4 +32,3 @@ async function fsDelete(fileOrDir) {
31
32
  }
32
33
  return false;
33
34
  }
34
- exports.fsDelete = fsDelete;
@@ -1,11 +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
- exports.getPackageJson = exports.getDirname = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
3
+ exports.getDirname = getDirname;
4
+ exports.getPackageJson = getPackageJson;
5
+ const tslib_1 = require("tslib");
6
+ const fs_1 = tslib_1.__importDefault(require("fs"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
9
8
  function getDirname() {
10
9
  const pst = Error.prepareStackTrace;
11
10
  Error.prepareStackTrace = function (_, stack) {
@@ -16,7 +15,7 @@ function getDirname() {
16
15
  if (!e.stack)
17
16
  throw Error('Can not parse stack');
18
17
  const stack = e.stack.slice(1);
19
- while (stack) {
18
+ while (stack.length) {
20
19
  const frame = stack.shift();
21
20
  const filename = frame && frame.getFileName();
22
21
  if (filename)
@@ -24,11 +23,9 @@ function getDirname() {
24
23
  }
25
24
  throw Error('Can not parse stack');
26
25
  }
27
- exports.getDirname = getDirname;
28
26
  function getPackageJson(dirname) {
29
27
  const f = path_1.default.resolve(dirname, 'package.json');
30
28
  if (!fs_1.default.existsSync(f))
31
29
  return;
32
30
  return JSON.parse(fs_1.default.readFileSync(f, 'utf-8'));
33
31
  }
34
- exports.getPackageJson = getPackageJson;