@fuzdev/fuz_gitops 0.78.1 → 0.79.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 +78 -24
- package/dist/ModulesDetail.svelte +15 -22
- package/dist/ModulesDetail.svelte.d.ts.map +1 -1
- package/dist/ModulesNav.svelte +4 -1
- package/dist/ModulesPage.svelte +1 -3
- package/dist/ModulesPage.svelte.d.ts.map +1 -1
- package/dist/PageHeader.svelte +2 -2
- package/dist/PageHeader.svelte.d.ts +0 -3
- package/dist/PageHeader.svelte.d.ts.map +1 -1
- package/dist/PullRequestsDetail.svelte +10 -9
- package/dist/PullRequestsDetail.svelte.d.ts.map +1 -1
- package/dist/PullRequestsPage.svelte +1 -3
- package/dist/PullRequestsPage.svelte.d.ts.map +1 -1
- package/dist/ReposTable.svelte +27 -48
- package/dist/ReposTable.svelte.d.ts.map +1 -1
- package/dist/ReposTree.svelte +5 -19
- package/dist/ReposTree.svelte.d.ts.map +1 -1
- package/dist/ReposTreeNav.svelte +5 -7
- package/dist/ReposTreeNav.svelte.d.ts.map +1 -1
- package/dist/TablePage.svelte +1 -3
- package/dist/TablePage.svelte.d.ts.map +1 -1
- package/dist/TreeItemPage.svelte +1 -3
- package/dist/TreeItemPage.svelte.d.ts.map +1 -1
- package/dist/TreePage.svelte +1 -3
- package/dist/TreePage.svelte.d.ts.map +1 -1
- package/dist/ci_reconcile.d.ts +6 -10
- package/dist/ci_reconcile.d.ts.map +1 -1
- package/dist/ci_reconcile.js +6 -8
- package/dist/dependency_graph.d.ts +26 -49
- package/dist/dependency_graph.d.ts.map +1 -1
- package/dist/dependency_graph.js +37 -80
- package/dist/dependency_updater.d.ts +1 -1
- package/dist/dependency_updater.d.ts.map +1 -1
- package/dist/dependency_updater.js +6 -1
- package/dist/fetch_repo_data.d.ts +34 -8
- package/dist/fetch_repo_data.d.ts.map +1 -1
- package/dist/fetch_repo_data.js +44 -22
- package/dist/fs_fetch_value_cache.d.ts +1 -1
- package/dist/fs_fetch_value_cache.js +1 -1
- package/dist/git_operations.d.ts +6 -49
- package/dist/git_operations.d.ts.map +1 -1
- package/dist/git_operations.js +13 -126
- package/dist/github.d.ts +17 -2
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +15 -6
- package/dist/github_helpers.d.ts.map +1 -1
- package/dist/github_helpers.js +3 -11
- package/dist/gitops_analyze.task.d.ts +24 -2
- package/dist/gitops_analyze.task.d.ts.map +1 -1
- package/dist/gitops_analyze.task.js +43 -30
- package/dist/gitops_config.d.ts +34 -79
- package/dist/gitops_config.d.ts.map +1 -1
- package/dist/gitops_config.js +76 -53
- package/dist/gitops_constants.d.ts +6 -4
- package/dist/gitops_constants.d.ts.map +1 -1
- package/dist/gitops_constants.js +6 -4
- package/dist/gitops_plan.task.d.ts +29 -3
- package/dist/gitops_plan.task.d.ts.map +1 -1
- package/dist/gitops_plan.task.js +80 -58
- package/dist/gitops_publish.task.d.ts +62 -2
- package/dist/gitops_publish.task.d.ts.map +1 -1
- package/dist/gitops_publish.task.js +187 -102
- package/dist/gitops_run.task.d.ts +74 -0
- package/dist/gitops_run.task.d.ts.map +1 -1
- package/dist/gitops_run.task.js +174 -160
- package/dist/gitops_sync.task.d.ts +65 -3
- package/dist/gitops_sync.task.d.ts.map +1 -1
- package/dist/gitops_sync.task.js +154 -30
- package/dist/gitops_task_helpers.d.ts +86 -59
- package/dist/gitops_task_helpers.d.ts.map +1 -1
- package/dist/gitops_task_helpers.js +120 -79
- package/dist/gitops_validate.task.d.ts +1 -2
- package/dist/gitops_validate.task.d.ts.map +1 -1
- package/dist/gitops_validate.task.js +15 -22
- package/dist/graph_validation.d.ts +16 -27
- package/dist/graph_validation.d.ts.map +1 -1
- package/dist/graph_validation.js +23 -64
- package/dist/local_repo.d.ts +50 -62
- package/dist/local_repo.d.ts.map +1 -1
- package/dist/local_repo.js +80 -193
- package/dist/log_helpers.d.ts +8 -8
- package/dist/log_helpers.d.ts.map +1 -1
- package/dist/multi_repo_publisher.d.ts +10 -0
- package/dist/multi_repo_publisher.d.ts.map +1 -1
- package/dist/multi_repo_publisher.js +115 -51
- package/dist/npm_registry.d.ts +23 -19
- package/dist/npm_registry.d.ts.map +1 -1
- package/dist/npm_registry.js +20 -47
- package/dist/operations.d.ts +75 -180
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +15 -7
- package/dist/operations_defaults.d.ts +17 -2
- package/dist/operations_defaults.d.ts.map +1 -1
- package/dist/operations_defaults.js +104 -121
- package/dist/output_helpers.d.ts +36 -0
- package/dist/output_helpers.d.ts.map +1 -1
- package/dist/output_helpers.js +37 -3
- package/dist/preflight_checks.d.ts +20 -27
- package/dist/preflight_checks.d.ts.map +1 -1
- package/dist/preflight_checks.js +37 -126
- package/dist/publish_steps.d.ts +2 -4
- package/dist/publish_steps.d.ts.map +1 -1
- package/dist/publish_steps.js +2 -6
- package/dist/publishing_event.d.ts +2 -8
- package/dist/publishing_event.d.ts.map +1 -1
- package/dist/publishing_event.js +5 -4
- package/dist/publishing_event_handler.d.ts +10 -8
- package/dist/publishing_event_handler.d.ts.map +1 -1
- package/dist/publishing_event_handler.js +14 -12
- package/dist/publishing_plan.d.ts +16 -1
- package/dist/publishing_plan.d.ts.map +1 -1
- package/dist/publishing_plan.js +328 -250
- package/dist/publishing_plan_logging.d.ts +1 -1
- package/dist/publishing_plan_logging.d.ts.map +1 -1
- package/dist/publishing_plan_logging.js +21 -14
- package/dist/repo.svelte.d.ts +7 -0
- package/dist/repo.svelte.d.ts.map +1 -1
- package/dist/repo.svelte.js +3 -0
- package/dist/repo_readiness.d.ts +210 -0
- package/dist/repo_readiness.d.ts.map +1 -0
- package/dist/repo_readiness.js +516 -0
- package/dist/repos_status.d.ts +3340 -0
- package/dist/repos_status.d.ts.map +1 -0
- package/dist/repos_status.js +555 -0
- package/dist/repos_status_load.d.ts +65 -0
- package/dist/repos_status_load.d.ts.map +1 -0
- package/dist/repos_status_load.js +131 -0
- package/package.json +7 -27
- package/src/lib/ci_reconcile.ts +7 -11
- package/src/lib/dependency_graph.ts +45 -97
- package/src/lib/dependency_updater.ts +7 -1
- package/src/lib/fetch_repo_data.ts +66 -29
- package/src/lib/fs_fetch_value_cache.ts +1 -1
- package/src/lib/git_operations.ts +15 -187
- package/src/lib/github.ts +20 -8
- package/src/lib/github_helpers.ts +5 -12
- package/src/lib/gitops_analyze.task.ts +79 -41
- package/src/lib/gitops_config.ts +88 -137
- package/src/lib/gitops_constants.ts +6 -4
- package/src/lib/gitops_plan.task.ts +113 -61
- package/src/lib/gitops_publish.task.ts +255 -122
- package/src/lib/gitops_run.task.ts +250 -178
- package/src/lib/gitops_sync.task.ts +208 -33
- package/src/lib/gitops_task_helpers.ts +166 -110
- package/src/lib/gitops_validate.task.ts +17 -27
- package/src/lib/graph_validation.ts +25 -86
- package/src/lib/local_repo.ts +109 -316
- package/src/lib/log_helpers.ts +8 -18
- package/src/lib/multi_repo_publisher.ts +138 -53
- package/src/lib/npm_registry.ts +37 -62
- package/src/lib/operations.ts +78 -150
- package/src/lib/operations_defaults.ts +108 -154
- package/src/lib/output_helpers.ts +55 -3
- package/src/lib/preflight_checks.ts +47 -183
- package/src/lib/publish_steps.ts +15 -13
- package/src/lib/publishing_event.ts +5 -4
- package/src/lib/publishing_event_handler.ts +18 -16
- package/src/lib/publishing_plan.ts +451 -287
- package/src/lib/publishing_plan_logging.ts +32 -23
- package/src/lib/repo.svelte.ts +8 -0
- package/src/lib/repo_readiness.ts +647 -0
- package/src/lib/repos_status.ts +671 -0
- package/src/lib/repos_status_load.ts +173 -0
- package/dist/config_reconcile.d.ts +0 -46
- package/dist/config_reconcile.d.ts.map +0 -1
- package/dist/config_reconcile.js +0 -64
- package/dist/paths.d.ts +0 -7
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -6
- package/dist/repo_ops.d.ts +0 -59
- package/dist/repo_ops.d.ts.map +0 -1
- package/dist/repo_ops.js +0 -170
- package/dist/resolved_gitops_config.d.ts +0 -9
- package/dist/resolved_gitops_config.d.ts.map +0 -1
- package/dist/resolved_gitops_config.js +0 -12
- package/src/lib/config_reconcile.ts +0 -98
- package/src/lib/paths.ts +0 -6
- package/src/lib/repo_ops.ts +0 -216
- package/src/lib/resolved_gitops_config.ts +0 -27
package/dist/operations.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Operations interfaces for dependency injection.
|
|
3
3
|
*
|
|
4
4
|
* This is the core pattern enabling testability without mocks.
|
|
5
|
-
* All side effects (git, npm, fs, process
|
|
5
|
+
* All side effects (git, npm, fs, process, build, and the `repos` binary) are
|
|
6
|
+
* abstracted into interfaces.
|
|
6
7
|
*
|
|
7
8
|
* **Design principles:**
|
|
8
9
|
* - All operations accept a single `options` object parameter
|
|
@@ -14,22 +15,29 @@
|
|
|
14
15
|
* **Production usage:**
|
|
15
16
|
* ```typescript
|
|
16
17
|
* import {default_gitops_operations} from './operations_defaults.js';
|
|
17
|
-
* const
|
|
18
|
+
* const ops = default_gitops_operations;
|
|
19
|
+
* const result = await ops.git.current_commit_hash({cwd: '/path'});
|
|
18
20
|
* if (!result.ok) {
|
|
19
21
|
* throw new TaskError(result.message);
|
|
20
22
|
* }
|
|
21
|
-
* const
|
|
23
|
+
* const commit = result.value;
|
|
22
24
|
* ```
|
|
23
25
|
*
|
|
24
26
|
* **Test usage:**
|
|
25
27
|
* ```typescript
|
|
26
|
-
*
|
|
27
|
-
* const
|
|
28
|
+
* import {create_mock_gitops_ops} from './test_helpers.js';
|
|
29
|
+
* const ops = create_mock_gitops_ops({
|
|
30
|
+
* changeset: {has_changesets: async () => ({ok: true, value: false})}
|
|
31
|
+
* });
|
|
32
|
+
* const result = await publish_repos(repos, {...options, ops});
|
|
28
33
|
* // Assert on result without any real git/npm calls
|
|
29
34
|
* ```
|
|
30
35
|
*
|
|
31
|
-
* See `operations_defaults.ts` for real implementations
|
|
32
|
-
*
|
|
36
|
+
* See `operations_defaults.ts` for real implementations, and the test-side mock
|
|
37
|
+
* factories: `create_mock_gitops_ops` in `src/test/test_helpers.ts` (plain
|
|
38
|
+
* objects with per-group overrides) and `create_fixture_gitops_ops` in
|
|
39
|
+
* `src/test/fixtures/mock_operations.ts` (a fixture's changesets over
|
|
40
|
+
* `create_mock_gitops_ops`, its fs empty).
|
|
33
41
|
*
|
|
34
42
|
* @module
|
|
35
43
|
*/
|
|
@@ -39,7 +47,7 @@ import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
|
39
47
|
import type { LocalRepo } from './local_repo.js';
|
|
40
48
|
import type { ChangesetInfo } from './changeset_reader.js';
|
|
41
49
|
import type { BumpType } from './version_utils.js';
|
|
42
|
-
import type {
|
|
50
|
+
import type { PreflightResult, RunPreflightChecksOptions } from './preflight_checks.js';
|
|
43
51
|
import type { WaitOptions } from './npm_registry.js';
|
|
44
52
|
/**
|
|
45
53
|
* Changeset operations for reading and predicting versions from `.changeset/*.md` files.
|
|
@@ -84,81 +92,22 @@ export interface ChangesetOperations {
|
|
|
84
92
|
}> | null>;
|
|
85
93
|
}
|
|
86
94
|
/**
|
|
87
|
-
* Git operations
|
|
88
|
-
*
|
|
95
|
+
* Git operations the publishing executor authors with: staging and committing
|
|
96
|
+
* dependency updates and auto-changesets, and reading the commit it published.
|
|
97
|
+
* All operations return `Result` instead of throwing errors. Where each repo
|
|
98
|
+
* sits (branch, dirt, relation to origin) is `ReposOperations`'s to report.
|
|
89
99
|
*/
|
|
90
100
|
export interface GitOperations {
|
|
91
|
-
/**
|
|
92
|
-
* Gets the current branch name.
|
|
93
|
-
*/
|
|
94
|
-
current_branch_name: (options?: {
|
|
95
|
-
cwd?: string;
|
|
96
|
-
}) => Promise<Result<{
|
|
97
|
-
value: string;
|
|
98
|
-
}, {
|
|
99
|
-
message: string;
|
|
100
|
-
}>>;
|
|
101
101
|
/**
|
|
102
102
|
* Gets the current commit hash.
|
|
103
103
|
*/
|
|
104
104
|
current_commit_hash: (options?: {
|
|
105
|
-
branch?: string;
|
|
106
105
|
cwd?: string;
|
|
107
106
|
}) => Promise<Result<{
|
|
108
107
|
value: string;
|
|
109
108
|
}, {
|
|
110
109
|
message: string;
|
|
111
110
|
}>>;
|
|
112
|
-
/**
|
|
113
|
-
* Checks if the workspace is clean (no uncommitted changes).
|
|
114
|
-
*/
|
|
115
|
-
check_clean_workspace: (options?: {
|
|
116
|
-
cwd?: string;
|
|
117
|
-
}) => Promise<Result<{
|
|
118
|
-
value: boolean;
|
|
119
|
-
}, {
|
|
120
|
-
message: string;
|
|
121
|
-
}>>;
|
|
122
|
-
/**
|
|
123
|
-
* Checks out a branch.
|
|
124
|
-
*/
|
|
125
|
-
checkout: (options: {
|
|
126
|
-
branch: string;
|
|
127
|
-
cwd?: string;
|
|
128
|
-
}) => Promise<Result<object, {
|
|
129
|
-
message: string;
|
|
130
|
-
}>>;
|
|
131
|
-
/**
|
|
132
|
-
* Pulls changes from remote.
|
|
133
|
-
*/
|
|
134
|
-
pull: (options?: {
|
|
135
|
-
origin?: string;
|
|
136
|
-
branch?: string;
|
|
137
|
-
cwd?: string;
|
|
138
|
-
}) => Promise<Result<object, {
|
|
139
|
-
message: string;
|
|
140
|
-
}>>;
|
|
141
|
-
/**
|
|
142
|
-
* Switches to a branch, optionally pulling.
|
|
143
|
-
*/
|
|
144
|
-
switch_branch: (options: {
|
|
145
|
-
branch: string;
|
|
146
|
-
pull?: boolean;
|
|
147
|
-
cwd?: string;
|
|
148
|
-
}) => Promise<Result<object, {
|
|
149
|
-
message: string;
|
|
150
|
-
}>>;
|
|
151
|
-
/**
|
|
152
|
-
* Checks if a remote exists.
|
|
153
|
-
*/
|
|
154
|
-
has_remote: (options?: {
|
|
155
|
-
remote?: string;
|
|
156
|
-
cwd?: string;
|
|
157
|
-
}) => Promise<Result<{
|
|
158
|
-
value: boolean;
|
|
159
|
-
}, {
|
|
160
|
-
message: string;
|
|
161
|
-
}>>;
|
|
162
111
|
/**
|
|
163
112
|
* Stages files for commit.
|
|
164
113
|
*/
|
|
@@ -169,115 +118,76 @@ export interface GitOperations {
|
|
|
169
118
|
message: string;
|
|
170
119
|
}>>;
|
|
171
120
|
/**
|
|
172
|
-
*
|
|
121
|
+
* Commits `files` alone (`git commit -- <files>`), leaving anything else
|
|
122
|
+
* staged out of the commit; `files` must be non-empty.
|
|
173
123
|
*/
|
|
174
124
|
commit: (options: {
|
|
175
125
|
message: string;
|
|
126
|
+
files: Array<string>;
|
|
176
127
|
cwd?: string;
|
|
177
128
|
}) => Promise<Result<object, {
|
|
178
129
|
message: string;
|
|
179
130
|
}>>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Process operations for the commands the publishing executor runs in a repo
|
|
134
|
+
* (`gro publish`, `gro deploy`).
|
|
135
|
+
*/
|
|
136
|
+
export interface ProcessOperations {
|
|
180
137
|
/**
|
|
181
|
-
*
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
cwd?: string;
|
|
187
|
-
}) => Promise<Result<object, {
|
|
188
|
-
message: string;
|
|
189
|
-
}>>;
|
|
190
|
-
/**
|
|
191
|
-
* Checks whether the working tree has any changes — staged, unstaged, or
|
|
192
|
-
* untracked (`git status --porcelain`). Broader than `list_uncommitted_files`,
|
|
193
|
-
* which reports only tracked working-tree changes relative to HEAD.
|
|
194
|
-
*/
|
|
195
|
-
has_changes: (options?: {
|
|
196
|
-
cwd?: string;
|
|
197
|
-
}) => Promise<Result<{
|
|
198
|
-
value: boolean;
|
|
199
|
-
}, {
|
|
200
|
-
message: string;
|
|
201
|
-
}>>;
|
|
202
|
-
/**
|
|
203
|
-
* Lists uncommitted files in the working tree (`git diff --name-only HEAD`),
|
|
204
|
-
* i.e. working-tree changes relative to HEAD (not a diff between two refs).
|
|
205
|
-
*/
|
|
206
|
-
list_uncommitted_files: (options?: {
|
|
207
|
-
cwd?: string;
|
|
208
|
-
}) => Promise<Result<{
|
|
209
|
-
value: Array<string>;
|
|
210
|
-
}, {
|
|
211
|
-
message: string;
|
|
212
|
-
}>>;
|
|
213
|
-
/**
|
|
214
|
-
* Creates a git tag.
|
|
215
|
-
*/
|
|
216
|
-
tag: (options: {
|
|
217
|
-
tag_name: string;
|
|
218
|
-
message?: string;
|
|
219
|
-
cwd?: string;
|
|
220
|
-
}) => Promise<Result<object, {
|
|
221
|
-
message: string;
|
|
222
|
-
}>>;
|
|
223
|
-
/**
|
|
224
|
-
* Pushes a tag to remote.
|
|
225
|
-
*/
|
|
226
|
-
push_tag: (options: {
|
|
227
|
-
tag_name: string;
|
|
228
|
-
origin?: string;
|
|
229
|
-
cwd?: string;
|
|
230
|
-
}) => Promise<Result<object, {
|
|
231
|
-
message: string;
|
|
232
|
-
}>>;
|
|
233
|
-
/**
|
|
234
|
-
* Stashes uncommitted changes.
|
|
235
|
-
*/
|
|
236
|
-
stash: (options?: {
|
|
237
|
-
message?: string;
|
|
238
|
-
cwd?: string;
|
|
239
|
-
}) => Promise<Result<object, {
|
|
240
|
-
message: string;
|
|
241
|
-
}>>;
|
|
242
|
-
/**
|
|
243
|
-
* Pops the most recent stash.
|
|
138
|
+
* Runs a command in the foreground and waits for it to exit: stdin is the
|
|
139
|
+
* terminal's, so a prompt (npm's 2FA one-time password) can be answered, and
|
|
140
|
+
* the child's output shows live — its stdout on ours, or on our stderr when
|
|
141
|
+
* `stdout` says so, and its stderr on ours. A failure carries the end of
|
|
142
|
+
* what the child wrote to stderr, bounded in lines and characters.
|
|
244
143
|
*/
|
|
245
|
-
|
|
144
|
+
run_interactive: (options: {
|
|
145
|
+
cmd: string;
|
|
146
|
+
args: Array<string>;
|
|
246
147
|
cwd?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Where the child's stdout goes: our stdout, or our stderr when our stdout
|
|
150
|
+
* carries a machine-readable stream (JSON-lines events, a JSON or markdown
|
|
151
|
+
* report) the child's output would corrupt.
|
|
152
|
+
*
|
|
153
|
+
* @default 'stdout'
|
|
154
|
+
*/
|
|
155
|
+
stdout?: 'stdout' | 'stderr';
|
|
247
156
|
}) => Promise<Result<object, {
|
|
248
157
|
message: string;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Checks if a specific file changed between two commits.
|
|
252
|
-
*/
|
|
253
|
-
has_file_changed: (options: {
|
|
254
|
-
from_commit: string;
|
|
255
|
-
to_commit: string;
|
|
256
|
-
file_path: string;
|
|
257
|
-
cwd?: string;
|
|
258
|
-
}) => Promise<Result<{
|
|
259
|
-
value: boolean;
|
|
260
|
-
}, {
|
|
261
|
-
message: string;
|
|
158
|
+
stderr_tail?: string;
|
|
262
159
|
}>>;
|
|
263
160
|
}
|
|
264
161
|
/**
|
|
265
|
-
*
|
|
162
|
+
* What a `repos` command printed and how it exited, unparsed.
|
|
266
163
|
*/
|
|
267
|
-
export interface
|
|
164
|
+
export interface ReposCommandOutput {
|
|
165
|
+
stdout: string;
|
|
166
|
+
stderr: string;
|
|
167
|
+
/** `0` for a report, `2` for an error document, `1` for a fatal I/O error (maybe no JSON). */
|
|
168
|
+
exit_code: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Operations running the Rust `repos` binary, which owns fleet git state.
|
|
172
|
+
* Parsing its output is `repos_status_load.ts`'s, not the runner's.
|
|
173
|
+
*/
|
|
174
|
+
export interface ReposOperations {
|
|
268
175
|
/**
|
|
269
|
-
*
|
|
176
|
+
* Runs `repos [--registry <path>] status [--fetch] <keys…> --json` in the
|
|
177
|
+
* process's cwd and returns what it printed, whatever its exit code. With
|
|
178
|
+
* `fetch`, `repos` fetches each entry from origin first, which writes
|
|
179
|
+
* remote-tracking refs and nothing else. Fails only when the binary didn't
|
|
180
|
+
* run to an exit: `not_found` when it isn't on `PATH`.
|
|
270
181
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
182
|
+
status: (options: {
|
|
183
|
+
keys: Array<string>;
|
|
184
|
+
registry?: string;
|
|
185
|
+
fetch?: boolean;
|
|
275
186
|
}) => Promise<Result<{
|
|
276
|
-
|
|
277
|
-
stderr?: string;
|
|
187
|
+
output: ReposCommandOutput;
|
|
278
188
|
}, {
|
|
189
|
+
kind: 'not_found' | 'failed';
|
|
279
190
|
message: string;
|
|
280
|
-
stderr?: string;
|
|
281
191
|
}>>;
|
|
282
192
|
}
|
|
283
193
|
/**
|
|
@@ -289,7 +199,6 @@ export interface BuildOperations {
|
|
|
289
199
|
*/
|
|
290
200
|
build_package: (options: {
|
|
291
201
|
repo: LocalRepo;
|
|
292
|
-
log?: Logger;
|
|
293
202
|
}) => Promise<Result<object, {
|
|
294
203
|
message: string;
|
|
295
204
|
output?: string;
|
|
@@ -311,7 +220,6 @@ export interface NpmOperations {
|
|
|
311
220
|
log?: Logger;
|
|
312
221
|
}) => Promise<Result<object, {
|
|
313
222
|
message: string;
|
|
314
|
-
timeout?: boolean;
|
|
315
223
|
}>>;
|
|
316
224
|
/**
|
|
317
225
|
* Checks npm authentication status.
|
|
@@ -327,32 +235,17 @@ export interface NpmOperations {
|
|
|
327
235
|
check_registry: () => Promise<Result<object, {
|
|
328
236
|
message: string;
|
|
329
237
|
}>>;
|
|
330
|
-
/**
|
|
331
|
-
* Installs npm dependencies.
|
|
332
|
-
*/
|
|
333
|
-
install: (options?: {
|
|
334
|
-
cwd?: string;
|
|
335
|
-
}) => Promise<Result<object, {
|
|
336
|
-
message: string;
|
|
337
|
-
stderr?: string;
|
|
338
|
-
}>>;
|
|
339
238
|
}
|
|
340
239
|
/**
|
|
341
|
-
* Preflight validation operations
|
|
342
|
-
*
|
|
240
|
+
* Preflight validation operations run before publishing: building every
|
|
241
|
+
* package the plan publishes, and npm authentication. Repo git state is the
|
|
242
|
+
* readiness gate's, before preflight (see `repo_readiness.ts`).
|
|
343
243
|
*/
|
|
344
244
|
export interface PreflightOperations {
|
|
345
245
|
/**
|
|
346
246
|
* Runs preflight validation checks before publishing.
|
|
347
247
|
*/
|
|
348
|
-
run_preflight_checks: (options:
|
|
349
|
-
repos: Array<LocalRepo>;
|
|
350
|
-
preflight_options: PreflightOptions;
|
|
351
|
-
git_ops?: GitOperations;
|
|
352
|
-
npm_ops?: NpmOperations;
|
|
353
|
-
build_ops?: BuildOperations;
|
|
354
|
-
changeset_ops?: ChangesetOperations;
|
|
355
|
-
}) => Promise<PreflightResult>;
|
|
248
|
+
run_preflight_checks: (options: RunPreflightChecksOptions) => Promise<PreflightResult>;
|
|
356
249
|
}
|
|
357
250
|
/**
|
|
358
251
|
* File system operations for reading and writing files.
|
|
@@ -404,5 +297,7 @@ export interface GitopsOperations {
|
|
|
404
297
|
preflight: PreflightOperations;
|
|
405
298
|
fs: FsOperations;
|
|
406
299
|
build: BuildOperations;
|
|
300
|
+
/** `repos status`, for the executor's re-check of each repo right before its publish. */
|
|
301
|
+
repos: ReposOperations;
|
|
407
302
|
}
|
|
408
303
|
//# sourceMappingURL=operations.d.ts.map
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,KAAK,EAAE,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,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,cAAc,CAAC;KACzB,KAAK,OAAO,CAAC,MAAM,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IAElD;;OAEG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAE5F;;OAEG;IACH,KAAK,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAE5F;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,GAAG,EAAE,aAAa,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,EAAE,aAAa,CAAC;IACnB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,yFAAyF;IACzF,KAAK,EAAE,eAAe,CAAC;CACvB"}
|
package/dist/operations.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Operations interfaces for dependency injection.
|
|
3
3
|
*
|
|
4
4
|
* This is the core pattern enabling testability without mocks.
|
|
5
|
-
* All side effects (git, npm, fs, process
|
|
5
|
+
* All side effects (git, npm, fs, process, build, and the `repos` binary) are
|
|
6
|
+
* abstracted into interfaces.
|
|
6
7
|
*
|
|
7
8
|
* **Design principles:**
|
|
8
9
|
* - All operations accept a single `options` object parameter
|
|
@@ -14,22 +15,29 @@
|
|
|
14
15
|
* **Production usage:**
|
|
15
16
|
* ```typescript
|
|
16
17
|
* import {default_gitops_operations} from './operations_defaults.js';
|
|
17
|
-
* const
|
|
18
|
+
* const ops = default_gitops_operations;
|
|
19
|
+
* const result = await ops.git.current_commit_hash({cwd: '/path'});
|
|
18
20
|
* if (!result.ok) {
|
|
19
21
|
* throw new TaskError(result.message);
|
|
20
22
|
* }
|
|
21
|
-
* const
|
|
23
|
+
* const commit = result.value;
|
|
22
24
|
* ```
|
|
23
25
|
*
|
|
24
26
|
* **Test usage:**
|
|
25
27
|
* ```typescript
|
|
26
|
-
*
|
|
27
|
-
* const
|
|
28
|
+
* import {create_mock_gitops_ops} from './test_helpers.js';
|
|
29
|
+
* const ops = create_mock_gitops_ops({
|
|
30
|
+
* changeset: {has_changesets: async () => ({ok: true, value: false})}
|
|
31
|
+
* });
|
|
32
|
+
* const result = await publish_repos(repos, {...options, ops});
|
|
28
33
|
* // Assert on result without any real git/npm calls
|
|
29
34
|
* ```
|
|
30
35
|
*
|
|
31
|
-
* See `operations_defaults.ts` for real implementations
|
|
32
|
-
*
|
|
36
|
+
* See `operations_defaults.ts` for real implementations, and the test-side mock
|
|
37
|
+
* factories: `create_mock_gitops_ops` in `src/test/test_helpers.ts` (plain
|
|
38
|
+
* objects with per-group overrides) and `create_fixture_gitops_ops` in
|
|
39
|
+
* `src/test/fixtures/mock_operations.ts` (a fixture's changesets over
|
|
40
|
+
* `create_mock_gitops_ops`, its fs empty).
|
|
33
41
|
*
|
|
34
42
|
* @module
|
|
35
43
|
*/
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Production implementations of operations interfaces.
|
|
3
3
|
*
|
|
4
|
-
* Provides real git, npm, fs, and
|
|
4
|
+
* Provides real git, npm, fs, build, and `repos` operations for production use.
|
|
5
5
|
* For interface definitions and dependency injection pattern, see `operations.ts`.
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import type { ChangesetOperations, GitOperations, ProcessOperations, NpmOperations, PreflightOperations, FsOperations, BuildOperations, GitopsOperations } from './operations.js';
|
|
9
|
+
import type { ChangesetOperations, GitOperations, ProcessOperations, NpmOperations, PreflightOperations, FsOperations, BuildOperations, GitopsOperations, ReposOperations } from './operations.js';
|
|
10
10
|
export declare const default_changeset_operations: ChangesetOperations;
|
|
11
11
|
export declare const default_git_operations: GitOperations;
|
|
12
|
+
/** The most lines of a child's stderr a failure carries. */
|
|
13
|
+
export declare const OUTPUT_TAIL_MAX_LINES = 20;
|
|
14
|
+
/** The most characters of a child's stderr a failure carries. */
|
|
15
|
+
export declare const OUTPUT_TAIL_MAX_CHARS = 4096;
|
|
16
|
+
/**
|
|
17
|
+
* The end of a process's output, for a failure message: its last lines, then
|
|
18
|
+
* its last characters, with terminal escape sequences stripped and trailing
|
|
19
|
+
* whitespace trimmed.
|
|
20
|
+
*
|
|
21
|
+
* @param text - the output, or as much of its end as was kept
|
|
22
|
+
* @param max_lines - the most lines to keep
|
|
23
|
+
* @param max_chars - the most characters to keep, applied after `max_lines`
|
|
24
|
+
*/
|
|
25
|
+
export declare const output_tail: (text: string, max_lines?: number, max_chars?: number) => string;
|
|
12
26
|
export declare const default_process_operations: ProcessOperations;
|
|
27
|
+
export declare const default_repos_operations: ReposOperations;
|
|
13
28
|
export declare const default_npm_operations: NpmOperations;
|
|
14
29
|
export declare const default_preflight_operations: PreflightOperations;
|
|
15
30
|
export declare const default_fs_operations: FsOperations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations_defaults.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations_defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"operations_defaults.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations_defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,KAAK,EACX,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,MAAM,iBAAiB,CAAC;AA0BzB,eAAO,MAAM,4BAA4B,EAAE,mBAuB1C,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAepC,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GACvB,MAAM,MAAM,EACZ,YAAW,MAA8B,EACzC,YAAW,MAA8B,KACvC,MAUF,CAAC;AAKF,eAAO,MAAM,0BAA0B,EAAE,iBA+BxC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eA6BtC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAyCpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,mBAI1C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,YAuCnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAkBtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,gBASvC,CAAC"}
|