@marinoscar/platform-cli 0.1.0-next.15 → 0.1.0-next.17
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/CHANGELOG.md +26 -0
- package/README.md +33 -2
- package/dist/engine/create-cli.d.ts +50 -1
- package/dist/engine/create-cli.d.ts.map +1 -1
- package/dist/engine/create-cli.js +10 -1
- package/dist/engine/create-cli.js.map +1 -1
- package/dist/engine/deploy/app-version.d.ts +62 -6
- package/dist/engine/deploy/app-version.d.ts.map +1 -1
- package/dist/engine/deploy/app-version.js +123 -11
- package/dist/engine/deploy/app-version.js.map +1 -1
- package/dist/engine/deploy/version-step.d.ts +9 -0
- package/dist/engine/deploy/version-step.d.ts.map +1 -1
- package/dist/engine/deploy/version-step.js +4 -3
- package/dist/engine/deploy/version-step.js.map +1 -1
- package/dist/engine/github-raw-manifest.d.ts +59 -0
- package/dist/engine/github-raw-manifest.d.ts.map +1 -0
- package/dist/engine/github-raw-manifest.js +197 -0
- package/dist/engine/github-raw-manifest.js.map +1 -0
- package/dist/engine/index.d.ts +5 -1
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +3 -0
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/program.d.ts +3 -0
- package/dist/engine/program.d.ts.map +1 -1
- package/dist/engine/program.js +16 -0
- package/dist/engine/program.js.map +1 -1
- package/dist/engine/registries.d.ts.map +1 -1
- package/dist/engine/registries.js +4 -0
- package/dist/engine/registries.js.map +1 -1
- package/dist/engine/semver.d.ts +31 -0
- package/dist/engine/semver.d.ts.map +1 -0
- package/dist/engine/semver.js +100 -0
- package/dist/engine/semver.js.map +1 -0
- package/dist/engine/update-notice-options.d.ts +70 -0
- package/dist/engine/update-notice-options.d.ts.map +1 -0
- package/dist/engine/update-notice-options.js +79 -0
- package/dist/engine/update-notice-options.js.map +1 -0
- package/dist/engine/update-notice.d.ts +69 -0
- package/dist/engine/update-notice.d.ts.map +1 -0
- package/dist/engine/update-notice.js +204 -0
- package/dist/engine/update-notice.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @marinoscar/platform-cli
|
|
2
2
|
|
|
3
|
+
## 0.1.0-next.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 331eee4: The CLI can tell the operator a newer version exists. `createCli({ updateNotice: { latestVersion, upgradeHint, intervalMs?, timeoutMs? } })` (type `UpdateNoticeOptions`, experimental) checks when the CLI starts and, when the newest version is semver-greater than the running one, writes one line to stderr after the command's output: `<cli> <latest> is available (you have <current>). Update: <upgradeHint>`. Operators ran an old app CLI on servers without knowing a newer one had fixed the failure in front of them.
|
|
8
|
+
|
|
9
|
+
Unset means off: an app that does not pass the option makes no request and is unchanged. The check starts in parallel with the command and is never awaited before it; at the end the CLI waits only for what remains of `timeoutMs` (default 1500 ms from the start). At most one network check per `intervalMs` (default 24 hours), cached in `~/.<cli>/update-check.json` (`{ checkedAt, latest }`, written atomically with mode 0600; a missing or corrupt file is a new check; a failed check is recorded with the last known version, so an offline server does not retry on every command). Failure, timeout, a throwing or hanging `latestVersion` and any version that is not strict semver 2.0.0 (prereleases ordered by the spec) are silent, and the exit code and stdout never change. The interactive menu shows the line once, when it exits.
|
|
10
|
+
|
|
11
|
+
Never shown: when `CI` is set, when stderr is not a terminal, for `--json`, `--version`/`-v`, `--help`/`-h` and `help`, for the worker daemon `node start`, or when `<PREFIX>_NO_UPDATE_CHECK=1` is set (`APPCTL_NO_UPDATE_CHECK`, the prefix from the CLI identity). `createCli` validates the option (a `latestVersion` function, a non-empty single-line `upgradeHint`, a non-negative `intervalMs`, a positive `timeoutMs`) and throws a `UsageError` otherwise. `RunOptions` gains `updateCheck` (environment, home directory, stderr and clock) as a test seam.
|
|
12
|
+
|
|
13
|
+
New helper `githubRawManifest({ repo, ref = 'main', path, timeoutMs = 1500, fetch? })` builds a `latestVersion` that reads `version` from `https://raw.githubusercontent.com/<repo>/<ref>/<path>`: HTTPS only, no credentials, no redirects, the body capped at 256 KiB, only a valid semver `version` accepted, everything else `undefined`; `repo` must be `owner/name` and `ref` / `path` plain relative paths (a `UsageError` when it is built). `latestVersion` receives an `AbortSignal` that `createCli` aborts at the deadline. Docs: the CLI README (options table, a section and the extension-point catalog), `docs/EXTENDING.md` and the reference app's example `coach.update-notice.ts` (not wired).
|
|
14
|
+
|
|
15
|
+
- @marinoscar/platform-contract@0.1.0-next.17
|
|
16
|
+
- @marinoscar/platform-infra@0.1.0-next.17
|
|
17
|
+
|
|
18
|
+
## 0.1.0-next.16
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- bdf831e: An app now chooses which manifests the deploy `version` step writes: `createCli({ deploy: { versionedManifests } })` (type `CreateCliDeployOptions`). The list was closed (`apps/api`, `apps/web`, `apps/cli`, `packages/shared`), so an app whose CLI keeps its own version had it overwritten by every release; a production `chore(release): 1.2.3` moved such a CLI from 1.10.7 to 1.2.3. Default: the same four, so an app that does not set the option is unchanged.
|
|
23
|
+
|
|
24
|
+
The first listed manifest is the version source: `currentVersion` reads it (so the suggested patch bump and the forward-only check follow it), `writeVersion` writes only the listed manifests, and the `package-lock.json` workspace update touches only the listed workspaces, textually and in the same single commit as before. A manifest left out and its lockfile entry are byte for byte untouched, and the step's journal line now names the files it wrote (`wrote 1.2.3 to apps/api/package.json, ..., package-lock.json and committed`) instead of a count. The list is validated when the CLI is built: at least one entry, repository-relative POSIX paths ending in `package.json` under a directory, no `..`, no duplicates, no root manifest; `createCli` throws a `UsageError` otherwise. `runVersionStep` also takes an optional `manifests` for a caller that holds its own list. Docs: the CLI README, the deploy README, `docs/specs/vps-deploy.md`, `docs/EXTENDING.md` and a new runbook section, "An app whose CLI keeps its own version".
|
|
25
|
+
|
|
26
|
+
- @marinoscar/platform-contract@0.1.0-next.16
|
|
27
|
+
- @marinoscar/platform-infra@0.1.0-next.16
|
|
28
|
+
|
|
3
29
|
## 0.1.0-next.15
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -84,8 +84,37 @@ void main();
|
|
|
84
84
|
| `deploySteps` | `DeployStepRegistration[]` | `[]` | Steps inserted into `deploy install` / `update`. Same as `registerDeployStep`. |
|
|
85
85
|
| `nodeExecutors` | `JobExecutor[]` | `[]` | Executors for the app's node-eligible job types. Same as `registerNodeExecutor`. |
|
|
86
86
|
| `envSpecFragments` | `EnvSpecFragment[]` | `[]` | Metadata for the app's `.env.example` keys. Same as `registerEnvSpecFragment`. |
|
|
87
|
+
| `deploy.versionedManifests` | `string[]` | the four of the reference layout | The manifests the deploy `version` step reads and writes: repository-relative POSIX paths ending in `package.json` (`apps/api/package.json`). **The first is the version source.** Only these manifests and their `package-lock.json` workspace entries change; an app whose CLI keeps its own version leaves `apps/cli/package.json` out. Validated at `createCli`: at least one, no `..`, no duplicates, no root manifest. |
|
|
88
|
+
| `updateNotice` | `{ latestVersion, upgradeHint, intervalMs?, timeoutMs? }` | unset (no check) | The [start-up update notice](#the-start-up-update-notice): `latestVersion(signal?)` returns the newest version or `undefined` (use `githubRawManifest({ repo, ref?, path })` to read a `package.json` on GitHub), `upgradeHint` is the text after `Update:` (one line, non-empty), `intervalMs` is the least time between network checks (default 24 hours), `timeoutMs` the longest the end of a command waits for the answer (default 1500). Validated at `createCli`. |
|
|
87
89
|
|
|
88
|
-
The options and the `register*` functions feed the same registries: string ids, a duplicate-id error, a deterministic order (built-ins first, then registration order), and frozen when `createCli` returns, so a late registration throws instead of going missing. A broken composition (a taken command name, TUI route, deploy step id, check id, env group or generator kind or executor type; a step anchored on an unknown step; an env key with two owners; an invalid stream path or edge-config path) throws at `createCli`. The newer options are `envGroups`, `envGenerators`, `envAnnotations`, `deployChecks`, `edgeConfigFiles`, `tuiSections
|
|
90
|
+
The options and the `register*` functions feed the same registries: string ids, a duplicate-id error, a deterministic order (built-ins first, then registration order), and frozen when `createCli` returns, so a late registration throws instead of going missing. A broken composition (a taken command name, TUI route, deploy step id, check id, env group or generator kind or executor type; a step anchored on an unknown step; an env key with two owners; an invalid stream path or edge-config path) throws at `createCli`. The newer options are `envGroups`, `envGenerators`, `envAnnotations`, `deployChecks`, `edgeConfigFiles`, `tuiSections`, `proxy: { streamPaths }`, `deploy: { versionedManifests }` and `updateNotice`. A bad `deploy.versionedManifests` (empty, a duplicate, `..`, an entry that does not end in `package.json`) or a bad `updateNotice` (no `latestVersion`, an empty or multi-line `upgradeHint`, a negative `intervalMs`, a non-positive `timeoutMs`) throws at `createCli` too.
|
|
91
|
+
|
|
92
|
+
### The start-up update notice
|
|
93
|
+
|
|
94
|
+
Operators run an old app CLI on a server without knowing a newer one exists. With `createCli({ updateNotice })` the CLI checks when it starts and, if the newest version is semver-greater than the running one, writes one line to stderr after the command's output:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
appctl 1.11.0 is available (you have 1.10.7). Update: git pull && npm ci && npm run build
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { createCli, githubRawManifest } from '@marinoscar/platform-cli';
|
|
102
|
+
|
|
103
|
+
createCli({
|
|
104
|
+
...APP_CLI_OPTIONS,
|
|
105
|
+
updateNotice: {
|
|
106
|
+
latestVersion: githubRawManifest({ repo: 'owner/name', ref: 'main', path: 'apps/cli/package.json' }),
|
|
107
|
+
upgradeHint: 'git pull && npm ci && npm run build',
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- **Unset means off.** An app that does not pass `updateNotice` makes no request, reads no file and prints nothing.
|
|
113
|
+
- **At most one network check per `intervalMs` (24 hours).** The answer is cached in `~/.<name>/update-check.json` (`{ "checkedAt": "<ISO time>", "latest": "<version>" }`, written atomically with mode 0600; a missing or corrupt file just means a new check). A failed check is recorded too, keeping the last known version, so an offline server does not retry on every command. Within the interval the notice comes from the cache, with no network.
|
|
114
|
+
- **Never in the command's way.** The check starts before the command and runs beside it. After the command, the CLI waits for what remains of `timeoutMs` (counted from the start, so a command longer than that waits for nothing), then stores the answer. Failure, timeout, a throwing or hanging `latestVersion` and a version that is not valid semver are silent. The exit code and stdout never change, and only the one stderr line is written. The interactive menu shows the line when it exits, after the terminal is restored.
|
|
115
|
+
- **Never shown** when `CI` (or `CONTINUOUS_INTEGRATION`) is set; when stderr is not a terminal; for `--json`, `--version`/`-v`, `--help`/`-h` and `help`; for the worker daemon `node start` (every form: `--headless`, `--daemon`, the systemd unit); or when the operator sets `<PREFIX>_NO_UPDATE_CHECK=1` (`APPCTL_NO_UPDATE_CHECK`; the prefix is the CLI identity's `envPrefix`). The other `node` commands and `deploy` check normally.
|
|
116
|
+
- **`githubRawManifest({ repo, ref = 'main', path, timeoutMs = 1500 })`** reads `https://raw.githubusercontent.com/<repo>/<ref>/<path>`: HTTPS only, no credentials (a private repository answers 404 and stays silent), no redirects, a body capped at 256 KiB, and only a valid semver `version` accepted. It never throws at run time; `repo` must be `owner/name` and `ref`/`path` plain relative paths, or it throws a `UsageError` when it is built. Any other source is a function returning the version.
|
|
117
|
+
- **The latest version is proven before it is printed**: the network value and the cache file are both parsed as strict semver 2.0.0 (prereleases order correctly: `1.2.3` is newer than `1.2.3-rc.1`, not the reverse).
|
|
89
118
|
|
|
90
119
|
## Extension-point catalog
|
|
91
120
|
|
|
@@ -94,6 +123,8 @@ The extension ladder and a recipe per extension: [docs/EXTENDING.md](../../docs/
|
|
|
94
123
|
| Name | Kind | Signature | When to use | Stability | Example |
|
|
95
124
|
|---|---|---|---|---|---|
|
|
96
125
|
| `CreateCliOptions` | option | `createCli(options: CreateCliOptions): CliInstance` | Build the app's CLI: its identity and version, plus its commands, TUI screens, deploy steps, node executors and env-spec fragments | experimental | [example](../../apps/cli/src/app.ts) |
|
|
126
|
+
| `CreateCliDeployOptions` | option | `createCli({ deploy: { versionedManifests?: readonly string[] } })` | Choose the workspace manifests the deploy `version` step writes (default `apps/api`, `apps/web`, `apps/cli`, `packages/shared`); an app whose CLI keeps its own version leaves `apps/cli` out. The first entry is the version source | experimental | [example](../../apps/cli/src/examples/coach.versioned-manifests.ts) |
|
|
127
|
+
| `UpdateNoticeOptions` | option | `createCli({ updateNotice?: { latestVersion: (signal?: AbortSignal) => Promise<string \| undefined>; upgradeHint: string; intervalMs?: number; timeoutMs?: number } })` | Tell the operator, with one stderr line after the command, that a newer version of the CLI exists (cached for 24 hours, silent on any failure, never in CI or for `--json` / `--version` / the worker daemon). Read the version from a GitHub manifest with `githubRawManifest` | experimental | [example](../../apps/cli/src/examples/coach.update-notice.ts) |
|
|
97
128
|
|
|
98
129
|
The registries are catalogued by the entry point that exports them, each with a compiled, tested example in the reference app:
|
|
99
130
|
|
|
@@ -126,7 +157,7 @@ None of its own. Every command acts with the permissions of the token `login` st
|
|
|
126
157
|
|
|
127
158
|
## UI
|
|
128
159
|
|
|
129
|
-
None in the web app. In a terminal: the ink TUI (`menu`, `login`, `invoke`, `status`, `node`, `deploy`, `logout`, plus the app's registered screens), opened only by a bare invocation in a real terminal (`<NAME>_NO_TUI` disables it).
|
|
160
|
+
None in the web app. In a terminal: the ink TUI (`menu`, `login`, `invoke`, `status`, `node`, `deploy`, `logout`, plus the app's registered screens), opened only by a bare invocation in a real terminal (`<NAME>_NO_TUI` disables it). `<NAME>_NO_UPDATE_CHECK=1` turns the [update notice](#the-start-up-update-notice) off.
|
|
130
161
|
|
|
131
162
|
## Infra
|
|
132
163
|
|
|
@@ -9,6 +9,7 @@ import type { JobExecutor } from './node/executors/index.js';
|
|
|
9
9
|
import { type RunOptions } from './program.js';
|
|
10
10
|
import { type TuiScreenRegistration } from './tui/screen-registry.js';
|
|
11
11
|
import { type TuiSectionRegistration } from './tui/section-registry.js';
|
|
12
|
+
import { type UpdateNoticeOptions } from './update-notice-options.js';
|
|
12
13
|
/**
|
|
13
14
|
* The app's view of the VPS host proxy, for {@link CreateCliOptions}.
|
|
14
15
|
*
|
|
@@ -22,6 +23,39 @@ export interface CreateCliProxyOptions {
|
|
|
22
23
|
*/
|
|
23
24
|
streamPaths?: ReadonlyArray<string | ProxyStreamPathRegistration> | undefined;
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* What the app decides about `deploy install` / `deploy update` beyond the
|
|
28
|
+
* registries, for {@link CreateCliOptions}.
|
|
29
|
+
*
|
|
30
|
+
* @stability experimental
|
|
31
|
+
* @extensionPoint option
|
|
32
|
+
*/
|
|
33
|
+
export interface CreateCliDeployOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The workspace manifests the deploy's version step reads and writes, as
|
|
36
|
+
* repository-relative POSIX paths ending in `package.json`
|
|
37
|
+
* (`['apps/api/package.json', 'apps/web/package.json']`). Default: the four
|
|
38
|
+
* of the reference layout (`apps/api`, `apps/web`, `apps/cli`,
|
|
39
|
+
* `packages/shared`), so an app that does not set it is unchanged.
|
|
40
|
+
*
|
|
41
|
+
* THE FIRST ENTRY IS THE VERSION SOURCE: the current release version is read
|
|
42
|
+
* from it, and the suggested bump starts there. The step writes the new
|
|
43
|
+
* version only into the listed manifests and only into the `package-lock.json`
|
|
44
|
+
* workspace entries of those same paths; a workspace left out (an app whose
|
|
45
|
+
* CLI keeps its own version leaves out `apps/cli/package.json`) keeps its
|
|
46
|
+
* version and its lockfile entry byte for byte.
|
|
47
|
+
*
|
|
48
|
+
* Validated at `createCli`: at least one entry, each a relative path under a
|
|
49
|
+
* directory ending in `package.json` (the root manifest is not supported),
|
|
50
|
+
* no `..`, no duplicates.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* createCli({ ...APP_CLI_OPTIONS, deploy: { versionedManifests: ['apps/api/package.json', 'apps/web/package.json', 'packages/shared/package.json'] } });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
versionedManifests?: readonly string[] | undefined;
|
|
58
|
+
}
|
|
25
59
|
/**
|
|
26
60
|
* Options of {@link createCli}: the app's identity and version, and what it
|
|
27
61
|
* adds through the CLI's registries.
|
|
@@ -62,6 +96,18 @@ export interface CreateCliOptions {
|
|
|
62
96
|
* `registerProxyStreamPath`.
|
|
63
97
|
*/
|
|
64
98
|
proxy?: CreateCliProxyOptions | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* What `deploy install` / `deploy update` need to know about the app that
|
|
101
|
+
* the registries do not carry. `versionedManifests` chooses the manifests
|
|
102
|
+
* the version step writes.
|
|
103
|
+
*/
|
|
104
|
+
deploy?: CreateCliDeployOptions | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* The start-up update notice: when a newer version of this CLI exists, one
|
|
107
|
+
* line on stderr after the command's output. Unset means no check. See
|
|
108
|
+
* {@link UpdateNoticeOptions} and `githubRawManifest`.
|
|
109
|
+
*/
|
|
110
|
+
updateNotice?: UpdateNoticeOptions | undefined;
|
|
65
111
|
}
|
|
66
112
|
/**
|
|
67
113
|
* What {@link createCli} returns.
|
|
@@ -84,7 +130,10 @@ export interface CliInstance {
|
|
|
84
130
|
* @param options - The identity, the app version and the app's additions.
|
|
85
131
|
* @returns The program and its `run`.
|
|
86
132
|
* @throws Error when the identity is invalid or a different one is already
|
|
87
|
-
* set, when
|
|
133
|
+
* set, when `deploy.versionedManifests` is empty, not a list of relative
|
|
134
|
+
* `package.json` paths, or has a duplicate, when `updateNotice` has no
|
|
135
|
+
* `latestVersion` function, an empty or multi-line `upgradeHint`, or a bad
|
|
136
|
+
* `intervalMs` / `timeoutMs`, when an app command's name, TUI route, deploy step id or executor
|
|
88
137
|
* type is taken (or a step's `after` names no step), when an env key gets
|
|
89
138
|
* two owners, or when it registers anything after an earlier `createCli`
|
|
90
139
|
* froze the registries.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-cli.d.ts","sourceRoot":"","sources":["../../src/engine/create-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC1C;;;;OAIG;IACH,MAAM,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC5C;;;;OAIG;IACH,YAAY,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAChD;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,iGAAiG;IACjG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW,CA4BhE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerCliCommand, annotateEnvKey, registerEnvGenerator, registerEnvGroup, registerEnvSpecFragment, } from '../core/index.js';
|
|
2
2
|
import { ensurePlatformRegistrations } from './builtin-registrations.js';
|
|
3
|
+
import { setVersionedManifests } from './deploy/app-version.js';
|
|
3
4
|
import { registerEdgeConfigFile } from './deploy/edge-config.js';
|
|
4
5
|
import { registerDeployCheck } from './deploy/checks/registry.js';
|
|
5
6
|
import { registerProxyStreamPath } from './deploy/proxy-streams.js';
|
|
@@ -10,13 +11,17 @@ import { buildProgram, run } from './program.js';
|
|
|
10
11
|
import { freezeCliRegistries } from './registries.js';
|
|
11
12
|
import { registerTuiScreen } from './tui/screen-registry.js';
|
|
12
13
|
import { registerTuiScreenSection } from './tui/section-registry.js';
|
|
14
|
+
import { setUpdateNotice } from './update-notice-options.js';
|
|
13
15
|
/**
|
|
14
16
|
* Builds the CLI from the app's identity and additions plus the registries.
|
|
15
17
|
*
|
|
16
18
|
* @param options - The identity, the app version and the app's additions.
|
|
17
19
|
* @returns The program and its `run`.
|
|
18
20
|
* @throws Error when the identity is invalid or a different one is already
|
|
19
|
-
* set, when
|
|
21
|
+
* set, when `deploy.versionedManifests` is empty, not a list of relative
|
|
22
|
+
* `package.json` paths, or has a duplicate, when `updateNotice` has no
|
|
23
|
+
* `latestVersion` function, an empty or multi-line `upgradeHint`, or a bad
|
|
24
|
+
* `intervalMs` / `timeoutMs`, when an app command's name, TUI route, deploy step id or executor
|
|
20
25
|
* type is taken (or a step's `after` names no step), when an env key gets
|
|
21
26
|
* two owners, or when it registers anything after an earlier `createCli`
|
|
22
27
|
* froze the registries.
|
|
@@ -24,6 +29,10 @@ import { registerTuiScreenSection } from './tui/section-registry.js';
|
|
|
24
29
|
*/
|
|
25
30
|
export function createCli(options) {
|
|
26
31
|
setCliIdentity(options.identity, options.version);
|
|
32
|
+
// Validated first of the additions: a bad list throws here, before anything
|
|
33
|
+
// is registered, and the default is restored when the app sets none.
|
|
34
|
+
setVersionedManifests(options.deploy?.versionedManifests);
|
|
35
|
+
setUpdateNotice(options.updateNotice);
|
|
27
36
|
ensurePlatformRegistrations();
|
|
28
37
|
for (const generator of options.envGenerators ?? [])
|
|
29
38
|
registerEnvGenerator(generator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-cli.js","sourceRoot":"","sources":["../../src/engine/create-cli.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,GAMxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAuB,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAoB,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAoC,MAAM,2BAA2B,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAA+B,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAoB,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,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AC3E,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,eAAe,IAAI,EAAE;QAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC/E,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,WAAW,IAAI,EAAE;QAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACvE,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,aAAa,IAAI,EAAE;QAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACnF,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,WAAW,IAAI,EAAE;QAAE,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnF,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,mBAAmB,CAAC,yBAAyB,CAAC,CAAC;IAC/C,OAAO;QACL,OAAO;QACP,GAAG,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,52 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The manifests the version step reads and writes when an app does not choose:
|
|
3
|
+
* the four workspaces that move in lockstep with the release.
|
|
4
|
+
*
|
|
5
|
+
* An app overrides the list with `createCli({ deploy: { versionedManifests } })`
|
|
6
|
+
* (an app whose CLI keeps its own version leaves `apps/cli` out). This constant
|
|
7
|
+
* is the DEFAULT, not the list in force: read the list in force through
|
|
8
|
+
* {@link versionedManifests}.
|
|
9
|
+
*/
|
|
2
10
|
export declare const VERSIONED_MANIFESTS: readonly ["apps/api/package.json", "apps/web/package.json", "apps/cli/package.json", "packages/shared/package.json"];
|
|
11
|
+
/**
|
|
12
|
+
* Throws unless `list` is a usable list of versioned manifests.
|
|
13
|
+
*
|
|
14
|
+
* The rules, each with the failure it prevents:
|
|
15
|
+
* - non-empty: an empty list would make the version step a silent no-op that
|
|
16
|
+
* still commits and stamps a version nobody wrote;
|
|
17
|
+
* - relative POSIX paths whose last segment is `package.json`, under a
|
|
18
|
+
* directory (the root manifest is not supported: its lockfile entry is the
|
|
19
|
+
* empty key and the textual edit is keyed on a workspace path);
|
|
20
|
+
* - no `..` or `.` segments, no empty segments, no backslashes: the path is
|
|
21
|
+
* also the lockfile's workspace key and a `git add` argument;
|
|
22
|
+
* - no duplicates: a duplicate is written twice and staged twice.
|
|
23
|
+
*
|
|
24
|
+
* @param list - The candidate list.
|
|
25
|
+
* @throws UsageError naming the entry and the rule it broke.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function assertValidVersionedManifests(list: readonly string[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the manifests the version step uses for this process; `createCli` calls
|
|
31
|
+
* it with `options.deploy?.versionedManifests`. `undefined` restores the
|
|
32
|
+
* default ({@link VERSIONED_MANIFESTS}).
|
|
33
|
+
*
|
|
34
|
+
* @param list - The manifests, validated by {@link assertValidVersionedManifests}.
|
|
35
|
+
* @throws UsageError on an invalid list; nothing is changed then.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function setVersionedManifests(list: readonly string[] | undefined): void;
|
|
39
|
+
/** Restores the default list. Tests only (`resetCliForTests` calls it). */
|
|
40
|
+
export declare function resetVersionedManifestsForTests(): void;
|
|
41
|
+
/**
|
|
42
|
+
* The manifests in force: the app's `deploy.versionedManifests`, else the
|
|
43
|
+
* default four. THE FIRST ENTRY IS THE VERSION SOURCE: {@link currentVersion}
|
|
44
|
+
* reads the release version from it (falling through to later entries only
|
|
45
|
+
* when it is absent or carries no version).
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare function versionedManifests(): readonly string[];
|
|
3
50
|
export interface SemVer {
|
|
4
51
|
major: number;
|
|
5
52
|
minor: number;
|
|
@@ -9,8 +56,14 @@ export declare function parseSemVer(value: string): SemVer | undefined;
|
|
|
9
56
|
/** Negative when `a` sorts below `b`. */
|
|
10
57
|
export declare function compareSemVer(a: SemVer, b: SemVer): number;
|
|
11
58
|
export declare function formatSemVer(version: SemVer): string;
|
|
12
|
-
/**
|
|
13
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The clone's current version, read from the FIRST listed manifest (the
|
|
61
|
+
* version source); a later one answers only when the first is absent or has no
|
|
62
|
+
* version. A manifest the app left out of the list is never read.
|
|
63
|
+
*
|
|
64
|
+
* @param manifests - The list to use; defaults to {@link versionedManifests}.
|
|
65
|
+
*/
|
|
66
|
+
export declare function currentVersion(checkoutPath: string, manifests?: readonly string[]): string;
|
|
14
67
|
/** The patch bump offered to the operator. */
|
|
15
68
|
export declare function suggestNext(current: string): string;
|
|
16
69
|
/**
|
|
@@ -36,12 +89,15 @@ export interface VersionWriteResult {
|
|
|
36
89
|
* matched by their own path key, so an unrelated dependency that happens to be
|
|
37
90
|
* at the same version is never touched.
|
|
38
91
|
*/
|
|
39
|
-
export declare function writeVersion(checkoutPath: string, version: string): VersionWriteResult;
|
|
92
|
+
export declare function writeVersion(checkoutPath: string, version: string, manifests?: readonly string[]): VersionWriteResult;
|
|
40
93
|
/**
|
|
41
|
-
* Rewrites each workspace
|
|
94
|
+
* Rewrites the `version` of each LISTED workspace's entry in the lockfile; a
|
|
95
|
+
* workspace the app did not list keeps its entry byte for byte.
|
|
42
96
|
*
|
|
43
97
|
* Keyed on the workspace PATH (`"apps/api": {`), so this can never touch a
|
|
44
98
|
* dependency that merely happens to share a version string.
|
|
99
|
+
*
|
|
100
|
+
* @param manifests - The list to use; defaults to {@link versionedManifests}.
|
|
45
101
|
*/
|
|
46
|
-
export declare function updateLockfile(raw: string, version: string): string;
|
|
102
|
+
export declare function updateLockfile(raw: string, version: string, manifests?: readonly string[]): string;
|
|
47
103
|
//# sourceMappingURL=app-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-version.d.ts","sourceRoot":"","sources":["../../../src/engine/deploy/app-version.ts"],"names":[],"mapp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AAM,EAAE,CAAC;IAClB,wDAAwD;IACxD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAC5B,kBAAkB,CAqFpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAelG"}
|
|
@@ -45,13 +45,115 @@
|
|
|
45
45
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
46
46
|
import { join } from 'node:path';
|
|
47
47
|
import { UsageError } from '../errors.js';
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The manifests the version step reads and writes when an app does not choose:
|
|
50
|
+
* the four workspaces that move in lockstep with the release.
|
|
51
|
+
*
|
|
52
|
+
* An app overrides the list with `createCli({ deploy: { versionedManifests } })`
|
|
53
|
+
* (an app whose CLI keeps its own version leaves `apps/cli` out). This constant
|
|
54
|
+
* is the DEFAULT, not the list in force: read the list in force through
|
|
55
|
+
* {@link versionedManifests}.
|
|
56
|
+
*/
|
|
49
57
|
export const VERSIONED_MANIFESTS = [
|
|
50
58
|
'apps/api/package.json',
|
|
51
59
|
'apps/web/package.json',
|
|
52
60
|
'apps/cli/package.json',
|
|
53
61
|
'packages/shared/package.json',
|
|
54
62
|
];
|
|
63
|
+
/** One path segment of a manifest path: no separators, no whitespace, no regex-hostile surprises. */
|
|
64
|
+
const MANIFEST_SEGMENT = /^[A-Za-z0-9._@+-]+$/;
|
|
65
|
+
/**
|
|
66
|
+
* Throws unless `list` is a usable list of versioned manifests.
|
|
67
|
+
*
|
|
68
|
+
* The rules, each with the failure it prevents:
|
|
69
|
+
* - non-empty: an empty list would make the version step a silent no-op that
|
|
70
|
+
* still commits and stamps a version nobody wrote;
|
|
71
|
+
* - relative POSIX paths whose last segment is `package.json`, under a
|
|
72
|
+
* directory (the root manifest is not supported: its lockfile entry is the
|
|
73
|
+
* empty key and the textual edit is keyed on a workspace path);
|
|
74
|
+
* - no `..` or `.` segments, no empty segments, no backslashes: the path is
|
|
75
|
+
* also the lockfile's workspace key and a `git add` argument;
|
|
76
|
+
* - no duplicates: a duplicate is written twice and staged twice.
|
|
77
|
+
*
|
|
78
|
+
* @param list - The candidate list.
|
|
79
|
+
* @throws UsageError naming the entry and the rule it broke.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
export function assertValidVersionedManifests(list) {
|
|
83
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
84
|
+
throw new UsageError('deploy.versionedManifests must list at least one manifest (for example "apps/api/package.json").');
|
|
85
|
+
}
|
|
86
|
+
const seen = new Set();
|
|
87
|
+
for (const entry of list) {
|
|
88
|
+
if (typeof entry !== 'string' || entry === '') {
|
|
89
|
+
throw new UsageError('deploy.versionedManifests entries must be non-empty strings.');
|
|
90
|
+
}
|
|
91
|
+
const shown = JSON.stringify(entry);
|
|
92
|
+
if (entry.startsWith('/') || /^[A-Za-z]:/.test(entry)) {
|
|
93
|
+
throw new UsageError(`deploy.versionedManifests entry ${shown} must be a path relative to the repository root.`);
|
|
94
|
+
}
|
|
95
|
+
if (entry.includes('\\')) {
|
|
96
|
+
throw new UsageError(`deploy.versionedManifests entry ${shown} must use "/" separators.`);
|
|
97
|
+
}
|
|
98
|
+
const segments = entry.split('/');
|
|
99
|
+
if (segments.includes('..')) {
|
|
100
|
+
throw new UsageError(`deploy.versionedManifests entry ${shown} must not contain "..".`);
|
|
101
|
+
}
|
|
102
|
+
if (segments.some((segment) => segment === '.' || segment === '' || !MANIFEST_SEGMENT.test(segment))) {
|
|
103
|
+
throw new UsageError(`deploy.versionedManifests entry ${shown} must be a plain relative path such as "apps/api/package.json".`);
|
|
104
|
+
}
|
|
105
|
+
if (segments[segments.length - 1] !== 'package.json') {
|
|
106
|
+
throw new UsageError(`deploy.versionedManifests entry ${shown} must end in "package.json".`);
|
|
107
|
+
}
|
|
108
|
+
if (segments.length < 2) {
|
|
109
|
+
throw new UsageError(`deploy.versionedManifests entry ${shown} is the root manifest, which is not supported; name a workspace manifest such as "apps/api/package.json".`);
|
|
110
|
+
}
|
|
111
|
+
if (seen.has(entry)) {
|
|
112
|
+
throw new UsageError(`deploy.versionedManifests lists ${shown} more than once.`);
|
|
113
|
+
}
|
|
114
|
+
seen.add(entry);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
let configuredManifests;
|
|
118
|
+
/**
|
|
119
|
+
* Sets the manifests the version step uses for this process; `createCli` calls
|
|
120
|
+
* it with `options.deploy?.versionedManifests`. `undefined` restores the
|
|
121
|
+
* default ({@link VERSIONED_MANIFESTS}).
|
|
122
|
+
*
|
|
123
|
+
* @param list - The manifests, validated by {@link assertValidVersionedManifests}.
|
|
124
|
+
* @throws UsageError on an invalid list; nothing is changed then.
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
export function setVersionedManifests(list) {
|
|
128
|
+
if (list === undefined) {
|
|
129
|
+
configuredManifests = undefined;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
assertValidVersionedManifests(list);
|
|
133
|
+
configuredManifests = Object.freeze([...list]);
|
|
134
|
+
}
|
|
135
|
+
/** Restores the default list. Tests only (`resetCliForTests` calls it). */
|
|
136
|
+
export function resetVersionedManifestsForTests() {
|
|
137
|
+
configuredManifests = undefined;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The manifests in force: the app's `deploy.versionedManifests`, else the
|
|
141
|
+
* default four. THE FIRST ENTRY IS THE VERSION SOURCE: {@link currentVersion}
|
|
142
|
+
* reads the release version from it (falling through to later entries only
|
|
143
|
+
* when it is absent or carries no version).
|
|
144
|
+
*
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
export function versionedManifests() {
|
|
148
|
+
return configuredManifests ?? VERSIONED_MANIFESTS;
|
|
149
|
+
}
|
|
150
|
+
/** An explicit list (validated) or the one in force. */
|
|
151
|
+
function resolveManifests(explicit) {
|
|
152
|
+
if (explicit === undefined)
|
|
153
|
+
return versionedManifests();
|
|
154
|
+
assertValidVersionedManifests(explicit);
|
|
155
|
+
return explicit;
|
|
156
|
+
}
|
|
55
157
|
const SEMVER = /^(\d+)\.(\d+)\.(\d+)$/;
|
|
56
158
|
export function parseSemVer(value) {
|
|
57
159
|
const match = SEMVER.exec(value.trim());
|
|
@@ -89,9 +191,15 @@ function parseManifest(raw) {
|
|
|
89
191
|
return undefined;
|
|
90
192
|
}
|
|
91
193
|
}
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
194
|
+
/**
|
|
195
|
+
* The clone's current version, read from the FIRST listed manifest (the
|
|
196
|
+
* version source); a later one answers only when the first is absent or has no
|
|
197
|
+
* version. A manifest the app left out of the list is never read.
|
|
198
|
+
*
|
|
199
|
+
* @param manifests - The list to use; defaults to {@link versionedManifests}.
|
|
200
|
+
*/
|
|
201
|
+
export function currentVersion(checkoutPath, manifests) {
|
|
202
|
+
for (const relative of resolveManifests(manifests)) {
|
|
95
203
|
try {
|
|
96
204
|
const manifest = JSON.parse(readFileSync(join(checkoutPath, relative), 'utf8'));
|
|
97
205
|
if (typeof manifest.version === 'string' && SEMVER.test(manifest.version)) {
|
|
@@ -142,10 +250,11 @@ function escapeRegExp(value) {
|
|
|
142
250
|
* matched by their own path key, so an unrelated dependency that happens to be
|
|
143
251
|
* at the same version is never touched.
|
|
144
252
|
*/
|
|
145
|
-
export function writeVersion(checkoutPath, version) {
|
|
253
|
+
export function writeVersion(checkoutPath, version, manifests) {
|
|
146
254
|
const changed = [];
|
|
147
255
|
const absent = [];
|
|
148
|
-
|
|
256
|
+
const listed = resolveManifests(manifests);
|
|
257
|
+
for (const relative of listed) {
|
|
149
258
|
const path = join(checkoutPath, relative);
|
|
150
259
|
let raw;
|
|
151
260
|
try {
|
|
@@ -201,7 +310,7 @@ export function writeVersion(checkoutPath, version) {
|
|
|
201
310
|
const lockPath = join(checkoutPath, 'package-lock.json');
|
|
202
311
|
try {
|
|
203
312
|
const raw = readFileSync(lockPath, 'utf8');
|
|
204
|
-
const updated = updateLockfile(raw, version);
|
|
313
|
+
const updated = updateLockfile(raw, version, listed);
|
|
205
314
|
if (updated !== raw) {
|
|
206
315
|
writeFileSync(lockPath, updated);
|
|
207
316
|
changed.push('package-lock.json');
|
|
@@ -213,15 +322,18 @@ export function writeVersion(checkoutPath, version) {
|
|
|
213
322
|
return { changed, absent };
|
|
214
323
|
}
|
|
215
324
|
/**
|
|
216
|
-
* Rewrites each workspace
|
|
325
|
+
* Rewrites the `version` of each LISTED workspace's entry in the lockfile; a
|
|
326
|
+
* workspace the app did not list keeps its entry byte for byte.
|
|
217
327
|
*
|
|
218
328
|
* Keyed on the workspace PATH (`"apps/api": {`), so this can never touch a
|
|
219
329
|
* dependency that merely happens to share a version string.
|
|
330
|
+
*
|
|
331
|
+
* @param manifests - The list to use; defaults to {@link versionedManifests}.
|
|
220
332
|
*/
|
|
221
|
-
export function updateLockfile(raw, version) {
|
|
333
|
+
export function updateLockfile(raw, version, manifests) {
|
|
222
334
|
let out = raw;
|
|
223
|
-
for (const relative of
|
|
224
|
-
const workspace = relative.replace(/\/package\.json$/, '');
|
|
335
|
+
for (const relative of resolveManifests(manifests)) {
|
|
336
|
+
const workspace = escapeRegExp(relative.replace(/\/package\.json$/, ''));
|
|
225
337
|
// The entry opens with its path key; the `version` field follows within a
|
|
226
338
|
// few lines. Bounded so a malformed lockfile cannot make this run away.
|
|
227
339
|
const pattern = new RegExp(`("${workspace}"\\s*:\\s*\\{(?:[^{}]*?))"version"\\s*:\\s*"[^"]*"`, 'g');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-version.js","sourceRoot":"","sources":["../../../src/engine/deploy/app-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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EAA0E;QAC1E,wEAAwE;QACxE,MAAM,OAAO,GAAG,IAAI,MAAM,CACxB,KAAK,SAAS,oDAAoD,EAClE,GAAG,CACJ,CAAC;QACF,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,OAAO,GAAG,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -5,6 +5,13 @@ export interface VersionStepOptions {
|
|
|
5
5
|
requested?: string | undefined;
|
|
6
6
|
/** `--no-version-bump`. */
|
|
7
7
|
disabled?: boolean | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* The manifests to read and write. Defaults to the list `createCli` set
|
|
10
|
+
* (`deploy.versionedManifests`), else the default four; the first is the
|
|
11
|
+
* version source. Nothing outside this list (and the lockfile entries of
|
|
12
|
+
* these workspaces) is touched.
|
|
13
|
+
*/
|
|
14
|
+
manifests?: readonly string[] | undefined;
|
|
8
15
|
runCommand?: typeof defaultRunCommand | undefined;
|
|
9
16
|
}
|
|
10
17
|
export interface VersionStepResult {
|
|
@@ -15,6 +22,8 @@ export interface VersionStepResult {
|
|
|
15
22
|
baseSha?: string | undefined;
|
|
16
23
|
/** The bump commit. This is what the deployment records as deployed. */
|
|
17
24
|
commitSha?: string | undefined;
|
|
25
|
+
/** The files written and committed (manifests, then `package-lock.json`). */
|
|
26
|
+
files?: readonly string[] | undefined;
|
|
18
27
|
detail: string;
|
|
19
28
|
}
|
|
20
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-step.d.ts","sourceRoot":"","sources":["../../../src/engine/deploy/version-step.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQhE,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,2BAA2B;IA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AAE,GAAG,SAAS,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAcD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CA0C5B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAC;IACpB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,GACvE,OAAO,CAAC,oBAAoB,CAAC,CAuC/B;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAWT"}
|
|
@@ -62,7 +62,7 @@ async function git(options, args) {
|
|
|
62
62
|
* across the build, and the checkout step refuses a dirty tree.
|
|
63
63
|
*/
|
|
64
64
|
export async function runVersionStep(options) {
|
|
65
|
-
const current = currentVersion(options.checkoutPath);
|
|
65
|
+
const current = currentVersion(options.checkoutPath, options.manifests);
|
|
66
66
|
if (options.disabled === true) {
|
|
67
67
|
return { bumped: false, version: current, detail: 'skipped with --no-version-bump' };
|
|
68
68
|
}
|
|
@@ -72,7 +72,7 @@ export async function runVersionStep(options) {
|
|
|
72
72
|
const version = options.requested ?? suggestNext(current);
|
|
73
73
|
assertMovesForward(version, current);
|
|
74
74
|
const baseSha = await git(options, ['rev-parse', 'HEAD']);
|
|
75
|
-
const { changed } = writeVersion(options.checkoutPath, version);
|
|
75
|
+
const { changed } = writeVersion(options.checkoutPath, version, options.manifests);
|
|
76
76
|
if (changed.length === 0) {
|
|
77
77
|
return { bumped: false, version, baseSha, detail: 'every manifest already carries this version' };
|
|
78
78
|
}
|
|
@@ -93,7 +93,8 @@ export async function runVersionStep(options) {
|
|
|
93
93
|
version,
|
|
94
94
|
baseSha,
|
|
95
95
|
commitSha,
|
|
96
|
-
|
|
96
|
+
files: changed,
|
|
97
|
+
detail: `wrote ${version} to ${changed.join(', ')} and committed`,
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
/**
|