@intentius/chant-lexicon-k3d 0.56.0 → 0.58.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/dist/op/activities/index.d.ts +5 -3
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/k3d.d.ts +3 -2
- package/dist/op/activities/k3d.d.ts.map +1 -1
- package/dist/op/builders.d.ts +5 -3
- package/dist/op/builders.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +2 -2
- package/src/op/activities/index.ts +5 -3
- package/src/op/activities/k3d.test.ts +6 -2
- package/src/op/activities/k3d.ts +6 -14
- package/src/op/builders.ts +5 -3
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
* context are left alone unless explicitly requested, and `k3dUp` returns
|
|
8
8
|
* `{ context, kubeconfigPath? }` so later steps know what to talk to.
|
|
9
9
|
*
|
|
10
|
-
* The step builders (k3dUp, k3dDown) stay in core
|
|
11
|
-
*
|
|
10
|
+
* The step builders (k3dUp, k3dDown) stay in core and reach authors through
|
|
11
|
+
* `@intentius/chant/op` like the other core builders. The activities are
|
|
12
12
|
* dependency-light — they shell out to the k3d CLI and do not import the k3d
|
|
13
|
-
* declarable surface — so
|
|
13
|
+
* declarable surface — so `loadActivities`
|
|
14
|
+
* (`packages/core/src/op/activity-registry.ts`), which imports this module at
|
|
15
|
+
* run time, pulls in nothing expensive.
|
|
14
16
|
*/
|
|
15
17
|
export { k3dUp, k3dDown, k3dUpCommand, k3dDownCommand, k3dExistsCommand, k3dKubeconfigWriteCommand, k3dContextName, } from "./k3d.js";
|
|
16
18
|
export type { K3dUpArgs, K3dDownArgs, K3dUpResult } from "./k3d.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,KAAK,EACL,OAAO,EACP,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,GACf,MAAM,OAAO,CAAC;AACf,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -75,8 +75,9 @@ export declare function k3dUpCommand(args: K3dUpArgs): string;
|
|
|
75
75
|
export declare function k3dDownCommand(args: K3dDownArgs): string;
|
|
76
76
|
/**
|
|
77
77
|
* Create a local k3d cluster (vanilla Kubernetes in Docker). Idempotent: if a
|
|
78
|
-
* cluster of the same name already exists it is left as-is. Uses longInfra
|
|
79
|
-
* profile
|
|
78
|
+
* cluster of the same name already exists it is left as-is. Uses the longInfra
|
|
79
|
+
* profile: a 20m timeout, wide enough that creation can pull the k3s image, and
|
|
80
|
+
* three attempts backing off from 30s.
|
|
80
81
|
*
|
|
81
82
|
* Unlike the upstream CLI, this does NOT touch the caller's default kubeconfig
|
|
82
83
|
* or current context unless asked (see {@link K3dUpArgs.updateDefaultKubeconfig}).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k3d.d.ts","sourceRoot":"","sources":["../../../src/op/activities/k3d.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"k3d.d.ts","sourceRoot":"","sources":["../../../src/op/activities/k3d.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,SAAS;IACxB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;IAC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2). See `lexicons/k8s/src/op/builders.ts`'s module doc for why these
|
|
4
|
-
* live beside their `*Args` interfaces rather than in core
|
|
5
|
-
*
|
|
6
|
-
* interface
|
|
4
|
+
* live beside their `*Args` interfaces rather than in core: core cannot
|
|
5
|
+
* import a lexicon's types, so a wrapper whose `opts` IS the activity's own
|
|
6
|
+
* `*Args` interface can only sit in the lexicon that declares that
|
|
7
|
+
* interface. `opts`'s type in each wrapper below IS the activity's own
|
|
8
|
+
* `*Args` interface (via `Omit`/`WithStepRefs`) — never restated. `core`'s own
|
|
7
9
|
* `k3dUp`/`k3dDown` are unchanged and produce byte-identical `ActivityStep`
|
|
8
10
|
* output; these are purely additive.
|
|
9
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,kFAAkF;AAClF,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,EACZ,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KACtD,iBAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,MAAM,MAAM,EACZ,OAAO,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KACxD,iBAGF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-k3d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src/",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@intentius/chant": "^0.
|
|
55
|
+
"@intentius/chant": "^0.58.0",
|
|
56
56
|
"typescript": "^5.9.3"
|
|
57
57
|
},
|
|
58
58
|
"description": "k3d lexicon for chant — a local Kubernetes cluster as declarable data",
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Typed Op step-builder wrappers (chant #1288 Stage 2) — k3dUp/k3dDown with
|
|
2
2
|
// authoring-time types derived from this lexicon's own *Args interfaces (see
|
|
3
|
-
// ./op/builders.ts's module doc). Opt-in: `@intentius/chant
|
|
4
|
-
//
|
|
3
|
+
// ./op/builders.ts's module doc). Opt-in: `@intentius/chant/op`'s same-named
|
|
4
|
+
// exports are core's original untyped builders, unchanged.
|
|
5
5
|
export { k3dUp, k3dDown } from "./op/builders";
|
|
6
6
|
|
|
7
7
|
// Plugin
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
* context are left alone unless explicitly requested, and `k3dUp` returns
|
|
8
8
|
* `{ context, kubeconfigPath? }` so later steps know what to talk to.
|
|
9
9
|
*
|
|
10
|
-
* The step builders (k3dUp, k3dDown) stay in core
|
|
11
|
-
*
|
|
10
|
+
* The step builders (k3dUp, k3dDown) stay in core and reach authors through
|
|
11
|
+
* `@intentius/chant/op` like the other core builders. The activities are
|
|
12
12
|
* dependency-light — they shell out to the k3d CLI and do not import the k3d
|
|
13
|
-
* declarable surface — so
|
|
13
|
+
* declarable surface — so `loadActivities`
|
|
14
|
+
* (`packages/core/src/op/activity-registry.ts`), which imports this module at
|
|
15
|
+
* run time, pulls in nothing expensive.
|
|
14
16
|
*/
|
|
15
17
|
export {
|
|
16
18
|
k3dUp,
|
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
|
|
11
11
|
// The return-shape tests below exercise k3dUp's already-exists skip path, so
|
|
12
12
|
// every command goes through this mock — no real cluster, no k3d binary.
|
|
13
|
-
|
|
13
|
+
// Partial, via `importOriginal`: `@intentius/chant/op` reaches the base
|
|
14
|
+
// activities now (chant #2114), and modules on that path promisify
|
|
15
|
+
// `execFile` at load. A wholesale replacement of node:child_process would
|
|
16
|
+
// make them fail to import rather than fail an assertion.
|
|
17
|
+
vi.mock("node:child_process", async (importOriginal) => {
|
|
14
18
|
const custom = Symbol.for("nodejs.util.promisify.custom");
|
|
15
19
|
const exec = ((_cmd: string, _opts: unknown, cb?: (...a: unknown[]) => void) => {
|
|
16
20
|
cb?.(new Error("unmocked exec path"));
|
|
@@ -22,7 +26,7 @@ vi.mock("node:child_process", () => {
|
|
|
22
26
|
}
|
|
23
27
|
return { stdout: "", stderr: "" };
|
|
24
28
|
};
|
|
25
|
-
return { exec };
|
|
29
|
+
return { ...(await importOriginal<typeof import("node:child_process")>()), exec };
|
|
26
30
|
});
|
|
27
31
|
|
|
28
32
|
describe("k3dUpCommand (#704, kubeconfig defaults #1411)", () => {
|
package/src/op/activities/k3d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { exec } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
|
-
import { safeHeartbeat } from "@intentius/chant/op";
|
|
4
3
|
|
|
5
4
|
const execAsync = promisify(exec);
|
|
6
5
|
|
|
@@ -137,8 +136,9 @@ async function resolveConnection(args: K3dUpArgs, signal?: AbortSignal): Promise
|
|
|
137
136
|
|
|
138
137
|
/**
|
|
139
138
|
* Create a local k3d cluster (vanilla Kubernetes in Docker). Idempotent: if a
|
|
140
|
-
* cluster of the same name already exists it is left as-is. Uses longInfra
|
|
141
|
-
* profile
|
|
139
|
+
* cluster of the same name already exists it is left as-is. Uses the longInfra
|
|
140
|
+
* profile: a 20m timeout, wide enough that creation can pull the k3s image, and
|
|
141
|
+
* three attempts backing off from 30s.
|
|
142
142
|
*
|
|
143
143
|
* Unlike the upstream CLI, this does NOT touch the caller's default kubeconfig
|
|
144
144
|
* or current context unless asked (see {@link K3dUpArgs.updateDefaultKubeconfig}).
|
|
@@ -157,17 +157,9 @@ export async function k3dUp(args: K3dUpArgs, signal?: AbortSignal): Promise<K3dU
|
|
|
157
157
|
// `cluster list` errors when the cluster is absent — fall through to create.
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
try {
|
|
165
|
-
const { stdout, stderr } = await execAsync(k3dUpCommand(args), { signal });
|
|
166
|
-
if (stdout) console.log(stdout);
|
|
167
|
-
if (stderr) console.error(stderr);
|
|
168
|
-
} finally {
|
|
169
|
-
clearInterval(heartbeatInterval);
|
|
170
|
-
}
|
|
160
|
+
const { stdout, stderr } = await execAsync(k3dUpCommand(args), { signal });
|
|
161
|
+
if (stdout) console.log(stdout);
|
|
162
|
+
if (stderr) console.error(stderr);
|
|
171
163
|
|
|
172
164
|
return resolveConnection(args, signal);
|
|
173
165
|
}
|
package/src/op/builders.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed step-builder wrappers for this lexicon's activities (chant #1288
|
|
3
3
|
* Stage 2). See `lexicons/k8s/src/op/builders.ts`'s module doc for why these
|
|
4
|
-
* live beside their `*Args` interfaces rather than in core
|
|
5
|
-
*
|
|
6
|
-
* interface
|
|
4
|
+
* live beside their `*Args` interfaces rather than in core: core cannot
|
|
5
|
+
* import a lexicon's types, so a wrapper whose `opts` IS the activity's own
|
|
6
|
+
* `*Args` interface can only sit in the lexicon that declares that
|
|
7
|
+
* interface. `opts`'s type in each wrapper below IS the activity's own
|
|
8
|
+
* `*Args` interface (via `Omit`/`WithStepRefs`) — never restated. `core`'s own
|
|
7
9
|
* `k3dUp`/`k3dDown` are unchanged and produce byte-identical `ActivityStep`
|
|
8
10
|
* output; these are purely additive.
|
|
9
11
|
*/
|