rman 1.3.0 → 2.0.0-beta.2
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/README.md +63 -19
- package/cli.d.ts +5 -0
- package/cli.js +214 -88
- package/commands/build.command.d.ts +177 -3
- package/commands/build.command.js +20 -10
- package/commands/changed.command.d.ts +80 -3
- package/commands/changed.command.js +19 -12
- package/commands/changelog.command.d.ts +192 -3
- package/commands/changelog.command.js +87 -43
- package/commands/config.command.d.ts +44 -3
- package/commands/config.command.js +30 -19
- package/commands/diff.command.d.ts +37 -3
- package/commands/diff.command.js +25 -16
- package/commands/exec.command.d.ts +193 -3
- package/commands/exec.command.js +60 -58
- package/commands/github-release.command.d.ts +154 -3
- package/commands/github-release.command.js +67 -37
- package/commands/import.command.d.ts +36 -3
- package/commands/import.command.js +28 -20
- package/commands/info.command.d.ts +35 -7
- package/commands/info.command.js +36 -30
- package/commands/list.command.d.ts +163 -3
- package/commands/list.command.js +109 -71
- package/commands/publish.command.d.ts +231 -0
- package/commands/publish.command.js +304 -0
- package/commands/run.command.d.ts +186 -6
- package/commands/run.command.js +26 -72
- package/commands/test.command.d.ts +173 -3
- package/commands/test.command.js +16 -10
- package/commands/version.command.d.ts +317 -3
- package/commands/version.command.js +149 -69
- package/commands.d.ts +32 -0
- package/commands.js +28 -0
- package/constants.js +1 -1
- package/core/application.d.ts +116 -0
- package/core/application.js +143 -0
- package/core/command-builder.d.ts +14 -0
- package/core/command-builder.js +78 -0
- package/core/config.d.ts +140 -19
- package/core/config.js +258 -74
- package/core/core-services.d.ts +14 -0
- package/core/core-services.js +30 -0
- package/core/core-targets.d.ts +14 -0
- package/core/core-targets.js +16 -0
- package/core/custom-command.d.ts +42 -6
- package/core/custom-command.js +44 -17
- package/core/extends-config.d.ts +13 -5
- package/core/extends-config.js +52 -12
- package/core/load-config-module.d.ts +28 -0
- package/core/load-config-module.js +42 -0
- package/core/manifest.d.ts +47 -25
- package/core/manifest.js +51 -69
- package/core/merge-config.d.ts +33 -34
- package/core/merge-config.js +137 -92
- package/core/package.d.ts +145 -17
- package/core/package.js +128 -36
- package/core/plugin-loader.d.ts +65 -0
- package/core/plugin-loader.js +234 -0
- package/core/plugin.d.ts +135 -90
- package/core/plugin.js +70 -173
- package/core/publish-target.d.ts +124 -0
- package/core/publish-target.js +30 -0
- package/core/registry.d.ts +30 -0
- package/core/registry.js +47 -0
- package/core/repository.d.ts +72 -9
- package/core/repository.js +293 -44
- package/core/resolve-target.d.ts +1 -1
- package/core/resolve-target.js +1 -1
- package/core/service.d.ts +49 -0
- package/core/service.js +40 -0
- package/core/version-scheme.d.ts +23 -1
- package/core/version-scheme.js +29 -1
- package/core/workspace.d.ts +84 -33
- package/core/workspace.js +63 -22
- package/index.d.ts +111 -14
- package/index.js +85 -9
- package/interfaces/rman-config.interface.d.ts +725 -202
- package/interfaces/rman-config.interface.js +61 -1
- package/package.json +2 -1
- package/plugins/builtins.d.ts +44 -0
- package/plugins/builtins.js +33 -0
- package/plugins/detect.d.ts +78 -0
- package/plugins/detect.js +70 -0
- package/plugins/node/augmentation/rman.augmentation.d.ts +84 -0
- package/plugins/node/augmentation/rman.augmentation.js +1 -0
- package/plugins/node/augmentation/system-info.augmentation.d.ts +26 -0
- package/plugins/node/augmentation/system-info.augmentation.js +79 -0
- package/plugins/node/commands/ci.command.d.ts +131 -0
- package/plugins/node/commands/ci.command.js +59 -0
- package/plugins/node/commands/clean.command.d.ts +183 -0
- package/plugins/node/commands/clean.command.js +73 -0
- package/plugins/node/index.d.ts +29 -0
- package/plugins/node/index.js +40 -0
- package/plugins/node/node-config.interface.d.ts +77 -0
- package/plugins/node/node-config.interface.js +7 -0
- package/plugins/node/node-manifest.provider.d.ts +68 -0
- package/plugins/node/node-manifest.provider.js +125 -0
- package/plugins/node/node.platform.d.ts +53 -0
- package/plugins/node/node.platform.js +134 -0
- package/plugins/node/npm-publish-target.d.ts +73 -0
- package/plugins/node/npm-publish-target.js +96 -0
- package/plugins/node/services/ci.service.d.ts +47 -0
- package/plugins/node/services/ci.service.js +213 -0
- package/plugins/node/services/clean.service.d.ts +53 -0
- package/plugins/node/services/clean.service.js +237 -0
- package/plugins/node/services/publish.service.d.ts +114 -0
- package/plugins/node/services/publish.service.js +371 -0
- package/plugins/node/services/version-plan.service.d.ts +44 -0
- package/plugins/node/services/version-plan.service.js +58 -0
- package/plugins/node/utils/npm-view.d.ts +48 -0
- package/plugins/node/utils/npm-view.js +71 -0
- package/plugins/node/utils/workspace-range.d.ts +26 -0
- package/plugins/node/utils/workspace-range.js +28 -0
- package/services/change-hash.service.d.ts +2 -2
- package/services/change-hash.service.js +2 -2
- package/services/changelog.service.d.ts +62 -51
- package/services/changelog.service.js +14 -11
- package/services/docker-publish.service.d.ts +50 -29
- package/services/docker-publish.service.js +43 -20
- package/services/exec.service.d.ts +23 -12
- package/services/exec.service.js +14 -9
- package/services/github-release.service.d.ts +44 -33
- package/services/github-release.service.js +13 -10
- package/services/import.service.d.ts +25 -14
- package/services/import.service.js +9 -5
- package/services/list.service.d.ts +62 -10
- package/services/list.service.js +62 -15
- package/services/run.service.d.ts +22 -13
- package/services/run.service.js +262 -223
- package/services/version-plan.service.d.ts +27 -4
- package/services/version-plan.service.js +42 -15
- package/services/version.service.d.ts +31 -11
- package/services/version.service.js +29 -13
- package/targets/docker.target.d.ts +53 -0
- package/targets/docker.target.js +40 -0
- package/utils/bin-path.d.ts +6 -7
- package/utils/bin-path.js +7 -18
- package/utils/branch-guard.d.ts +29 -0
- package/utils/branch-guard.js +31 -0
- package/utils/exec.d.ts +10 -0
- package/utils/exec.js +1 -1
- package/utils/logger.d.ts +1 -1
- package/utils/logger.js +1 -1
- package/utils/package-filter.d.ts +127 -7
- package/utils/package-filter.js +197 -16
- package/utils/printable-config.d.ts +1 -1
- package/utils/printable-config.js +1 -1
- package/utils/run-bin.d.ts +10 -0
- package/utils/run-bin.js +1 -1
- package/utils/run-options.d.ts +97 -0
- package/utils/run-options.js +81 -0
- package/utils/version-stamp.d.ts +1 -1
- package/utils/version-stamp.js +1 -1
|
@@ -1,3 +1,163 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type RmanConfig } from '../interfaces/rman-config.interface.js';
|
|
2
|
+
/** `[options...]` is yargs-meaningless - its variadic marker is two dots, and this command declares
|
|
3
|
+
* no positional for it. Left as it is rather than fixed in passing: dropping it makes
|
|
4
|
+
* `rman list foo` start failing, which is a behaviour change and belongs in its own commit. */
|
|
5
|
+
declare const COMMAND: "list [options...]";
|
|
6
|
+
declare const config: {
|
|
7
|
+
short: {
|
|
8
|
+
target: "cli";
|
|
9
|
+
alias: string;
|
|
10
|
+
describe: string;
|
|
11
|
+
type: "boolean";
|
|
12
|
+
};
|
|
13
|
+
parseable: {
|
|
14
|
+
target: "cli";
|
|
15
|
+
alias: string;
|
|
16
|
+
describe: string;
|
|
17
|
+
type: "boolean";
|
|
18
|
+
};
|
|
19
|
+
toposort: {
|
|
20
|
+
target: "cli";
|
|
21
|
+
alias: string;
|
|
22
|
+
describe: string;
|
|
23
|
+
type: "boolean";
|
|
24
|
+
};
|
|
25
|
+
graph: {
|
|
26
|
+
target: "cli";
|
|
27
|
+
alias: string;
|
|
28
|
+
describe: string;
|
|
29
|
+
type: "boolean";
|
|
30
|
+
/** Declared on the option instead of as separate `.conflicts()` calls - what a flag is and what
|
|
31
|
+
* it cannot be combined with end up in one place. */
|
|
32
|
+
conflicts: string[];
|
|
33
|
+
};
|
|
34
|
+
json: {
|
|
35
|
+
target: "cli";
|
|
36
|
+
alias: string;
|
|
37
|
+
describe: string;
|
|
38
|
+
type: "boolean";
|
|
39
|
+
};
|
|
40
|
+
changed: {
|
|
41
|
+
target: "cli";
|
|
42
|
+
alias: string;
|
|
43
|
+
describe: string;
|
|
44
|
+
type: "boolean";
|
|
45
|
+
};
|
|
46
|
+
changedSince: {
|
|
47
|
+
target: "cli";
|
|
48
|
+
cliName: string;
|
|
49
|
+
describe: string;
|
|
50
|
+
type: "string";
|
|
51
|
+
conflicts: string;
|
|
52
|
+
};
|
|
53
|
+
scope: {
|
|
54
|
+
target: "cli";
|
|
55
|
+
describe: string;
|
|
56
|
+
type: "string";
|
|
57
|
+
};
|
|
58
|
+
ignore: {
|
|
59
|
+
target: "cli";
|
|
60
|
+
describe: string;
|
|
61
|
+
type: "string";
|
|
62
|
+
};
|
|
63
|
+
platform: {
|
|
64
|
+
target: "cli";
|
|
65
|
+
describe: string;
|
|
66
|
+
type: "string";
|
|
67
|
+
};
|
|
68
|
+
deps: {
|
|
69
|
+
target: "cli";
|
|
70
|
+
describe: string;
|
|
71
|
+
type: "boolean";
|
|
72
|
+
};
|
|
73
|
+
dependents: {
|
|
74
|
+
target: "cli";
|
|
75
|
+
describe: string;
|
|
76
|
+
type: "boolean";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type Args = RmanConfig.ArgsOf<typeof config, typeof COMMAND>;
|
|
80
|
+
declare const listCommand: (app: import("../index.js").RmanApplication) => {
|
|
81
|
+
command: "list [options...]";
|
|
82
|
+
aliases: string[];
|
|
83
|
+
describe: string;
|
|
84
|
+
config: {
|
|
85
|
+
short: {
|
|
86
|
+
target: "cli";
|
|
87
|
+
alias: string;
|
|
88
|
+
describe: string;
|
|
89
|
+
type: "boolean";
|
|
90
|
+
};
|
|
91
|
+
parseable: {
|
|
92
|
+
target: "cli";
|
|
93
|
+
alias: string;
|
|
94
|
+
describe: string;
|
|
95
|
+
type: "boolean";
|
|
96
|
+
};
|
|
97
|
+
toposort: {
|
|
98
|
+
target: "cli";
|
|
99
|
+
alias: string;
|
|
100
|
+
describe: string;
|
|
101
|
+
type: "boolean";
|
|
102
|
+
};
|
|
103
|
+
graph: {
|
|
104
|
+
target: "cli";
|
|
105
|
+
alias: string;
|
|
106
|
+
describe: string;
|
|
107
|
+
type: "boolean";
|
|
108
|
+
/** Declared on the option instead of as separate `.conflicts()` calls - what a flag is and what
|
|
109
|
+
* it cannot be combined with end up in one place. */
|
|
110
|
+
conflicts: string[];
|
|
111
|
+
};
|
|
112
|
+
json: {
|
|
113
|
+
target: "cli";
|
|
114
|
+
alias: string;
|
|
115
|
+
describe: string;
|
|
116
|
+
type: "boolean";
|
|
117
|
+
};
|
|
118
|
+
changed: {
|
|
119
|
+
target: "cli";
|
|
120
|
+
alias: string;
|
|
121
|
+
describe: string;
|
|
122
|
+
type: "boolean";
|
|
123
|
+
};
|
|
124
|
+
changedSince: {
|
|
125
|
+
target: "cli";
|
|
126
|
+
cliName: string;
|
|
127
|
+
describe: string;
|
|
128
|
+
type: "string";
|
|
129
|
+
conflicts: string;
|
|
130
|
+
};
|
|
131
|
+
scope: {
|
|
132
|
+
target: "cli";
|
|
133
|
+
describe: string;
|
|
134
|
+
type: "string";
|
|
135
|
+
};
|
|
136
|
+
ignore: {
|
|
137
|
+
target: "cli";
|
|
138
|
+
describe: string;
|
|
139
|
+
type: "string";
|
|
140
|
+
};
|
|
141
|
+
platform: {
|
|
142
|
+
target: "cli";
|
|
143
|
+
describe: string;
|
|
144
|
+
type: "string";
|
|
145
|
+
};
|
|
146
|
+
deps: {
|
|
147
|
+
target: "cli";
|
|
148
|
+
describe: string;
|
|
149
|
+
type: "boolean";
|
|
150
|
+
};
|
|
151
|
+
dependents: {
|
|
152
|
+
target: "cli";
|
|
153
|
+
describe: string;
|
|
154
|
+
type: "boolean";
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
examples: {
|
|
158
|
+
command: string;
|
|
159
|
+
description: string;
|
|
160
|
+
}[];
|
|
161
|
+
handler: (args: Args) => Promise<void>;
|
|
162
|
+
};
|
|
163
|
+
export default listCommand;
|
package/commands/list.command.js
CHANGED
|
@@ -1,7 +1,91 @@
|
|
|
1
1
|
import colors from 'ansi-colors';
|
|
2
2
|
import EasyTable from 'easy-table';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { registerCommand } from '../interfaces/rman-config.interface.js';
|
|
4
|
+
import { packageFilterOptions, readPackageFilterOptions } from '../utils/package-filter.js';
|
|
5
|
+
/** `[options...]` is yargs-meaningless - its variadic marker is two dots, and this command declares
|
|
6
|
+
* no positional for it. Left as it is rather than fixed in passing: dropping it makes
|
|
7
|
+
* `rman list foo` start failing, which is a behaviour change and belongs in its own commit. */
|
|
8
|
+
const COMMAND = 'list [options...]';
|
|
9
|
+
const config = {
|
|
10
|
+
...packageFilterOptions,
|
|
11
|
+
short: { target: 'cli', alias: 's', describe: 'Do not show extended information', type: 'boolean' },
|
|
12
|
+
parseable: { target: 'cli', alias: 'p', describe: 'Show parseable output', type: 'boolean' },
|
|
13
|
+
toposort: {
|
|
14
|
+
target: 'cli',
|
|
15
|
+
alias: 't',
|
|
16
|
+
describe: 'Sort packages in topological order (dependencies before dependents) instead of lexical by directory',
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
},
|
|
19
|
+
graph: {
|
|
20
|
+
target: 'cli',
|
|
21
|
+
alias: 'g',
|
|
22
|
+
describe: 'Show dependency graph as a JSON-formatted adjacency list',
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
/** Declared on the option instead of as separate `.conflicts()` calls - what a flag is and what
|
|
25
|
+
* it cannot be combined with end up in one place. */
|
|
26
|
+
conflicts: ['parseable', 'json'],
|
|
27
|
+
},
|
|
28
|
+
json: { target: 'cli', alias: 'j', describe: 'Show output in JSON format', type: 'boolean' },
|
|
29
|
+
changed: {
|
|
30
|
+
target: 'cli',
|
|
31
|
+
alias: 'c',
|
|
32
|
+
describe: 'Only list packages that have changed since the last publish (dirty or committed but not yet published)',
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
changedSince: {
|
|
36
|
+
target: 'cli',
|
|
37
|
+
cliName: 'changed-since',
|
|
38
|
+
describe: 'Only list packages that have changed since the given git commit/hash',
|
|
39
|
+
type: 'string',
|
|
40
|
+
conflicts: 'changed',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const listCommand = registerCommand(app => {
|
|
44
|
+
return {
|
|
45
|
+
command: COMMAND,
|
|
46
|
+
aliases: ['ls'],
|
|
47
|
+
describe: 'Lists packages in repository',
|
|
48
|
+
config,
|
|
49
|
+
examples: [
|
|
50
|
+
{ command: '$0 list', description: '# List all packages' },
|
|
51
|
+
{ command: '$0 list --json', description: '# List all packages in JSON format' },
|
|
52
|
+
],
|
|
53
|
+
handler: async (args) => {
|
|
54
|
+
/**
|
|
55
|
+
* **Only the table asks for the root**, and that is why the option exists rather than the
|
|
56
|
+
* service always including it. The table draws a tree, which needs the row its members are
|
|
57
|
+
* nested under; the other four forms are the inventory a script parses, and the inventory is
|
|
58
|
+
* the workspace members - which is also what the count line reports.
|
|
59
|
+
*/
|
|
60
|
+
const table = !args.graph && !args.json && !args.parseable && !args.short;
|
|
61
|
+
const items = await app.getService('list').getPackages({
|
|
62
|
+
...readPackageFilterOptions(args),
|
|
63
|
+
toposort: args.toposort,
|
|
64
|
+
changed: args.changed,
|
|
65
|
+
changedSince: args.changedSince,
|
|
66
|
+
includeRoot: table,
|
|
67
|
+
});
|
|
68
|
+
if (args.graph)
|
|
69
|
+
printGraph(items);
|
|
70
|
+
else if (args.json)
|
|
71
|
+
console.log(JSON.stringify(items, undefined, 2));
|
|
72
|
+
else if (args.parseable)
|
|
73
|
+
printParseable(items);
|
|
74
|
+
else if (args.short)
|
|
75
|
+
for (const it of items)
|
|
76
|
+
console.log(it.name);
|
|
77
|
+
/**
|
|
78
|
+
* **Whether a root row was added is asked here, not inferred from the rows.** `isRoot` is
|
|
79
|
+
* true of the one package in a *single-package* repository too - it genuinely is the root -
|
|
80
|
+
* so counting rows that are not the root reported `0 Package(s) found` there (measured). The
|
|
81
|
+
* condition is the same one the service applies, and it is one line.
|
|
82
|
+
*/
|
|
83
|
+
else
|
|
84
|
+
printTable(items, table && app.repository.monorepo);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
export default listCommand;
|
|
5
89
|
function statusLabel(status) {
|
|
6
90
|
switch (status) {
|
|
7
91
|
case 'dirty':
|
|
@@ -14,11 +98,31 @@ function statusLabel(status) {
|
|
|
14
98
|
return '';
|
|
15
99
|
}
|
|
16
100
|
}
|
|
17
|
-
|
|
101
|
+
/**
|
|
102
|
+
* **The tree, as a table**: the root first, then each package indented by how far below it sits.
|
|
103
|
+
*
|
|
104
|
+
* Indentation rather than box-drawing characters, which was the cheaper answer to the same
|
|
105
|
+
* question and stays legible when the output is pasted somewhere without a monospace font, copied
|
|
106
|
+
* into a `--scope` argument, or read by eye for the one name someone is looking for. The nesting is
|
|
107
|
+
* `Item.depth`, a fact about the package - so `--toposort` reorders the rows and leaves each one's
|
|
108
|
+
* indentation telling the truth about where it lives.
|
|
109
|
+
*
|
|
110
|
+
* **`Platform` is a column because a package's technology is now a per-package answer.** A polyglot
|
|
111
|
+
* repository is the whole point of the walk finding nested packages of another platform, and until
|
|
112
|
+
* this column existed `rman list` was the one place that showed every package and could not say
|
|
113
|
+
* which technology each belonged to. Blank rather than a word when none claimed it: `Package.provider`
|
|
114
|
+
* is an empty string there, and inventing `unknown` would read as a technology's name.
|
|
115
|
+
*
|
|
116
|
+
* **The count is the members**, root excluded, which is what `repository.packages` means and what
|
|
117
|
+
* every other form of this command reports.
|
|
118
|
+
*/
|
|
119
|
+
function printTable(items, withRoot) {
|
|
18
120
|
const table = new EasyTable();
|
|
19
121
|
for (const it of items) {
|
|
20
|
-
|
|
122
|
+
const indent = ' '.repeat(it.depth);
|
|
123
|
+
table.cell('Package', indent + (it.isRoot ? colors.whiteBright(it.selector) : colors.yellowBright(it.selector)));
|
|
21
124
|
table.cell('Version', colors.yellow(it.version));
|
|
125
|
+
table.cell('Platform', it.platform ? colors.cyan(it.platform) : '');
|
|
22
126
|
table.cell('Private', it.private ? colors.magentaBright('yes') : '');
|
|
23
127
|
table.cell('Changed', statusLabel(it.status));
|
|
24
128
|
table.cell('Path', it.location);
|
|
@@ -26,7 +130,7 @@ function printTable(items) {
|
|
|
26
130
|
}
|
|
27
131
|
console.log(table.toString().trim());
|
|
28
132
|
console.log('');
|
|
29
|
-
console.log(colors.gray(`${items.length} Package(s) found`));
|
|
133
|
+
console.log(colors.gray(`${items.length - (withRoot ? 1 : 0)} Package(s) found`));
|
|
30
134
|
}
|
|
31
135
|
function printParseable(items) {
|
|
32
136
|
for (const it of items) {
|
|
@@ -45,69 +149,3 @@ function printGraph(items) {
|
|
|
45
149
|
graph[it.name] = it.dependencies;
|
|
46
150
|
console.log(JSON.stringify(graph, undefined, 2));
|
|
47
151
|
}
|
|
48
|
-
export function initCli(repository, program) {
|
|
49
|
-
program.command({
|
|
50
|
-
command: 'list [options...]',
|
|
51
|
-
aliases: ['ls'],
|
|
52
|
-
describe: 'Lists packages in repository',
|
|
53
|
-
builder: cmd => applyPackageFilterOptions(cmd)
|
|
54
|
-
.example('$0 list', '# List all packages')
|
|
55
|
-
.example('$0 list --json', '# List all packages in JSON format')
|
|
56
|
-
.conflicts('graph', ['parseable', 'json'])
|
|
57
|
-
.conflicts('short', ['parseable', 'json'])
|
|
58
|
-
.conflicts('changed', 'changed-since')
|
|
59
|
-
.option('short', {
|
|
60
|
-
alias: 's',
|
|
61
|
-
describe: 'Do not show extended information',
|
|
62
|
-
type: 'boolean',
|
|
63
|
-
})
|
|
64
|
-
.option('parseable', {
|
|
65
|
-
alias: 'p',
|
|
66
|
-
describe: 'Show parseable output',
|
|
67
|
-
type: 'boolean',
|
|
68
|
-
})
|
|
69
|
-
.option('toposort', {
|
|
70
|
-
alias: 't',
|
|
71
|
-
describe: 'Sort packages in topological order (dependencies before dependents) instead of lexical by directory',
|
|
72
|
-
type: 'boolean',
|
|
73
|
-
})
|
|
74
|
-
.option('graph', {
|
|
75
|
-
alias: 'g',
|
|
76
|
-
describe: 'Show dependency graph as a JSON-formatted adjacency list',
|
|
77
|
-
type: 'boolean',
|
|
78
|
-
})
|
|
79
|
-
.option('json', {
|
|
80
|
-
alias: 'j',
|
|
81
|
-
describe: 'Show output in JSON format',
|
|
82
|
-
type: 'boolean',
|
|
83
|
-
})
|
|
84
|
-
.option('changed', {
|
|
85
|
-
alias: 'c',
|
|
86
|
-
describe: 'Only list packages that have changed since the last publish (dirty or committed but not yet published)',
|
|
87
|
-
type: 'boolean',
|
|
88
|
-
})
|
|
89
|
-
.option('changed-since', {
|
|
90
|
-
describe: 'Only list packages that have changed since the given git commit/hash',
|
|
91
|
-
type: 'string',
|
|
92
|
-
}),
|
|
93
|
-
handler: async (args) => {
|
|
94
|
-
const items = await ListService.getPackages(repository, {
|
|
95
|
-
...readPackageFilterOptions(args),
|
|
96
|
-
toposort: args.toposort,
|
|
97
|
-
changed: args.changed,
|
|
98
|
-
changedSince: args.changedSince,
|
|
99
|
-
});
|
|
100
|
-
if (args.graph)
|
|
101
|
-
printGraph(items);
|
|
102
|
-
else if (args.json)
|
|
103
|
-
console.log(JSON.stringify(items, undefined, 2));
|
|
104
|
-
else if (args.parseable)
|
|
105
|
-
printParseable(items);
|
|
106
|
-
else if (args.short)
|
|
107
|
-
for (const it of items)
|
|
108
|
-
console.log(it.name);
|
|
109
|
-
else
|
|
110
|
-
printTable(items);
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { RmanApplication } from '../core/application.js';
|
|
2
|
+
import { type RmanConfig } from '../interfaces/rman-config.interface.js';
|
|
3
|
+
import type { DockerPublishOptions } from '../targets/docker.target.js';
|
|
4
|
+
/** Hoisted for `ArgsOf` - see `version.command.ts` and `RmanConfig.ArgsOf` for why. */
|
|
5
|
+
declare const COMMAND: "publish";
|
|
6
|
+
/**
|
|
7
|
+
* **The options that belong to publishing, rather than to any one registry.**
|
|
8
|
+
*
|
|
9
|
+
* Everything npm-shaped that used to sit beside them - `--access`, `--tag`, `--otp`, `--registry`,
|
|
10
|
+
* `--userconfig`, `--contents`, `--package-manager` - is declared by the `npm` target now, and
|
|
11
|
+
* `--docker-namespace` by the `docker` one. They are merged in at build time (see below), so
|
|
12
|
+
* `rman publish --help` lists exactly the flags the targets this repository actually has.
|
|
13
|
+
*/
|
|
14
|
+
declare const config: {
|
|
15
|
+
yes: {
|
|
16
|
+
target: "cli";
|
|
17
|
+
alias: string;
|
|
18
|
+
describe: string;
|
|
19
|
+
type: "boolean";
|
|
20
|
+
};
|
|
21
|
+
dryRun: {
|
|
22
|
+
target: "cli";
|
|
23
|
+
cliName: string;
|
|
24
|
+
describe: string;
|
|
25
|
+
type: "boolean";
|
|
26
|
+
};
|
|
27
|
+
json: {
|
|
28
|
+
target: "cli";
|
|
29
|
+
alias: string;
|
|
30
|
+
describe: string;
|
|
31
|
+
type: "boolean";
|
|
32
|
+
};
|
|
33
|
+
ignoreDirty: {
|
|
34
|
+
target: "cli";
|
|
35
|
+
cliName: string;
|
|
36
|
+
describe: string;
|
|
37
|
+
type: "boolean";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* `target: 'both'` because it is genuinely both: `--target docker` for one run, `publish.target`
|
|
41
|
+
* in a `.rmanrc` for a package's standing answer. Its `choices` cannot be written here - which
|
|
42
|
+
* targets exist is whatever the repository's plugins contribute - so they are filled in from the
|
|
43
|
+
* registry where the command is built.
|
|
44
|
+
*/
|
|
45
|
+
target: {
|
|
46
|
+
target: "both";
|
|
47
|
+
describe: string;
|
|
48
|
+
type: "array";
|
|
49
|
+
};
|
|
50
|
+
skip: {
|
|
51
|
+
target: "config";
|
|
52
|
+
describe: string;
|
|
53
|
+
type: "boolean";
|
|
54
|
+
};
|
|
55
|
+
allowBranch: {
|
|
56
|
+
target: "cli";
|
|
57
|
+
cliName: string;
|
|
58
|
+
describe: string;
|
|
59
|
+
type: "string";
|
|
60
|
+
};
|
|
61
|
+
ignoreBranch: {
|
|
62
|
+
target: "cli";
|
|
63
|
+
cliName: string;
|
|
64
|
+
describe: string;
|
|
65
|
+
type: "string";
|
|
66
|
+
};
|
|
67
|
+
scope: {
|
|
68
|
+
target: "cli";
|
|
69
|
+
describe: string;
|
|
70
|
+
type: "string";
|
|
71
|
+
};
|
|
72
|
+
ignore: {
|
|
73
|
+
target: "cli";
|
|
74
|
+
describe: string;
|
|
75
|
+
type: "string";
|
|
76
|
+
};
|
|
77
|
+
platform: {
|
|
78
|
+
target: "cli";
|
|
79
|
+
describe: string;
|
|
80
|
+
type: "string";
|
|
81
|
+
};
|
|
82
|
+
deps: {
|
|
83
|
+
target: "cli";
|
|
84
|
+
describe: string;
|
|
85
|
+
type: "boolean";
|
|
86
|
+
};
|
|
87
|
+
dependents: {
|
|
88
|
+
target: "cli";
|
|
89
|
+
describe: string;
|
|
90
|
+
type: "boolean";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The rest of `publish.*`: **one block per target, contributed by the target**.
|
|
95
|
+
*
|
|
96
|
+
* `PublishTargetConfigs` is an empty interface on purpose - an extension point rather than a list.
|
|
97
|
+
* `docker` below is the core's own target declaring its block; `rman-node` adds `directory` from
|
|
98
|
+
* its own package the same way. Neither could be written here: which targets exist is whatever the
|
|
99
|
+
* repository's plugins contribute.
|
|
100
|
+
*
|
|
101
|
+
* **It had to be a slot, not two declarations of `publish`.** A key that arrives from two places is
|
|
102
|
+
* `Interface 'RmanConfig' cannot simultaneously extend types ... Named property 'publish' of types
|
|
103
|
+
* ... are not identical` (measured) - so `publish` is contributed once, here, and everything under
|
|
104
|
+
* it merges into this one interface first.
|
|
105
|
+
*/
|
|
106
|
+
export interface PublishExtraKeys extends PublishTargetConfigs {
|
|
107
|
+
}
|
|
108
|
+
/** Where a target declares its own `publish.<target>` config block. Augmented, never edited. */
|
|
109
|
+
export interface PublishTargetConfigs {
|
|
110
|
+
/** Required once `"docker"` is one of a package's `publish.target`s - `publish --target docker`
|
|
111
|
+
* errors clearly on a package that opts in here but leaves this out. */
|
|
112
|
+
docker?: DockerPublishOptions;
|
|
113
|
+
}
|
|
114
|
+
type Args = RmanConfig.ArgsOf<typeof config, typeof COMMAND>;
|
|
115
|
+
/**
|
|
116
|
+
* `rman publish` - the repository's half of question B: which packages' current version is not out
|
|
117
|
+
* there yet, and pushing the ones that are not.
|
|
118
|
+
*
|
|
119
|
+
* **This was `rman-node`'s command until the targets became contributions**, and that had the
|
|
120
|
+
* ownership backwards. Everything here is about a repository - which packages are candidates, what
|
|
121
|
+
* order to push them in (dependencies first), the plan/confirm/apply shape, `--dry-run`, the JSON a
|
|
122
|
+
* CI gate reads - and none of it is npm's. What *is* npm's is one answer to "is this version on the
|
|
123
|
+
* registry, and how do I push it", which is `PublishTarget`. The measured consequence of the old
|
|
124
|
+
* arrangement: `publish --target docker` in a repository with no JavaScript in it required
|
|
125
|
+
* installing a Node plugin to reach a Docker push the core had implemented all along.
|
|
126
|
+
*
|
|
127
|
+
* Never looks at whether `version` ran - it inspects what is on disk and on each registry, so it
|
|
128
|
+
* behaves the same right after a bump or days later, and re-running is safe.
|
|
129
|
+
*/
|
|
130
|
+
declare const publishCommand: (app: RmanApplication) => {
|
|
131
|
+
command: "publish";
|
|
132
|
+
describe: string;
|
|
133
|
+
/** `group` is not read here, but `allowBranch`/`ignoreBranch` are - through the shared
|
|
134
|
+
* branch-guard group, which only exposes them as flags. */
|
|
135
|
+
configKeys: string[];
|
|
136
|
+
config: {
|
|
137
|
+
/** Filled in from the registry: `--target` can only offer what this repository installed. */
|
|
138
|
+
target: {
|
|
139
|
+
choices: string[];
|
|
140
|
+
target: "both";
|
|
141
|
+
describe: string;
|
|
142
|
+
type: "array";
|
|
143
|
+
};
|
|
144
|
+
yes: {
|
|
145
|
+
target: "cli";
|
|
146
|
+
alias: string;
|
|
147
|
+
describe: string;
|
|
148
|
+
type: "boolean";
|
|
149
|
+
};
|
|
150
|
+
dryRun: {
|
|
151
|
+
target: "cli";
|
|
152
|
+
cliName: string;
|
|
153
|
+
describe: string;
|
|
154
|
+
type: "boolean";
|
|
155
|
+
};
|
|
156
|
+
json: {
|
|
157
|
+
target: "cli";
|
|
158
|
+
alias: string;
|
|
159
|
+
describe: string;
|
|
160
|
+
type: "boolean";
|
|
161
|
+
};
|
|
162
|
+
ignoreDirty: {
|
|
163
|
+
target: "cli";
|
|
164
|
+
cliName: string;
|
|
165
|
+
describe: string;
|
|
166
|
+
type: "boolean";
|
|
167
|
+
};
|
|
168
|
+
skip: {
|
|
169
|
+
target: "config";
|
|
170
|
+
describe: string;
|
|
171
|
+
type: "boolean";
|
|
172
|
+
};
|
|
173
|
+
allowBranch: {
|
|
174
|
+
target: "cli";
|
|
175
|
+
cliName: string;
|
|
176
|
+
describe: string;
|
|
177
|
+
type: "string";
|
|
178
|
+
};
|
|
179
|
+
ignoreBranch: {
|
|
180
|
+
target: "cli";
|
|
181
|
+
cliName: string;
|
|
182
|
+
describe: string;
|
|
183
|
+
type: "string";
|
|
184
|
+
};
|
|
185
|
+
scope: {
|
|
186
|
+
target: "cli";
|
|
187
|
+
describe: string;
|
|
188
|
+
type: "string";
|
|
189
|
+
};
|
|
190
|
+
ignore: {
|
|
191
|
+
target: "cli";
|
|
192
|
+
describe: string;
|
|
193
|
+
type: "string";
|
|
194
|
+
};
|
|
195
|
+
platform: {
|
|
196
|
+
target: "cli";
|
|
197
|
+
describe: string;
|
|
198
|
+
type: "string";
|
|
199
|
+
};
|
|
200
|
+
deps: {
|
|
201
|
+
target: "cli";
|
|
202
|
+
describe: string;
|
|
203
|
+
type: "boolean";
|
|
204
|
+
};
|
|
205
|
+
dependents: {
|
|
206
|
+
target: "cli";
|
|
207
|
+
describe: string;
|
|
208
|
+
type: "boolean";
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
examples: {
|
|
212
|
+
command: string;
|
|
213
|
+
description: string;
|
|
214
|
+
}[];
|
|
215
|
+
handler: (args: Args) => Promise<void>;
|
|
216
|
+
};
|
|
217
|
+
export default publishCommand;
|
|
218
|
+
/**
|
|
219
|
+
* `publish`'s own keys on `RmanConfig`: `target` and `skip` derived from the `config` block, plus
|
|
220
|
+
* every target's own block through `PublishExtraKeys`.
|
|
221
|
+
*
|
|
222
|
+
* So a target contributes its config type as well as its flags now - `publish.docker.*` is declared
|
|
223
|
+
* by the core's docker target and `publish.npm.directory` by `rman-node`'s npm one, each from its own
|
|
224
|
+
* package, and neither can collide with the other or with what the command derives.
|
|
225
|
+
*/
|
|
226
|
+
declare module '../interfaces/rman-config.interface.js' {
|
|
227
|
+
namespace RmanConfig {
|
|
228
|
+
interface CommandConfigs extends RmanConfig.CommandContribution<ReturnType<typeof publishCommand>, PublishExtraKeys> {
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|