Skip to content

Commit 10a2fa5

Browse files
committed
Update dependencies
1 parent 1b44ab9 commit 10a2fa5

15 files changed

+188
-158
lines changed

cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENTRY_FILE="./src/cli.ts"
66
MOD_FILE="./src/mod.ts"
77

88
update_deps() {
9-
deno run -A jsr:@wok/deup@1.3.1 update "$@"
9+
deno run -A jsr:@wok/deup@2.0.0 update "$@"
1010
"$0" update_lock
1111
}
1212

deno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@std/streams": "jsr:@std/streams@^1.0.8",
3737
"@std/yaml": "jsr:@std/yaml@^1.0.5",
3838
"@wok/case": "jsr:@wok/case@^1.0.2",
39-
"@wok/typebox": "jsr:@wok/typebox@^0.33.22",
40-
"@wok/utils": "jsr:@wok/utils@^3.5.3"
39+
"@wok/schema": "jsr:@wok/schema@^2.0.2",
40+
"@wok/utils": "jsr:@wok/utils@^4.0.2"
4141
}
4242
}

deno.lock

Lines changed: 37 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions/blacklist_instance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { Type } from "@wok/typebox";
21
import { createCliAction, ExitCode } from "@wok/utils/cli";
32
import { fetchCurrentWhitelist, updateWhitelist } from "./whitelist_instance.ts";
43
import { resolve as resolvePath } from "@std/path";
54
import { bold, red } from "@std/fmt/colors";
65
import { importBundleModule } from "../libs/iac_utils.ts";
6+
import { Str } from "../deps/schema.ts";
77

88
export default createCliAction(
99
{
10-
path: Type.String({
10+
path: Str({
1111
description: "Path to the instance module",
1212
examples: ["./instances/prod.ts"],
1313
}),

src/actions/compile.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { stringifyYamlRelaxed } from "../libs/yaml_utils.ts";
22
import type { HelmetChartInstance } from "../libs/types.ts";
33
import { join as joinPath, resolve as resolvePath } from "@std/path";
44
import { createCliAction, ExitCode } from "@wok/utils/cli";
5-
import { Type } from "@wok/typebox";
65
import { cyan } from "@std/fmt/colors";
76
import { importBundleModule } from "../libs/iac_utils.ts";
87
import { K8sKind } from "@wok/utils/k8s";
8+
import { Str } from "../deps/schema.ts";
99

1010
async function generateChildChart(
1111
{ crdsPath, resourcesPath, namespacesPath, instance }: {
@@ -269,15 +269,15 @@ export async function compile(
269269
}
270270

271271
export default createCliAction({
272-
version: Type.String({
272+
version: Str({
273273
description: "Version to write to the generated Chart.yaml",
274274
examples: ["1.0.0"],
275275
}),
276-
source: Type.String({
276+
source: Str({
277277
description: "Path to the instance module's source",
278278
examples: ["./instances/prod.ts"],
279279
}),
280-
destination: Type.String({
280+
destination: Str({
281281
description: "Destination path to generate the Helm chart to",
282282
examples: ["/path/to/compiled-prod-chart"],
283283
}),

src/actions/ensure_instance_whitelisted.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { createCliAction, ExitCode } from "@wok/utils/cli";
22
import { captureExec } from "@wok/utils/exec";
33
import { bold, cyan, red } from "@std/fmt/colors";
44
import { resolve as resolvePath } from "@std/path";
5-
import { Type } from "@wok/typebox";
65
import { importBundleModule } from "../libs/iac_utils.ts";
76
import { fetchCurrentWhitelist } from "./whitelist_instance.ts";
7+
import { Str } from "../deps/schema.ts";
88

99
export default createCliAction(
1010
{
11-
path: Type.String({
11+
path: Str({
1212
description: "Path to the instance module",
1313
examples: ["./instances/prod.ts"],
1414
}),

src/actions/install.ts

Lines changed: 64 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { captureExec, inheritExec, printErrLines, printOutLines } from "@wok/utils/exec";
2-
import { validate } from "@wok/utils/validation";
3-
import { type Static, type TObject, Type } from "@wok/typebox";
42
import { join as joinPath, resolve as resolvePath } from "@std/path";
53
import { expandGlobSync } from "@std/fs";
64
import { createCliAction, ExitCode } from "@wok/utils/cli";
75
import { cyan, gray } from "@std/fmt/colors";
86
import { HelmLsResultSchema } from "../libs/iac_utils.ts";
97
import { TextLineStream } from "@std/streams/text-line-stream";
8+
import { Bool, Obj, Opt, Str, typedParse } from "../deps/schema.ts";
109

1110
async function helmInstall(
1211
{
@@ -39,7 +38,7 @@ async function helmInstall(
3938
})).out,
4039
);
4140

42-
const helmLsResult = validate(HelmLsResultSchema, helmLsResultRaw);
41+
const helmLsResult = typedParse(HelmLsResultSchema, helmLsResultRaw);
4342

4443
if (!helmLsResult.isSuccess) {
4544
throw new Error('Failed validating result of "helm ls" command');
@@ -113,66 +112,83 @@ async function helmInstall(
113112
}
114113

115114
export const ParamsSchema = {
116-
name: Type.String({
115+
name: Str({
117116
description:
118117
"Helm release base name. This will be used as the prefx of the different sub-releases (*-crds, *-namespaces and *-resources)",
119118
}),
120-
namespace: Type.String({
119+
namespace: Str({
121120
description: "The namespace where the Secrets for Helm releases are stored",
122121
}),
123-
source: Type.String({
122+
source: Str({
124123
description: "Path to the compiled instance generated from `helmet compile ...`",
125124
}),
126-
wait: Type.Optional(Type.Boolean({
127-
description: "Whether to pass --wait to the underlying `helm upgrade ...` process",
128-
default: false,
129-
examples: [false],
130-
})),
131-
atomic: Type.Optional(Type.Boolean({
132-
description: "Whether to pass --atomic to the underlying `helm upgrade ...` process",
133-
default: false,
134-
examples: [false],
135-
})),
136-
cleanupOnFail: Type.Optional(Type.Boolean({
137-
description: "Whether to pass --cleanup-on-fail to the underlying `helm upgrade ...` process",
138-
default: false,
139-
examples: [false],
140-
})),
141-
force: Type.Optional(Type.Boolean({
142-
description: "Whether to pass --force to the underlying `helm upgrade ...` process",
143-
default: false,
144-
examples: [false],
145-
})),
146-
timeout: Type.Optional(Type.String({
147-
description: "Pass --timeout to the underlying `helm upgrade ...` process",
148-
default: "",
149-
examples: ["5m0s"],
150-
})),
151-
createNamespace: Type.Optional(Type.Boolean({
152-
description: "Whether to pass --create-namespace to the underlying `helm upgrade ...` process",
153-
default: false,
154-
examples: [false],
155-
})),
156-
debug: Type.Optional(Type.Boolean({
157-
description: "Whether to pass --debug to the underlying `helm upgrade ...` process",
158-
default: false,
159-
examples: [false],
160-
})),
125+
wait: Opt(
126+
Bool({
127+
description: "Whether to pass --wait to the underlying `helm upgrade ...` process",
128+
examples: [false],
129+
}),
130+
false,
131+
),
132+
atomic: Opt(
133+
Bool({
134+
description: "Whether to pass --atomic to the underlying `helm upgrade ...` process",
135+
examples: [false],
136+
}),
137+
false,
138+
),
139+
cleanupOnFail: Opt(
140+
Bool({
141+
description: "Whether to pass --cleanup-on-fail to the underlying `helm upgrade ...` process",
142+
examples: [false],
143+
}),
144+
false,
145+
),
146+
force: Opt(
147+
Bool({
148+
description: "Whether to pass --force to the underlying `helm upgrade ...` process",
149+
examples: [false],
150+
}),
151+
false,
152+
),
153+
timeout: Opt(
154+
Str({
155+
description: "Pass --timeout to the underlying `helm upgrade ...` process",
156+
examples: ["5m0s"],
157+
}),
158+
"",
159+
),
160+
createNamespace: Opt(
161+
Bool({
162+
description: "Whether to pass --create-namespace to the underlying `helm upgrade ...` process",
163+
examples: [false],
164+
}),
165+
false,
166+
),
167+
debug: Opt(
168+
Bool({
169+
description: "Whether to pass --debug to the underlying `helm upgrade ...` process",
170+
examples: [false],
171+
}),
172+
false,
173+
),
161174
};
162175

176+
const ParamsSchemaObj = Obj(ParamsSchema);
177+
type ParamsSchema = typeof ParamsSchemaObj.infer;
178+
163179
export async function install(
164180
{
165181
name,
166182
namespace,
167183
source,
168-
wait = false,
169-
atomic = false,
170-
cleanupOnFail = false,
171-
force = false,
172-
createNamespace = false,
173-
debug = false,
184+
wait,
185+
atomic,
186+
cleanupOnFail,
187+
force,
188+
createNamespace,
189+
debug,
174190
timeout,
175-
}: Static<TObject<typeof ParamsSchema>>,
191+
}: ParamsSchema,
176192
) {
177193
const resolvedSource = resolvePath(source);
178194

src/actions/typeify.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { pascalCase } from "@wok/case";
88
import { captureExec, inheritExec, printErrLines } from "@wok/utils/exec";
99
import { K8sCrdApiVersionV1beta1 } from "@wok/utils/k8s";
1010
import { createCliAction, ExitCode } from "@wok/utils/cli";
11-
import { Type } from "@wok/typebox";
1211
import { cyan, gray } from "@std/fmt/colors";
12+
import { Str } from "../deps/schema.ts";
1313

1414
export type ClassifiedType =
1515
| "array"
@@ -554,7 +554,8 @@ export async function typeifyChart(chartPath: string, typesPath: string) {
554554

555555
return versions.map((version) => {
556556
const schema = version.schema?.openAPIV3Schema ||
557-
crd.spec.validation?.openAPIV3Schema;
557+
(typeof crd.spec.validation === "object" && crd.spec.validation !== null &&
558+
(crd.spec.validation as Record<string, unknown>).openAPIV3Schema);
558559

559560
if (schema) {
560561
return generateCrdInterface(
@@ -687,11 +688,11 @@ ${crdInterfaces}
687688

688689
export default createCliAction(
689690
{
690-
charts: Type.String({
691+
charts: Str({
691692
description: "Glob pattern to match directories of Helm charts, for which types will be generated",
692693
examples: ["./charts/*"],
693694
}),
694-
types: Type.String({
695+
types: Str({
695696
description: "Path to the destination directory where types will be generated into",
696697
examples: ["./types"],
697698
}),

src/actions/uninstall.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { createCliAction, ExitCode } from "@wok/utils/cli";
22
import { inheritExec } from "@wok/utils/exec";
3-
import { Type } from "@wok/typebox";
3+
import { Str } from "../deps/schema.ts";
44

55
export default createCliAction(
66
{
7-
name: Type.String({
7+
name: Str({
88
description: "Instance name to uninstall",
99
examples: ["iac-my-stack"],
1010
}),
11-
namespace: Type.String({
11+
namespace: Str({
1212
description: "The namespace where corresponding Helm releases of this instance were installed to",
1313
examples: ["iac-my-stack"],
1414
}),

0 commit comments

Comments
 (0)