rman 0.36.3 → 0.37.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 (78) hide show
  1. package/{esm/commands → commands}/build-command.js +2 -1
  2. package/{esm/commands → commands}/changed-command.js +2 -1
  3. package/{esm/commands → commands}/ci-command.js +2 -1
  4. package/{esm/commands → commands}/execute-command.js +4 -1
  5. package/{esm/commands → commands}/info-command.js +1 -1
  6. package/{esm/commands → commands}/list-command.js +2 -1
  7. package/{esm/commands → commands}/multi-task-command.js +2 -0
  8. package/{types/commands → commands}/publish-command.d.ts +1 -0
  9. package/{esm/commands → commands}/publish-command.js +7 -1
  10. package/{esm/commands → commands}/run-command.js +3 -1
  11. package/{esm/commands → commands}/version-command.js +4 -2
  12. package/{esm/core → core}/command.js +5 -3
  13. package/{esm/core → core}/package.js +3 -1
  14. package/{types/core → core}/repository.d.ts +2 -1
  15. package/{esm/core → core}/repository.js +22 -9
  16. package/package.json +16 -33
  17. package/{esm/utils → utils}/git-utils.js +1 -0
  18. package/{esm/utils → utils}/npm-utils.js +2 -0
  19. package/cjs/cli.js +0 -71
  20. package/cjs/commands/build-command.js +0 -27
  21. package/cjs/commands/changed-command.js +0 -35
  22. package/cjs/commands/ci-command.js +0 -72
  23. package/cjs/commands/execute-command.js +0 -74
  24. package/cjs/commands/info-command.js +0 -60
  25. package/cjs/commands/list-command.js +0 -138
  26. package/cjs/commands/multi-task-command.js +0 -68
  27. package/cjs/commands/publish-command.js +0 -130
  28. package/cjs/commands/run-command.js +0 -134
  29. package/cjs/commands/version-command.js +0 -198
  30. package/cjs/core/command.js +0 -119
  31. package/cjs/core/constants.js +0 -5
  32. package/cjs/core/logger.js +0 -5
  33. package/cjs/core/package.js +0 -42
  34. package/cjs/core/repository.js +0 -139
  35. package/cjs/index.js +0 -4
  36. package/cjs/package.json +0 -3
  37. package/cjs/tsconfig-build-cjs.tsbuildinfo +0 -1
  38. package/cjs/utils/exec.js +0 -109
  39. package/cjs/utils/file-utils.js +0 -34
  40. package/cjs/utils/get-dirname.js +0 -31
  41. package/cjs/utils/git-utils.js +0 -70
  42. package/cjs/utils/npm-run-path.js +0 -68
  43. package/cjs/utils/npm-utils.js +0 -36
  44. package/cjs/utils/package-not-found-error.js +0 -6
  45. package/esm/package.json +0 -3
  46. package/esm/tsconfig-build-esm.tsbuildinfo +0 -1
  47. package/types/index.d.cts +0 -1
  48. /package/{types/cli.d.ts → cli.d.ts} +0 -0
  49. /package/{esm/cli.js → cli.js} +0 -0
  50. /package/{types/commands → commands}/build-command.d.ts +0 -0
  51. /package/{types/commands → commands}/changed-command.d.ts +0 -0
  52. /package/{types/commands → commands}/ci-command.d.ts +0 -0
  53. /package/{types/commands → commands}/execute-command.d.ts +0 -0
  54. /package/{types/commands → commands}/info-command.d.ts +0 -0
  55. /package/{types/commands → commands}/list-command.d.ts +0 -0
  56. /package/{types/commands → commands}/multi-task-command.d.ts +0 -0
  57. /package/{types/commands → commands}/run-command.d.ts +0 -0
  58. /package/{types/commands → commands}/version-command.d.ts +0 -0
  59. /package/{types/core → core}/command.d.ts +0 -0
  60. /package/{types/core → core}/constants.d.ts +0 -0
  61. /package/{esm/core → core}/constants.js +0 -0
  62. /package/{types/core → core}/logger.d.ts +0 -0
  63. /package/{esm/core → core}/logger.js +0 -0
  64. /package/{types/core → core}/package.d.ts +0 -0
  65. /package/{types/index.d.ts → index.d.ts} +0 -0
  66. /package/{esm/index.js → index.js} +0 -0
  67. /package/{types/utils → utils}/exec.d.ts +0 -0
  68. /package/{esm/utils → utils}/exec.js +0 -0
  69. /package/{types/utils → utils}/file-utils.d.ts +0 -0
  70. /package/{esm/utils → utils}/file-utils.js +0 -0
  71. /package/{types/utils → utils}/get-dirname.d.ts +0 -0
  72. /package/{esm/utils → utils}/get-dirname.js +0 -0
  73. /package/{types/utils → utils}/git-utils.d.ts +0 -0
  74. /package/{types/utils → utils}/npm-run-path.d.ts +0 -0
  75. /package/{esm/utils → utils}/npm-run-path.js +0 -0
  76. /package/{types/utils → utils}/npm-utils.d.ts +0 -0
  77. /package/{types/utils → utils}/package-not-found-error.d.ts +0 -0
  78. /package/{esm/utils → utils}/package-not-found-error.js +0 -0
@@ -1,12 +1,13 @@
1
1
  import { Command } from '../core/command.js';
2
2
  import { RunCommand } from './run-command.js';
3
3
  export class BuildCommand extends RunCommand {
4
+ repository;
5
+ static commandName = 'build';
4
6
  constructor(repository, options) {
5
7
  super(repository, 'build', options);
6
8
  this.repository = repository;
7
9
  }
8
10
  }
9
- BuildCommand.commandName = 'build';
10
11
  (function (BuildCommand) {
11
12
  function initCli(repository, program) {
12
13
  program.command({
@@ -1,6 +1,8 @@
1
1
  import { Command } from '../core/command.js';
2
2
  import { ListCommand } from './list-command.js';
3
3
  export class ChangedCommand extends ListCommand {
4
+ repository;
5
+ static commandName = 'changed';
4
6
  constructor(repository, options) {
5
7
  super(repository, options);
6
8
  this.repository = repository;
@@ -11,7 +13,6 @@ export class ChangedCommand extends ListCommand {
11
13
  return !!(inf.isDirty || inf.isCommitted);
12
14
  }
13
15
  }
14
- ChangedCommand.commandName = 'changed';
15
16
  (function (ChangedCommand) {
16
17
  function initCli(repository, program) {
17
18
  program.command({
@@ -6,6 +6,8 @@ import { Command } from '../core/command.js';
6
6
  import { fsDelete, fsExists } from '../utils/file-utils.js';
7
7
  import { RunCommand } from './run-command.js';
8
8
  export class CleanInstallCommand extends RunCommand {
9
+ repository;
10
+ static commandName = 'ci';
9
11
  constructor(repository, options) {
10
12
  super(repository, 'ci', options);
11
13
  this.repository = repository;
@@ -47,7 +49,6 @@ export class CleanInstallCommand extends RunCommand {
47
49
  }
48
50
  }
49
51
  }
50
- CleanInstallCommand.commandName = 'ci';
51
52
  (function (CleanInstallCommand) {
52
53
  CleanInstallCommand.cliCommandOptions = {
53
54
  ...RunCommand.cliCommandOptions,
@@ -5,6 +5,10 @@ import { Command } from '../core/command.js';
5
5
  import { exec } from '../utils/exec.js';
6
6
  import { MultiTaskCommand } from './multi-task-command.js';
7
7
  export class ExecuteCommand extends MultiTaskCommand {
8
+ repository;
9
+ cmd;
10
+ argv;
11
+ static commandName = 'exec';
8
12
  constructor(repository, cmd, argv, options) {
9
13
  super(repository, options);
10
14
  this.repository = repository;
@@ -34,7 +38,6 @@ export class ExecuteCommand extends MultiTaskCommand {
34
38
  return tasks;
35
39
  }
36
40
  }
37
- ExecuteCommand.commandName = 'exec';
38
41
  (function (ExecuteCommand) {
39
42
  ExecuteCommand.cliCommandOptions = {
40
43
  ...MultiTaskCommand.cliCommandOptions,
@@ -3,6 +3,7 @@ import envinfo from 'envinfo';
3
3
  import semver from 'semver';
4
4
  import { Command } from '../core/command.js';
5
5
  export class InfoCommand extends Command {
6
+ static commandName = 'info';
6
7
  async _execute() {
7
8
  const systemInfo = JSON.parse(await envinfo.run({
8
9
  System: ['OS', 'CPU', 'Memory', 'Shell'],
@@ -38,7 +39,6 @@ export class InfoCommand extends Command {
38
39
  }
39
40
  }
40
41
  }
41
- InfoCommand.commandName = 'info';
42
42
  (function (InfoCommand) {
43
43
  function initCli(repository, program) {
44
44
  program.command({
@@ -5,6 +5,8 @@ import path from 'path';
5
5
  import { Command } from '../core/command.js';
6
6
  import { GitHelper } from '../utils/git-utils.js';
7
7
  export class ListCommand extends Command {
8
+ repository;
9
+ static commandName = 'list';
8
10
  constructor(repository, options) {
9
11
  super(options);
10
12
  this.repository = repository;
@@ -92,7 +94,6 @@ export class ListCommand extends Command {
92
94
  return arr;
93
95
  }
94
96
  }
95
- ListCommand.commandName = 'list';
96
97
  (function (ListCommand) {
97
98
  ListCommand.cliCommandOptions = {
98
99
  short: {
@@ -4,6 +4,8 @@ import { toNumber } from 'putil-varhelpers';
4
4
  import { Command } from '../core/command.js';
5
5
  import { isTTY } from '../core/constants.js';
6
6
  export class MultiTaskCommand extends Command {
7
+ repository;
8
+ _task;
7
9
  constructor(repository, options) {
8
10
  super(options);
9
11
  this.repository = repository;
@@ -15,6 +15,7 @@ export declare namespace PublishCommand {
15
15
  interface Options extends RunCommand.Options {
16
16
  contents?: string;
17
17
  access?: string;
18
+ tag?: string;
18
19
  checkOnly?: boolean;
19
20
  userconfig?: string;
20
21
  }
@@ -6,6 +6,8 @@ import { NpmHelper } from '../utils/npm-utils.js';
6
6
  import { PackageNotFoundError } from '../utils/package-not-found-error.js';
7
7
  import { RunCommand } from './run-command.js';
8
8
  export class PublishCommand extends RunCommand {
9
+ repository;
10
+ static commandName = 'publish';
9
11
  constructor(repository, options) {
10
12
  super(repository, 'publish', {
11
13
  ...options,
@@ -74,6 +76,7 @@ export class PublishCommand extends RunCommand {
74
76
  const npmHelper = new NpmHelper({ cwd: pkg.dirname, userconfig: this.options.userconfig });
75
77
  return super._exec(pkg, 'npm publish' +
76
78
  (this.options.access ? ' --access=' + this.options.access : '') +
79
+ (this.options.tag ? ' --tag=' + this.options.tag : '') +
77
80
  (npmHelper.userconfig ? ` --userconfig="${npmHelper.userconfig}"` : ''), {
78
81
  ...args,
79
82
  cwd,
@@ -83,7 +86,6 @@ export class PublishCommand extends RunCommand {
83
86
  return super._exec(pkg, command, args, options);
84
87
  }
85
88
  }
86
- PublishCommand.commandName = 'publish';
87
89
  (function (PublishCommand) {
88
90
  PublishCommand.cliCommandOptions = {
89
91
  ...RunCommand.cliCommandOptions,
@@ -98,6 +100,10 @@ PublishCommand.commandName = 'publish';
98
100
  type: 'string',
99
101
  choices: ['public', 'restricted'],
100
102
  },
103
+ tag: {
104
+ describe: '',
105
+ type: 'string',
106
+ },
101
107
  userconfig: {
102
108
  describe: '# Path of .npmrc file to use for authentication',
103
109
  type: 'string',
@@ -6,6 +6,9 @@ import { Command } from '../core/command.js';
6
6
  import { exec } from '../utils/exec.js';
7
7
  import { MultiTaskCommand } from './multi-task-command.js';
8
8
  export class RunCommand extends MultiTaskCommand {
9
+ repository;
10
+ script;
11
+ static commandName = 'run';
9
12
  constructor(repository, script, options) {
10
13
  super(repository, options);
11
14
  this.repository = repository;
@@ -94,7 +97,6 @@ export class RunCommand extends MultiTaskCommand {
94
97
  return r;
95
98
  }
96
99
  }
97
- RunCommand.commandName = 'run';
98
100
  (function (RunCommand) {
99
101
  RunCommand.cliCommandOptions = {
100
102
  ...MultiTaskCommand.cliCommandOptions,
@@ -8,11 +8,14 @@ import { Command } from '../core/command.js';
8
8
  import { GitHelper } from '../utils/git-utils.js';
9
9
  import { RunCommand } from './run-command.js';
10
10
  export class VersionCommand extends RunCommand {
11
+ repository;
12
+ bump;
13
+ static commandName = 'version';
14
+ _updatedPackages = new Set();
11
15
  constructor(repository, bump, options) {
12
16
  super(repository, 'version', options);
13
17
  this.repository = repository;
14
18
  this.bump = bump;
15
- this._updatedPackages = new Set();
16
19
  }
17
20
  async _prepareTasks(packages) {
18
21
  const { repository } = this;
@@ -149,7 +152,6 @@ export class VersionCommand extends RunCommand {
149
152
  return super._exec(pkg, command, args, options);
150
153
  }
151
154
  }
152
- VersionCommand.commandName = 'version';
153
155
  (function (VersionCommand) {
154
156
  VersionCommand.cliCommandOptions = {
155
157
  unified: {
@@ -8,11 +8,13 @@ import { isTTY } from './constants.js';
8
8
  const noOp = () => undefined;
9
9
  const lineVerticalDashed0 = '┆';
10
10
  export class Command extends TypedEventEmitterClass(AsyncEventEmitter) {
11
+ _started = false;
12
+ _finished = false;
13
+ _options;
14
+ logger = npmlog;
15
+ static commandName;
11
16
  constructor(options) {
12
17
  super();
13
- this._started = false;
14
- this._finished = false;
15
- this.logger = npmlog;
16
18
  this._options = options || {};
17
19
  if (isCi)
18
20
  this.options.ci = true;
@@ -1,9 +1,11 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  export class Package {
4
+ dirname;
5
+ _json;
6
+ dependencies = [];
4
7
  constructor(dirname) {
5
8
  this.dirname = dirname;
6
- this.dependencies = [];
7
9
  this.reloadJson();
8
10
  }
9
11
  get basename() {
@@ -2,9 +2,10 @@ import { Package } from './package.js';
2
2
  export declare class Repository extends Package {
3
3
  readonly dirname: string;
4
4
  readonly config: any;
5
+ readonly monorepo: boolean;
5
6
  readonly packages: Package[];
6
7
  readonly rootPackage: Package;
7
- protected constructor(dirname: string, config: any, packages: Package[]);
8
+ protected constructor(dirname: string, config: any, monorepo: boolean, packages: Package[]);
8
9
  getPackages(options?: {
9
10
  scope?: string | string[];
10
11
  toposort?: boolean;
@@ -6,12 +6,20 @@ import merge from 'putil-merge';
6
6
  import { getPackageJson } from '../utils/get-dirname.js';
7
7
  import { Package } from './package.js';
8
8
  export class Repository extends Package {
9
- constructor(dirname, config, packages) {
9
+ dirname;
10
+ config;
11
+ monorepo;
12
+ packages;
13
+ rootPackage;
14
+ constructor(dirname, config, monorepo, packages) {
10
15
  super(dirname);
11
16
  this.dirname = dirname;
12
17
  this.config = config;
18
+ this.monorepo = monorepo;
13
19
  this.packages = packages;
14
20
  this.rootPackage = new Package(dirname);
21
+ if (!monorepo)
22
+ this.packages = [this.rootPackage];
15
23
  }
16
24
  getPackages(options) {
17
25
  const result = [...this.packages];
@@ -68,23 +76,28 @@ export class Repository extends Package {
68
76
  }
69
77
  }
70
78
  static create(root, options) {
71
- let dirname = root || process.cwd();
79
+ const dirname = root || process.cwd();
72
80
  let deep = options?.deep ?? 10;
73
- while (deep-- >= 0 && fs.existsSync(dirname)) {
74
- const f = path.join(dirname, 'package.json');
81
+ let pkgDirname = dirname;
82
+ while (deep-- >= 0 && fs.existsSync(pkgDirname)) {
83
+ const f = path.join(pkgDirname, 'package.json');
75
84
  if (fs.existsSync(f)) {
76
85
  const pkgJson = JSON.parse(fs.readFileSync(f, 'utf-8'));
77
86
  if (Array.isArray(pkgJson.workspaces)) {
78
- const packages = this._resolvePackages(dirname, pkgJson.workspaces);
79
- const config = this._readConfig(dirname);
80
- const repo = new Repository(dirname, config, packages);
87
+ const packages = this._resolvePackages(pkgDirname, pkgJson.workspaces);
88
+ const config = this._readConfig(pkgDirname);
89
+ const repo = new Repository(pkgDirname, config, true, packages);
81
90
  repo._updateDependencies();
82
91
  return repo;
83
92
  }
84
93
  }
85
- dirname = path.resolve(dirname, '..');
94
+ pkgDirname = path.resolve(dirname, '..');
86
95
  }
87
- throw new Error('No monorepo project detected');
96
+ const config = this._readConfig(dirname);
97
+ const repo = new Repository(dirname, config, false, []);
98
+ repo._updateDependencies();
99
+ return repo;
100
+ // throw new Error('No monorepo project detected');
88
101
  }
89
102
  static _resolvePackages(dirname, patterns) {
90
103
  const packages = [];
package/package.json CHANGED
@@ -1,50 +1,45 @@
1
1
  {
2
2
  "name": "rman",
3
- "description": "Monorepo repository manager",
4
- "version": "0.36.3",
3
+ "description": "Repository manager",
4
+ "version": "0.37.0",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@netlify/parse-npm-script": "^0.1.2",
9
9
  "ansi-colors": "^4.1.3",
10
10
  "easy-table": "^1.2.0",
11
- "envinfo": "^7.14.0",
11
+ "envinfo": "^7.21.0",
12
12
  "fast-glob": "^3.3.3",
13
- "ini": "^5.0.0",
13
+ "ini": "^6.0.0",
14
14
  "is-ci": "^4.1.0",
15
- "js-yaml": "^4.1.0",
15
+ "js-yaml": "^4.1.1",
16
16
  "npmlog": "^7.0.1",
17
- "power-tasks": "^1.11.0",
17
+ "power-tasks": "^1.11.1",
18
18
  "putil-merge": "^3.13.0",
19
- "putil-varhelpers": "^1.6.5",
20
- "semver": "^7.7.1",
19
+ "putil-varhelpers": "^1.7.0",
20
+ "semver": "^7.7.3",
21
21
  "signal-exit": "^4.1.0",
22
22
  "strict-typed-events": "^2.8.0",
23
23
  "strip-color": "^0.1.0",
24
24
  "tslib": "^2.8.1",
25
- "yargs": "^17.7.2"
25
+ "yargs": "^18.0.0"
26
26
  },
27
27
  "type": "module",
28
+ "module": "./index.js",
29
+ "types": "./index.d.ts",
28
30
  "exports": {
29
31
  ".": {
30
- "import": {
31
- "types": "./types/index.d.ts",
32
- "default": "./esm/index.js"
33
- },
34
- "require": {
35
- "types": "./types/index.d.cts",
36
- "default": "./cjs/index.js"
37
- },
38
- "default": "./esm/index.js"
32
+ "types": "./index.d.ts",
33
+ "default": "./index.js"
39
34
  },
40
35
  "./package.json": "./package.json"
41
36
  },
42
- "main": "./cjs/index.js",
43
- "module": "./esm/index.js",
44
- "types": "./types/index.d.ts",
45
37
  "bin": {
46
38
  "rman": "bin/rman.mjs"
47
39
  },
40
+ "engines": {
41
+ "node": ">=20.0"
42
+ },
48
43
  "contributors": [
49
44
  "Eray Hanoglu <e.hanoglu@panates.com>"
50
45
  ],
@@ -52,18 +47,6 @@
52
47
  "type": "git",
53
48
  "url": "git+https://github.com/panates/rman.git"
54
49
  },
55
- "engines": {
56
- "node": ">=16.0",
57
- "npm": ">=7.0.0"
58
- },
59
- "files": [
60
- "bin/",
61
- "cjs/",
62
- "esm/",
63
- "types",
64
- "LICENSE",
65
- "README.md"
66
- ],
67
50
  "keywords": [
68
51
  "javascript",
69
52
  "typescript",
@@ -1,6 +1,7 @@
1
1
  import path from 'path';
2
2
  import { exec } from './exec.js';
3
3
  export class GitHelper {
4
+ cwd;
4
5
  constructor(options) {
5
6
  this.cwd = options?.cwd || process.cwd();
6
7
  }
@@ -2,6 +2,8 @@ import path from 'path';
2
2
  import { exec } from './exec.js';
3
3
  import { PackageNotFoundError } from './package-not-found-error.js';
4
4
  export class NpmHelper {
5
+ cwd;
6
+ userconfig;
5
7
  constructor(options) {
6
8
  this.cwd = options?.cwd || process.cwd();
7
9
  this.userconfig = options?.userconfig ? path.resolve(this.cwd, options.userconfig) : undefined;
package/cjs/cli.js DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runCli = runCli;
4
- const tslib_1 = require("tslib");
5
- const ansi_colors_1 = tslib_1.__importDefault(require("ansi-colors"));
6
- const promises_1 = tslib_1.__importDefault(require("fs/promises"));
7
- const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
8
- const path_1 = tslib_1.__importDefault(require("path"));
9
- const yargs_1 = tslib_1.__importDefault(require("yargs"));
10
- const build_command_js_1 = require("./commands/build-command.js");
11
- const changed_command_js_1 = require("./commands/changed-command.js");
12
- const ci_command_js_1 = require("./commands/ci-command.js");
13
- const execute_command_js_1 = require("./commands/execute-command.js");
14
- const info_command_js_1 = require("./commands/info-command.js");
15
- const list_command_js_1 = require("./commands/list-command.js");
16
- const publish_command_js_1 = require("./commands/publish-command.js");
17
- const run_command_js_1 = require("./commands/run-command.js");
18
- const version_command_js_1 = require("./commands/version-command.js");
19
- const command_js_1 = require("./core/command.js");
20
- const repository_js_1 = require("./core/repository.js");
21
- const get_dirname_js_1 = require("./utils/get-dirname.js");
22
- async function runCli(options) {
23
- try {
24
- const s = path_1.default.resolve((0, get_dirname_js_1.getDirname)(), '../package.json');
25
- const pkgJson = JSON.parse(await promises_1.default.readFile(s, 'utf-8'));
26
- const repository = repository_js_1.Repository.create(options?.cwd);
27
- const _argv = options?.argv || process.argv.slice(2);
28
- const globalKeys = Object.keys(command_js_1.Command.globalOptions).concat(['help', 'version']);
29
- const program = (0, yargs_1.default)(_argv)
30
- // .scriptName('rman')
31
- .strict()
32
- .version(pkgJson.version || '')
33
- .alias('version', 'v')
34
- .usage('$0 <cmd> [options...]')
35
- .help('help')
36
- .alias('help', 'h')
37
- .showHelpOnFail(false, 'Run with --help for available options')
38
- .fail((msg, err) => {
39
- if (!err?.logged) {
40
- const text = msg
41
- ? msg + '\n\n' + ansi_colors_1.default.whiteBright('Run with --help for available options')
42
- : err
43
- ? err.message
44
- : '';
45
- console.log('\n' + ansi_colors_1.default.red(text));
46
- throw msg;
47
- }
48
- else
49
- process.exit(1);
50
- })
51
- // group options under "Global Options:" header
52
- .options(command_js_1.Command.globalOptions)
53
- .group(globalKeys, 'Global Options:');
54
- info_command_js_1.InfoCommand.initCli(repository, program);
55
- list_command_js_1.ListCommand.initCli(repository, program);
56
- changed_command_js_1.ChangedCommand.initCli(repository, program);
57
- execute_command_js_1.ExecuteCommand.initCli(repository, program);
58
- run_command_js_1.RunCommand.initCli(repository, program);
59
- version_command_js_1.VersionCommand.initCli(repository, program);
60
- publish_command_js_1.PublishCommand.initCli(repository, program);
61
- ci_command_js_1.CleanInstallCommand.initCli(repository, program);
62
- build_command_js_1.BuildCommand.initCli(repository, program);
63
- if (!_argv.length)
64
- program.showHelp();
65
- else
66
- await program.parseAsync().catch(() => process.exit(1));
67
- }
68
- catch (e) {
69
- npmlog_1.default.error('rman', e);
70
- }
71
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuildCommand = void 0;
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
- constructor(repository, options) {
8
- super(repository, 'build', options);
9
- this.repository = repository;
10
- }
11
- }
12
- exports.BuildCommand = BuildCommand;
13
- BuildCommand.commandName = 'build';
14
- (function (BuildCommand) {
15
- function initCli(repository, program) {
16
- program.command({
17
- command: 'build [options...]',
18
- describe: 'Alias for "run build"',
19
- builder: cmd => cmd.example('$0 build', '# Builds packages').option(BuildCommand.cliCommandOptions),
20
- handler: async (args) => {
21
- const options = command_js_1.Command.composeOptions(BuildCommand.commandName, args, repository.config);
22
- await new BuildCommand(repository, options).execute();
23
- },
24
- });
25
- }
26
- BuildCommand.initCli = initCli;
27
- })(BuildCommand || (exports.BuildCommand = BuildCommand = {}));
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChangedCommand = void 0;
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
- constructor(repository, options) {
8
- super(repository, options);
9
- this.repository = repository;
10
- }
11
- _filter(pkg, inf) {
12
- if (!super._filter(pkg, inf))
13
- return false;
14
- return !!(inf.isDirty || inf.isCommitted);
15
- }
16
- }
17
- exports.ChangedCommand = ChangedCommand;
18
- ChangedCommand.commandName = 'changed';
19
- (function (ChangedCommand) {
20
- function initCli(repository, program) {
21
- program.command({
22
- command: 'changed [options...]',
23
- describe: 'List local packages that have changed since the last tagged release',
24
- builder: cmd => cmd
25
- .example('$0 changed', '# List changed packages')
26
- .example('$0 changed --json', '# List changed packages in JSON format')
27
- .option(list_command_js_1.ListCommand.cliCommandOptions),
28
- handler: async (args) => {
29
- const options = command_js_1.Command.composeOptions(ChangedCommand.commandName, args, repository.config);
30
- await new ChangedCommand(repository, options).execute();
31
- },
32
- });
33
- }
34
- ChangedCommand.initCli = initCli;
35
- })(ChangedCommand || (exports.ChangedCommand = ChangedCommand = {}));
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CleanInstallCommand = void 0;
4
- const tslib_1 = require("tslib");
5
- const ansi_colors_1 = tslib_1.__importDefault(require("ansi-colors"));
6
- const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- const power_tasks_1 = require("power-tasks");
9
- const command_js_1 = require("../core/command.js");
10
- const file_utils_js_1 = require("../utils/file-utils.js");
11
- const run_command_js_1 = require("./run-command.js");
12
- class CleanInstallCommand extends run_command_js_1.RunCommand {
13
- constructor(repository, options) {
14
- super(repository, 'ci', options);
15
- this.repository = repository;
16
- }
17
- async _prepareTasks(packages) {
18
- const tasks = await super._prepareTasks(packages);
19
- const client = this.repository.config.client || 'npm';
20
- if (!(client === 'npm' || client === 'yargs'))
21
- throw new Error(`Invalid npm client "${client}"`);
22
- tasks.push(new power_tasks_1.Task(async () => {
23
- const dirname = this.repository.dirname;
24
- await this._fsDelete(path_1.default.join(dirname, 'node_modules'));
25
- await this._fsDelete(path_1.default.join(dirname, 'package-lock.json'));
26
- await this._fsDelete(path_1.default.join(dirname, 'yarn-lock.json'));
27
- npmlog_1.default.info(this.commandName, ansi_colors_1.default.yellow('install'), 'Running ' + client + ' install');
28
- return super._exec(this.repository.rootPackage, client + ' install', {
29
- stdio: 'inherit',
30
- });
31
- }, { exclusive: true }));
32
- return tasks;
33
- }
34
- async _exec(pkg, command, args, ctx) {
35
- if (command === '#') {
36
- if (pkg === this.repository.rootPackage)
37
- return { code: 0 };
38
- npmlog_1.default.info(this.commandName, 'Clearing ' + pkg.name);
39
- const cwd = args.cwd || pkg.dirname;
40
- await this._fsDelete(path_1.default.join(cwd, 'node_modules'));
41
- await this._fsDelete(path_1.default.join(cwd, 'package-lock.json'));
42
- await this._fsDelete(path_1.default.join(cwd, 'yarn-lock.json'));
43
- return { code: 0 };
44
- }
45
- return super._exec(pkg, command, args, ctx);
46
- }
47
- async _fsDelete(fileOrDir) {
48
- if (await (0, file_utils_js_1.fsExists)(fileOrDir)) {
49
- npmlog_1.default.info(this.commandName, ansi_colors_1.default.yellow('rmdir'), path_1.default.relative(this.repository.dirname, fileOrDir));
50
- await (0, file_utils_js_1.fsDelete)(fileOrDir);
51
- }
52
- }
53
- }
54
- exports.CleanInstallCommand = CleanInstallCommand;
55
- CleanInstallCommand.commandName = 'ci';
56
- (function (CleanInstallCommand) {
57
- CleanInstallCommand.cliCommandOptions = {
58
- ...run_command_js_1.RunCommand.cliCommandOptions,
59
- };
60
- function initCli(repository, program) {
61
- program.command({
62
- command: 'ci [...options]',
63
- describe: 'Deletes all dependency modules and re-installs',
64
- builder: cmd => cmd.example('$0 ci', '').option(CleanInstallCommand.cliCommandOptions),
65
- handler: async (args) => {
66
- const options = command_js_1.Command.composeOptions(CleanInstallCommand.commandName, args, repository.config);
67
- await new CleanInstallCommand(repository, options).execute();
68
- },
69
- });
70
- }
71
- CleanInstallCommand.initCli = initCli;
72
- })(CleanInstallCommand || (exports.CleanInstallCommand = CleanInstallCommand = {}));