@stealthscale/tool-cli 0.1.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/README.md +20 -0
- package/dist/bin/stealth.d.mts +1 -0
- package/dist/bin/stealth.mjs +11 -0
- package/dist/cli-DC07sdDR.mjs +37 -0
- package/dist/command-DHNo5e1V.mjs +2 -0
- package/dist/command-wCHt33VW.mjs +740 -0
- package/dist/index.d.mts +513 -0
- package/dist/index.mjs +3 -0
- package/package.json +56 -0
- package/src/bin/stealth.ts +11 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import { CommandDef, CommandMeta } from "citty";
|
|
2
|
+
import { Manifest } from "@stealthscale/tool-workspace";
|
|
3
|
+
//#region src/cli.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Reads what a command calls itself off the manifest of the package that ships it, so the
|
|
6
|
+
* name, the summary and the version have one source.
|
|
7
|
+
*
|
|
8
|
+
* @param {Manifest} manifest - The manifest of the package that ships the bin.
|
|
9
|
+
* @returns {CommandMeta} The first command the manifest installs, its summary and its version.
|
|
10
|
+
*/
|
|
11
|
+
declare function commandMeta(manifest: Manifest): CommandMeta;
|
|
12
|
+
/**
|
|
13
|
+
* The `stealth` command: the bin's name, its own version, and the subcommands under it.
|
|
14
|
+
*/
|
|
15
|
+
declare const stealth: CommandDef;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/release/changesets.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* Describes one published package, in the shape changesets/action reads. Every field is
|
|
20
|
+
* theirs, `type` included, and an entry it does not recognise it skips.
|
|
21
|
+
*/
|
|
22
|
+
interface TagEvent {
|
|
23
|
+
/**
|
|
24
|
+
* Names the package the tag belongs to.
|
|
25
|
+
*/
|
|
26
|
+
packageName: string;
|
|
27
|
+
/**
|
|
28
|
+
* Names the tag to create: `<name>@<version>`, which is what changesets tags a package
|
|
29
|
+
* in a workspace of several.
|
|
30
|
+
*/
|
|
31
|
+
tag: string;
|
|
32
|
+
/**
|
|
33
|
+
* Marks the entry as a tag. It is the only kind the action reads.
|
|
34
|
+
*/
|
|
35
|
+
type: 'git-tag';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Builds the entry for one published package.
|
|
39
|
+
*
|
|
40
|
+
* @param {Manifest} manifest - The package that went out.
|
|
41
|
+
* @returns {TagEvent} The entry, naming the package and its tag.
|
|
42
|
+
*/
|
|
43
|
+
declare function tagEvent(manifest: Manifest): TagEvent;
|
|
44
|
+
/**
|
|
45
|
+
* Writes the entries where changesets/action reads them, one JSON object per line.
|
|
46
|
+
*
|
|
47
|
+
* A run that published nothing still writes the file, empty. The action reports a file it
|
|
48
|
+
* cannot read as a warning and then creates no tag for anything, so an empty file and a
|
|
49
|
+
* missing one differ.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} file - The path the action handed the run, from `CHANGESETS_OUTPUT`.
|
|
52
|
+
* @param {readonly TagEvent[]} events - One entry per published package.
|
|
53
|
+
*/
|
|
54
|
+
declare function writeTagEvents(file: string, events: readonly TagEvent[]): void;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/shell/shell.d.ts
|
|
57
|
+
/**
|
|
58
|
+
* @fileoverview Runs the commands the `stealth` tool needs: bun, npm and a registry, as real
|
|
59
|
+
* processes that the tool owns. A specification hands the tool a shell that records instead.
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Describes what a finished command left behind.
|
|
63
|
+
*/
|
|
64
|
+
interface CommandOutcome {
|
|
65
|
+
/**
|
|
66
|
+
* Carries the exit code. It is `1` when the command could not start or a signal killed it.
|
|
67
|
+
*/
|
|
68
|
+
code: number;
|
|
69
|
+
/**
|
|
70
|
+
* Carries everything the command wrote to stderr.
|
|
71
|
+
*/
|
|
72
|
+
stderr: string;
|
|
73
|
+
/**
|
|
74
|
+
* Carries everything the command wrote to stdout.
|
|
75
|
+
*/
|
|
76
|
+
stdout: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Describes where a command runs and what it sees.
|
|
80
|
+
*/
|
|
81
|
+
interface RunOptions {
|
|
82
|
+
/**
|
|
83
|
+
* Names the working directory.
|
|
84
|
+
*/
|
|
85
|
+
cwd: string;
|
|
86
|
+
/**
|
|
87
|
+
* Adds variables to this process's environment for the command.
|
|
88
|
+
*/
|
|
89
|
+
env?: Readonly<Record<string, string>> | undefined;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Describes where a long-lived process runs and where its output goes.
|
|
93
|
+
*/
|
|
94
|
+
interface StartOptions extends RunOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Names the file its stdout and stderr are appended to.
|
|
97
|
+
*/
|
|
98
|
+
log: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Describes a process the tool started and so may stop.
|
|
102
|
+
*/
|
|
103
|
+
interface StartedProcess {
|
|
104
|
+
/**
|
|
105
|
+
* Carries the process id, so the tool stops exactly what it started. It is `0` when the
|
|
106
|
+
* process never started.
|
|
107
|
+
*/
|
|
108
|
+
pid: number;
|
|
109
|
+
/**
|
|
110
|
+
* Ends the process and resolves once it has exited.
|
|
111
|
+
*
|
|
112
|
+
* It sends `SIGTERM` first and gives the process five seconds to leave on its own, then
|
|
113
|
+
* sends `SIGKILL`, so a child that traps the first signal cannot hold the tool open. It
|
|
114
|
+
* resolves after the exit either way, and closing the log file is part of that exit.
|
|
115
|
+
*
|
|
116
|
+
* @returns {Promise<void>} Resolves after the exit.
|
|
117
|
+
*/
|
|
118
|
+
stop: () => Promise<void>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Describes how the tool runs commands. A specification hands one that answers.
|
|
122
|
+
*/
|
|
123
|
+
interface Shell {
|
|
124
|
+
/**
|
|
125
|
+
* Finds a port nothing is listening on right now.
|
|
126
|
+
*
|
|
127
|
+
* @returns {Promise<number>} A port that was free when asked.
|
|
128
|
+
*/
|
|
129
|
+
freePort: () => Promise<number>;
|
|
130
|
+
/**
|
|
131
|
+
* Runs a command to completion and returns what it wrote. A non-zero exit does not throw.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} file - The executable.
|
|
134
|
+
* @param {readonly string[]} args - The arguments.
|
|
135
|
+
* @param {RunOptions} options - The working directory and the environment.
|
|
136
|
+
* @returns {Promise<CommandOutcome>} The exit code and both streams.
|
|
137
|
+
*/
|
|
138
|
+
run: (file: string, args: readonly string[], options: RunOptions) => Promise<CommandOutcome>;
|
|
139
|
+
/**
|
|
140
|
+
* Starts a long-lived process. Its output goes to the log file.
|
|
141
|
+
*
|
|
142
|
+
* @param {string} file - The executable.
|
|
143
|
+
* @param {readonly string[]} args - The arguments.
|
|
144
|
+
* @param {StartOptions} options - The working directory, the environment and the log file.
|
|
145
|
+
* @returns {StartedProcess} The process, with its pid and a way to stop it.
|
|
146
|
+
*/
|
|
147
|
+
start: (file: string, args: readonly string[], options: StartOptions) => StartedProcess;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Builds the shell the tool runs under: real processes and real ports. `start` returns the
|
|
151
|
+
* very process it spawned, so `stop` never reaches a process somebody else owns.
|
|
152
|
+
*
|
|
153
|
+
* @returns {Shell} A shell backed by real processes and real ports.
|
|
154
|
+
*/
|
|
155
|
+
declare function shell(): Shell;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/release/command.d.ts
|
|
158
|
+
/**
|
|
159
|
+
* What `stealth release` takes from the command line.
|
|
160
|
+
*
|
|
161
|
+
* The registry and the token are absent by default: npm reads its own configuration, and a
|
|
162
|
+
* manifest's `publishConfig` overrides it per package. Naming either here is for a run that
|
|
163
|
+
* publishes somewhere else, such as a local registry in a smoke test.
|
|
164
|
+
*/
|
|
165
|
+
declare const RELEASE_ARGS: {
|
|
166
|
+
readonly 'dry-run': {
|
|
167
|
+
readonly default: false;
|
|
168
|
+
readonly description: 'Report what would be published, and publish nothing.';
|
|
169
|
+
readonly type: 'boolean';
|
|
170
|
+
};
|
|
171
|
+
readonly provenance: {
|
|
172
|
+
readonly default: false;
|
|
173
|
+
readonly description: "Attest provenance through the CI job's token. Npm refuses it elsewhere.";
|
|
174
|
+
readonly type: 'boolean';
|
|
175
|
+
};
|
|
176
|
+
readonly registry: {
|
|
177
|
+
readonly description: 'Publish to this registry instead of the one npm is configured for.';
|
|
178
|
+
readonly type: 'string';
|
|
179
|
+
readonly valueHint: 'url';
|
|
180
|
+
};
|
|
181
|
+
readonly tarballs: {
|
|
182
|
+
readonly description: 'Write the tarballs here instead of a new temporary directory.';
|
|
183
|
+
readonly type: 'string';
|
|
184
|
+
readonly valueHint: 'dir';
|
|
185
|
+
};
|
|
186
|
+
readonly userconfig: {
|
|
187
|
+
readonly description: "Read npm's configuration, and so the token, from this file.";
|
|
188
|
+
readonly type: 'string';
|
|
189
|
+
readonly valueHint: 'file';
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Describes everything the release command reaches outside itself.
|
|
194
|
+
*/
|
|
195
|
+
interface ReleaseDeps {
|
|
196
|
+
/**
|
|
197
|
+
* Names the file changesets/action reads the published tags from, which it hands the run
|
|
198
|
+
* in `CHANGESETS_OUTPUT`. Outside that action there is nothing to tell and nothing here.
|
|
199
|
+
*/
|
|
200
|
+
changesetsOutput: string | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Names the directory the command was run in, which is where the workspace is looked for.
|
|
203
|
+
*/
|
|
204
|
+
cwd: string;
|
|
205
|
+
/**
|
|
206
|
+
* Asks a registry what it already holds.
|
|
207
|
+
*/
|
|
208
|
+
fetch: typeof fetch;
|
|
209
|
+
/**
|
|
210
|
+
* Writes the report where a person reads it. Whatever it answers is not read, so a stream's
|
|
211
|
+
* own `write` is passed straight in.
|
|
212
|
+
*/
|
|
213
|
+
log: (text: string) => unknown;
|
|
214
|
+
/**
|
|
215
|
+
* Runs bun and npm.
|
|
216
|
+
*/
|
|
217
|
+
shell: Shell;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Builds the release command against the outside world it is given.
|
|
221
|
+
*
|
|
222
|
+
* @param {ReleaseDeps} deps - The workspace, the registry, the shell and where to write.
|
|
223
|
+
* @returns {CommandDef} The command, ready to hand to citty.
|
|
224
|
+
*/
|
|
225
|
+
declare function releaseCommandWith(deps: ReleaseDeps): CommandDef<typeof RELEASE_ARGS>;
|
|
226
|
+
/**
|
|
227
|
+
* The release command as the `stealth` bin runs it: this process, the real registry, a real
|
|
228
|
+
* shell and the terminal.
|
|
229
|
+
*/
|
|
230
|
+
declare const releaseCommand: CommandDef<{
|
|
231
|
+
readonly 'dry-run': {
|
|
232
|
+
readonly default: false;
|
|
233
|
+
readonly description: 'Report what would be published, and publish nothing.';
|
|
234
|
+
readonly type: 'boolean';
|
|
235
|
+
};
|
|
236
|
+
readonly provenance: {
|
|
237
|
+
readonly default: false;
|
|
238
|
+
readonly description: "Attest provenance through the CI job's token. Npm refuses it elsewhere.";
|
|
239
|
+
readonly type: 'boolean';
|
|
240
|
+
};
|
|
241
|
+
readonly registry: {
|
|
242
|
+
readonly description: 'Publish to this registry instead of the one npm is configured for.';
|
|
243
|
+
readonly type: 'string';
|
|
244
|
+
readonly valueHint: 'url';
|
|
245
|
+
};
|
|
246
|
+
readonly tarballs: {
|
|
247
|
+
readonly description: 'Write the tarballs here instead of a new temporary directory.';
|
|
248
|
+
readonly type: 'string';
|
|
249
|
+
readonly valueHint: 'dir';
|
|
250
|
+
};
|
|
251
|
+
readonly userconfig: {
|
|
252
|
+
readonly description: "Read npm's configuration, and so the token, from this file.";
|
|
253
|
+
readonly type: 'string';
|
|
254
|
+
readonly valueHint: 'file';
|
|
255
|
+
};
|
|
256
|
+
}>;
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/report/report.d.ts
|
|
259
|
+
/**
|
|
260
|
+
* @fileoverview Records what a run of the tool did, step by step, and renders it for a
|
|
261
|
+
* terminal: one line per step, the reason under a failure, and where the run's files are.
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* Describes one thing a run did, and how it went.
|
|
265
|
+
*/
|
|
266
|
+
interface Step {
|
|
267
|
+
/**
|
|
268
|
+
* Carries what was found or what went wrong. It is empty when there is nothing to add.
|
|
269
|
+
*/
|
|
270
|
+
detail: string;
|
|
271
|
+
/**
|
|
272
|
+
* Names the stage and its subject: `publish @stealthscale/core-schema@0.1.0`.
|
|
273
|
+
*/
|
|
274
|
+
name: string;
|
|
275
|
+
/**
|
|
276
|
+
* Marks whether the step went as it should.
|
|
277
|
+
*/
|
|
278
|
+
ok: boolean;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Describes everything a run did, in order, and where its files are.
|
|
282
|
+
*/
|
|
283
|
+
interface Report {
|
|
284
|
+
/**
|
|
285
|
+
* Lists the steps in the order they ran.
|
|
286
|
+
*/
|
|
287
|
+
steps: readonly Step[];
|
|
288
|
+
/**
|
|
289
|
+
* Names the directory that holds the run's tarballs and logs, kept for reading after a
|
|
290
|
+
* failure.
|
|
291
|
+
*/
|
|
292
|
+
workdir: string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Builds a step that went as it should.
|
|
296
|
+
*
|
|
297
|
+
* @param {string} name - The stage and its subject.
|
|
298
|
+
* @param {string} [detail] - Text worth reading even so, such as a checker's warnings.
|
|
299
|
+
* Default: nothing.
|
|
300
|
+
* @returns {Step} The step.
|
|
301
|
+
*/
|
|
302
|
+
declare function passed(name: string, detail?: string): Step;
|
|
303
|
+
/**
|
|
304
|
+
* Builds a step that did not go as it should.
|
|
305
|
+
*
|
|
306
|
+
* @param {string} name - The stage and its subject.
|
|
307
|
+
* @param {string} detail - The reason: the command's last lines, or what was found wanting.
|
|
308
|
+
* @returns {Step} The step.
|
|
309
|
+
*/
|
|
310
|
+
declare function failed(name: string, detail: string): Step;
|
|
311
|
+
/**
|
|
312
|
+
* Lists the steps of a run that failed.
|
|
313
|
+
*
|
|
314
|
+
* @param {Report} report - The run.
|
|
315
|
+
* @returns {Step[]} The failed steps, in order.
|
|
316
|
+
*/
|
|
317
|
+
declare function failures(report: Report): Step[];
|
|
318
|
+
/**
|
|
319
|
+
* Keeps the end of what a command wrote, which is where the reason usually is. Stack frames
|
|
320
|
+
* go first: a bundler's failure is one line of cause over thirty lines of frames.
|
|
321
|
+
*
|
|
322
|
+
* @param {string} output - Everything the command wrote, both streams together.
|
|
323
|
+
* @param {number} [keep] - How many lines to keep at most. Default: 20.
|
|
324
|
+
* @returns {string} The last lines, with blank lines at either end dropped.
|
|
325
|
+
*/
|
|
326
|
+
declare function lastLines(output: string, keep?: number): string;
|
|
327
|
+
/**
|
|
328
|
+
* Renders a report as text: one line per step, a step's detail indented under it, then the
|
|
329
|
+
* count and, when something failed, where to look.
|
|
330
|
+
*
|
|
331
|
+
* @param {Report} report - The run.
|
|
332
|
+
* @returns {string} The text, ending in a newline.
|
|
333
|
+
*/
|
|
334
|
+
declare function render(report: Report): string;
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/release/packages.d.ts
|
|
337
|
+
/**
|
|
338
|
+
* Describes a package that was packed, and where its tarball is.
|
|
339
|
+
*/
|
|
340
|
+
interface Packed {
|
|
341
|
+
/**
|
|
342
|
+
* Carries the package's manifest.
|
|
343
|
+
*/
|
|
344
|
+
manifest: Manifest;
|
|
345
|
+
/**
|
|
346
|
+
* Names the tarball, absolute.
|
|
347
|
+
*/
|
|
348
|
+
tarball: string;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Describes how one tarball is published.
|
|
352
|
+
*/
|
|
353
|
+
interface PublishOptions {
|
|
354
|
+
/**
|
|
355
|
+
* Says what would be published, and publishes nothing.
|
|
356
|
+
*/
|
|
357
|
+
dryRun: boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Attests provenance through the CI job's OIDC token. Npm refuses it outside a CI it
|
|
360
|
+
* knows.
|
|
361
|
+
*/
|
|
362
|
+
provenance: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Names the registry to ask and to publish to, with or without its trailing slash. Left
|
|
365
|
+
* out, npm is asked in the directory the publish runs in for the registry it is configured
|
|
366
|
+
* for. A manifest's `publishConfig.registry` wins over both, because npm reads it from the
|
|
367
|
+
* tarball.
|
|
368
|
+
*/
|
|
369
|
+
registry?: string | undefined;
|
|
370
|
+
/**
|
|
371
|
+
* Names an npm user config that holds the registry's token. Without one, npm uses its own
|
|
372
|
+
* login or the CI's OIDC token.
|
|
373
|
+
*/
|
|
374
|
+
userconfig?: string | undefined;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Describes what packing one package came to.
|
|
378
|
+
*/
|
|
379
|
+
interface PackResult {
|
|
380
|
+
/**
|
|
381
|
+
* Carries the tarball, when bun wrote one.
|
|
382
|
+
*/
|
|
383
|
+
packed?: Packed | undefined;
|
|
384
|
+
/**
|
|
385
|
+
* Carries the step, with the tarball's path or bun's last lines as its detail.
|
|
386
|
+
*/
|
|
387
|
+
step: Step;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Lists the paths a manifest's `files` names that are missing from the package. A glob
|
|
391
|
+
* entry names no one path and is not checked; a manifest without `files` names nothing.
|
|
392
|
+
*
|
|
393
|
+
* @param {Manifest} manifest - The package to check.
|
|
394
|
+
* @returns {string[]} The missing paths, relative to the package, in `files` order.
|
|
395
|
+
*/
|
|
396
|
+
declare function missingFiles(manifest: Manifest): string[];
|
|
397
|
+
/**
|
|
398
|
+
* Packs one built package into the destination directory.
|
|
399
|
+
*
|
|
400
|
+
* @param {Manifest} manifest - The package to pack.
|
|
401
|
+
* @param {string} destination - The directory the tarball goes into.
|
|
402
|
+
* @param {Shell} shell - The shell that runs bun.
|
|
403
|
+
* @param {ReadonlyMap<string, string>} [versions] - Each workspace package mapped to the
|
|
404
|
+
* version it is being published at. Default: none, leaving every range as written.
|
|
405
|
+
* @returns {Promise<PackResult>} The step, and the tarball when there is one.
|
|
406
|
+
*/
|
|
407
|
+
declare function pack(manifest: Manifest, destination: string, shell: Shell, versions?: ReadonlyMap<string, string>): Promise<PackResult>;
|
|
408
|
+
/**
|
|
409
|
+
* Publishes one tarball with npm. The token, when there is one, travels in a user config
|
|
410
|
+
* file npm is pointed at, so nothing else npm reads is touched.
|
|
411
|
+
*
|
|
412
|
+
* The run's registry is passed on the command line rather than the manifest's. Npm reads
|
|
413
|
+
* `publishConfig.registry` out of the tarball and lets it win over the flag, which is the
|
|
414
|
+
* rule the asking side applies as well.
|
|
415
|
+
*
|
|
416
|
+
* @param {string} tarball - The tarball to publish, absolute.
|
|
417
|
+
* @param {string} cwd - The directory npm runs in.
|
|
418
|
+
* @param {PublishOptions} options - How to publish. `PublishOptions` documents every member.
|
|
419
|
+
* @param {Shell} shell - The shell that runs npm.
|
|
420
|
+
* @returns {Promise<CommandOutcome>} Npm's exit code and both streams.
|
|
421
|
+
*/
|
|
422
|
+
declare function publishTarball(tarball: string, cwd: string, options: PublishOptions, shell: Shell): Promise<CommandOutcome>;
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/release/registry.d.ts
|
|
425
|
+
/**
|
|
426
|
+
* Ends a registry URL with the slash bun and npm write.
|
|
427
|
+
*
|
|
428
|
+
* @param {string} url - The registry as npm or a manifest names it.
|
|
429
|
+
* @returns {string} The URL with exactly one trailing slash.
|
|
430
|
+
*/
|
|
431
|
+
declare function withTrailingSlash(url: string): string;
|
|
432
|
+
/**
|
|
433
|
+
* Asks npm for the registry it is configured to publish to.
|
|
434
|
+
*
|
|
435
|
+
* Ask this in the directory the publish will run in. Npm reads its configuration, and the
|
|
436
|
+
* manifest beside it, from where it runs, so asking anywhere else can name a registry the
|
|
437
|
+
* publish will not use, and asking in a workspace whose manifest names another package
|
|
438
|
+
* manager makes npm refuse outright.
|
|
439
|
+
*
|
|
440
|
+
* @param {Shell} shell - The shell that runs npm.
|
|
441
|
+
* @param {string} cwd - The directory the publish will run in.
|
|
442
|
+
* @returns {Promise<string>} The registry, with its trailing slash.
|
|
443
|
+
* @throws {Error} When npm names no registry.
|
|
444
|
+
*/
|
|
445
|
+
declare function configuredRegistry(shell: Shell, cwd: string): Promise<string>;
|
|
446
|
+
/**
|
|
447
|
+
* Returns `true` when the registry already holds this version of the package.
|
|
448
|
+
*
|
|
449
|
+
* @param {string} registry - The registry, with its trailing slash.
|
|
450
|
+
* @param {Manifest} manifest - The package to ask about.
|
|
451
|
+
* @param {typeof fetch} fetchImpl - The fetch that asks the registry.
|
|
452
|
+
* @returns {Promise<boolean>} `true` when that exact version is there.
|
|
453
|
+
* @throws {Error} When the registry answers with anything but the package or a 404.
|
|
454
|
+
*/
|
|
455
|
+
declare function registryHasVersion(registry: string, manifest: Manifest, fetchImpl: typeof fetch): Promise<boolean>;
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/release/release.d.ts
|
|
458
|
+
/**
|
|
459
|
+
* Describes what the release set came to.
|
|
460
|
+
*/
|
|
461
|
+
interface ReleaseSet {
|
|
462
|
+
/**
|
|
463
|
+
* Lists the private packages the set depends on, which a consumer could never install.
|
|
464
|
+
*/
|
|
465
|
+
hidden: string[];
|
|
466
|
+
/**
|
|
467
|
+
* Lists the public packages, dependencies before their dependents.
|
|
468
|
+
*/
|
|
469
|
+
ordered: Manifest[];
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Describes what a release run is told. `PublishOptions` documents the members it inherits,
|
|
473
|
+
* the registry among them.
|
|
474
|
+
*/
|
|
475
|
+
interface ReleaseOptions extends PublishOptions {
|
|
476
|
+
/**
|
|
477
|
+
* Names the file changesets/action reads the published tags from, as it handed it over in
|
|
478
|
+
* `CHANGESETS_OUTPUT`. Left out, a run tells nothing and no tag is created.
|
|
479
|
+
*/
|
|
480
|
+
changesetsOutput?: string | undefined;
|
|
481
|
+
/**
|
|
482
|
+
* Asks the registry whether it has a version already.
|
|
483
|
+
*/
|
|
484
|
+
fetch: typeof fetch;
|
|
485
|
+
/**
|
|
486
|
+
* Names the workspace root.
|
|
487
|
+
*/
|
|
488
|
+
root: string;
|
|
489
|
+
/**
|
|
490
|
+
* Names the directory the tarballs go into.
|
|
491
|
+
*/
|
|
492
|
+
tarballs: string;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Collects the release set: every public package of the workspace and every workspace
|
|
496
|
+
* package it depends on, dependencies before dependents.
|
|
497
|
+
*
|
|
498
|
+
* @param {string} root - The workspace root.
|
|
499
|
+
* @returns {ReleaseSet} The set, and the private packages it would need and cannot have.
|
|
500
|
+
*/
|
|
501
|
+
declare function releaseSet(root: string): ReleaseSet;
|
|
502
|
+
/**
|
|
503
|
+
* Releases every package of the set the registry does not have yet, packed and published in
|
|
504
|
+
* dependency order. It refuses the whole set when the set depends on a private package.
|
|
505
|
+
*
|
|
506
|
+
* @param {ReleaseOptions} options - The registry, how to publish, the workspace and where
|
|
507
|
+
* the tarballs go.
|
|
508
|
+
* @param {Shell} shell - The shell that runs bun and npm.
|
|
509
|
+
* @returns {Promise<Report>} Every step, in order.
|
|
510
|
+
*/
|
|
511
|
+
declare function release(options: ReleaseOptions, shell: Shell): Promise<Report>;
|
|
512
|
+
//#endregion
|
|
513
|
+
export { type CommandOutcome, type PackResult, type Packed, type PublishOptions, type ReleaseDeps, type ReleaseOptions, type ReleaseSet, type Report, type RunOptions, type Shell, type StartOptions, type StartedProcess, type Step, type TagEvent, commandMeta, configuredRegistry, failed, failures, lastLines, missingFiles, pack, passed, publishTarball, registryHasVersion, release, releaseCommand, releaseCommandWith, releaseSet, render, shell, stealth, tagEvent, withTrailingSlash, writeTagEvents };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { n as stealth, t as commandMeta } from "./cli-DC07sdDR.mjs";
|
|
2
|
+
import { _ as tagEvent, a as configuredRegistry, c as missingFiles, d as shell, f as failed, g as render, h as passed, i as releaseSet, l as pack, m as lastLines, n as releaseCommandWith, o as registryHasVersion, p as failures, r as release, s as withTrailingSlash, t as releaseCommand, u as publishTarball, v as writeTagEvents } from "./command-wCHt33VW.mjs";
|
|
3
|
+
export { commandMeta, configuredRegistry, failed, failures, lastLines, missingFiles, pack, passed, publishTarball, registryHasVersion, release, releaseCommand, releaseCommandWith, releaseSet, render, shell, stealth, tagEvent, withTrailingSlash, writeTagEvents };
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stealthscale/tool-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Ships the stealth command, and publishes a workspace's public packages in dependency order.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/stealth-scale/tooling.git",
|
|
9
|
+
"directory": "tools/cli"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"stealth": "./src/bin/stealth.ts"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"imports": {
|
|
20
|
+
"#*": "./src/*"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"tooling-source": "./src/index.ts",
|
|
25
|
+
"default": "./dist/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./bin/stealth": {
|
|
28
|
+
"tooling-source": "./src/bin/stealth.ts",
|
|
29
|
+
"default": "./dist/bin/stealth.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"bin": {
|
|
35
|
+
"stealth": "./dist/bin/stealth.mjs"
|
|
36
|
+
},
|
|
37
|
+
"exports": {
|
|
38
|
+
".": "./dist/index.mjs",
|
|
39
|
+
"./bin/stealth": "./dist/bin/stealth.mjs",
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "vp pack src/index.ts src/bin/stealth.ts"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@stealthscale/core-schema": "^0.1.0",
|
|
49
|
+
"@stealthscale/tool-workspace": "^0.1.0",
|
|
50
|
+
"citty": "~0.2.2"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@stealthscale/tool-config": "^0.1.0",
|
|
54
|
+
"@stealthscale/tool-testing": "^0.1.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview The `stealth` bin. It hands the command to citty and does nothing else, so
|
|
4
|
+
* everything worth a specification lives beside it rather than in an entry a build rewrites.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { runMain } from 'citty'
|
|
8
|
+
|
|
9
|
+
import { stealth } from '#cli.ts'
|
|
10
|
+
|
|
11
|
+
await runMain(stealth)
|