@bensandee/tooling 0.18.0 → 0.21.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
CHANGED
|
@@ -162,17 +162,17 @@ import type {
|
|
|
162
162
|
| `DetectedProjectState` | Detected existing project state (package manager, CI, etc.) |
|
|
163
163
|
| `LegacyConfig` | Legacy config detection for migration |
|
|
164
164
|
|
|
165
|
-
## Docker
|
|
165
|
+
## Docker check
|
|
166
166
|
|
|
167
|
-
The `@bensandee/tooling/docker-
|
|
167
|
+
The `@bensandee/tooling/docker-check` export provides utilities for checking Docker Compose stacks via health checks.
|
|
168
168
|
|
|
169
169
|
### Quick start
|
|
170
170
|
|
|
171
171
|
```ts
|
|
172
|
-
import { createRealExecutor,
|
|
173
|
-
import type {
|
|
172
|
+
import { createRealExecutor, runDockerCheck } from "@bensandee/tooling/docker-check";
|
|
173
|
+
import type { CheckConfig } from "@bensandee/tooling/docker-check";
|
|
174
174
|
|
|
175
|
-
const config:
|
|
175
|
+
const config: CheckConfig = {
|
|
176
176
|
compose: {
|
|
177
177
|
cwd: "./deploy",
|
|
178
178
|
composeFiles: ["docker-compose.yaml"],
|
|
@@ -190,7 +190,7 @@ const config: VerifyConfig = {
|
|
|
190
190
|
pollIntervalMs: 5_000,
|
|
191
191
|
};
|
|
192
192
|
|
|
193
|
-
const result = await
|
|
193
|
+
const result = await runDockerCheck(createRealExecutor(), config);
|
|
194
194
|
if (!result.success) {
|
|
195
195
|
console.error(result.reason, result.message);
|
|
196
196
|
}
|
|
@@ -200,7 +200,7 @@ if (!result.success) {
|
|
|
200
200
|
|
|
201
201
|
| Export | Description |
|
|
202
202
|
| -------------------------------------- | ----------------------------------------------------------------- |
|
|
203
|
-
| `
|
|
203
|
+
| `runDockerCheck(executor, config)` | Full lifecycle: build, compose up, health check polling, teardown |
|
|
204
204
|
| `createRealExecutor()` | Production executor (real shell, fetch, timers) |
|
|
205
205
|
| `composeUp(executor, config)` | Start compose services |
|
|
206
206
|
| `composeDown(executor, config)` | Stop and remove compose services |
|
|
@@ -211,11 +211,11 @@ if (!result.success) {
|
|
|
211
211
|
|
|
212
212
|
### Types
|
|
213
213
|
|
|
214
|
-
| Type
|
|
215
|
-
|
|
|
216
|
-
| `
|
|
217
|
-
| `ComposeConfig`
|
|
218
|
-
| `HttpHealthCheck`
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `ContainerInfo`
|
|
214
|
+
| Type | Description |
|
|
215
|
+
| --------------------- | ------------------------------------------------------------------------------------------ |
|
|
216
|
+
| `CheckConfig` | Full check config (compose settings, build command, health checks, timeouts) |
|
|
217
|
+
| `ComposeConfig` | Docker Compose settings (cwd, compose files, env file, services) |
|
|
218
|
+
| `HttpHealthCheck` | Health check definition (name, URL, validate function) |
|
|
219
|
+
| `CheckResult` | Result: `{ success: true, elapsedMs }` or `{ success: false, reason, message, elapsedMs }` |
|
|
220
|
+
| `DockerCheckExecutor` | Side-effect abstraction (exec, fetch, timers) for testability |
|
|
221
|
+
| `ContainerInfo` | Container status info from `composePs` |
|