From c2f9c9e857e483abfb9d64f2f54a61591df13e27 Mon Sep 17 00:00:00 2001 From: Jacky Nguyen Date: Tue, 23 Jul 2024 17:32:45 -0400 Subject: [PATCH] Use deno config imports for dependency management --- deno.json | 12 ++- deno.lock | 118 ++++++++++++--------- examples/namespaces.ts | 3 +- flake.lock | 14 +-- flake.nix | 14 ++- src/actions/blacklist_instance.ts | 8 +- src/actions/compile.ts | 10 +- src/actions/ensure_instance_whitelisted.ts | 10 +- src/actions/install.ts | 16 +-- src/actions/show_version.ts | 2 +- src/actions/typeify.ts | 18 ++-- src/actions/uninstall.ts | 6 +- src/actions/update.ts | 26 +++-- src/actions/whitelist_instance.ts | 12 +-- src/deps/async_utils.ts | 1 - src/deps/case.ts | 1 - src/deps/cli_utils.ts | 1 - src/deps/exec_utils.ts | 1 - src/deps/k8s_utils.ts | 1 - src/deps/quote_shell.ts | 1 - src/deps/semver.ts | 8 -- src/deps/std_fmt_colors.ts | 1 - src/deps/std_fs.ts | 2 - src/deps/std_io.ts | 2 - src/deps/std_path.ts | 8 -- src/deps/std_yaml.ts | 1 - src/deps/typebox.ts | 1 - src/deps/validation_utils.ts | 1 - src/helmet.ts | 4 +- src/libs/iac_utils.ts | 18 ++-- src/libs/types.ts | 6 +- src/libs/yaml_utils.ts | 4 +- src/mod.ts | 3 +- 33 files changed, 171 insertions(+), 163 deletions(-) delete mode 100644 src/deps/async_utils.ts delete mode 100644 src/deps/case.ts delete mode 100644 src/deps/cli_utils.ts delete mode 100644 src/deps/exec_utils.ts delete mode 100644 src/deps/k8s_utils.ts delete mode 100644 src/deps/quote_shell.ts delete mode 100644 src/deps/semver.ts delete mode 100644 src/deps/std_fmt_colors.ts delete mode 100644 src/deps/std_fs.ts delete mode 100644 src/deps/std_io.ts delete mode 100644 src/deps/std_path.ts delete mode 100644 src/deps/std_yaml.ts delete mode 100644 src/deps/typebox.ts delete mode 100644 src/deps/validation_utils.ts diff --git a/deno.json b/deno.json index 099dcd1..ba06d77 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@wok/helmet", - "version": "dev", + "version": "0.0.0", "exports": { ".": "./src/mod.ts", "./deps/typebox": "./src/deps/typebox.ts" @@ -26,5 +26,15 @@ "rules": { "exclude": ["no-slow-types"] } + }, + "imports": { + "@std/fmt": "jsr:@std/fmt@0.225.6", + "@std/fs": "jsr:@std/fs@0.229.3", + "@std/io": "jsr:@std/io@0.224.3", + "@std/path": "jsr:@std/path@1.0.1", + "@std/semver": "jsr:@std/semver@0.224.3", + "@std/yaml": "jsr:@std/yaml@0.224.3", + "@wok/case": "jsr:@wok/case@1.0.1", + "@wok/utils": "jsr:@wok/utils@1.3.3" } } diff --git a/deno.lock b/deno.lock index 59f779d..5cd4690 100644 --- a/deno.lock +++ b/deno.lock @@ -2,75 +2,74 @@ "version": "3", "packages": { "specifiers": { - "jsr:@std/assert@^0.224.0": "jsr:@std/assert@0.224.0", - "jsr:@std/async@0.224.0": "jsr:@std/async@0.224.0", - "jsr:@std/bytes@^0.224.0": "jsr:@std/bytes@0.224.0", - "jsr:@std/cli@0.224.0": "jsr:@std/cli@0.224.0", + "jsr:@std/async@1.0.0": "jsr:@std/async@1.0.0", + "jsr:@std/bytes@^1.0.0-rc.3": "jsr:@std/bytes@1.0.2", + "jsr:@std/bytes@^1.0.1-rc.3": "jsr:@std/bytes@1.0.2", + "jsr:@std/cli@1.0.0": "jsr:@std/cli@1.0.0", "jsr:@std/collections@0.224.0": "jsr:@std/collections@0.224.0", - "jsr:@std/fmt@0.224.0": "jsr:@std/fmt@0.224.0", - "jsr:@std/fs@0.224.0": "jsr:@std/fs@0.224.0", - "jsr:@std/io@0.224.0": "jsr:@std/io@0.224.0", - "jsr:@std/path@0.224.0": "jsr:@std/path@0.224.0", - "jsr:@std/path@^0.224.0": "jsr:@std/path@0.224.0", - "jsr:@std/semver@0.224.0": "jsr:@std/semver@0.224.0", + "jsr:@std/fmt@0.225.6": "jsr:@std/fmt@0.225.6", + "jsr:@std/fs@0.229.3": "jsr:@std/fs@0.229.3", + "jsr:@std/io@0.224.3": "jsr:@std/io@0.224.3", + "jsr:@std/path@1.0.0-rc.1": "jsr:@std/path@1.0.0-rc.1", + "jsr:@std/path@1.0.1": "jsr:@std/path@1.0.1", + "jsr:@std/semver@0.224.3": "jsr:@std/semver@0.224.3", "jsr:@std/streams@0.224.0": "jsr:@std/streams@0.224.0", - "jsr:@std/yaml@0.224.0": "jsr:@std/yaml@0.224.0", + "jsr:@std/streams@0.224.5": "jsr:@std/streams@0.224.5", + "jsr:@std/yaml@0.224.3": "jsr:@std/yaml@0.224.3", "jsr:@wok/case@1.0.1": "jsr:@wok/case@1.0.1", "jsr:@wok/k8s@1.30.1+1": "jsr:@wok/k8s@1.30.1+1", "jsr:@wok/openapi-client@1.0.1": "jsr:@wok/openapi-client@1.0.1", - "jsr:@wok/typebox@0.32.30+1": "jsr:@wok/typebox@0.32.30+1", - "jsr:@wok/utils@1.3.2": "jsr:@wok/utils@1.3.2" + "jsr:@wok/typebox@0.32.35": "jsr:@wok/typebox@0.32.35", + "jsr:@wok/utils@1.3.3": "jsr:@wok/utils@1.3.3" }, "jsr": { - "@std/assert@0.224.0": { - "integrity": "8643233ec7aec38a940a8264a6e3eed9bfa44e7a71cc6b3c8874213ff401967f" + "@std/async@1.0.0": { + "integrity": "19891d4540cd3af5efd1d7b1f0e92f6ca365e51edc263fbc077334173878e528" }, - "@std/async@0.224.0": { - "integrity": "b6da423eeafbd0003fe88d950e069368c6a156f8b5293b7adbd9c8903a8f8d66" + "@std/bytes@1.0.2": { + "integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57" }, - "@std/bytes@0.224.0": { - "integrity": "a2250e1d0eb7d1c5a426f21267ab9bdeac2447fa87a3d0d1a467d3f7a6058e49" - }, - "@std/cli@0.224.0": { - "integrity": "2612373d68984637bdad8b9c9dd160e9838ac2a6d463354d537d2897a7cc6d1c" + "@std/cli@1.0.0": { + "integrity": "3c38f1da21bff0d25a9e6d97139ef2eb9ba334b5910da92c0169b44f38655f08" }, "@std/collections@0.224.0": { "integrity": "d00201d1833c6e05371c7e9f0b178522597b1dda0b0a9ecf0c579414e1dd2770" }, - "@std/fmt@0.224.0": { - "integrity": "e20e9a2312a8b5393272c26191c0a68eda8d2c4b08b046bad1673148f1d69851" + "@std/fmt@0.225.6": { + "integrity": "aba6aea27f66813cecfd9484e074a9e9845782ab0685c030e453a8a70b37afc8" }, - "@std/fs@0.224.0": { - "integrity": "52a5ec89731ac0ca8f971079339286f88c571a4d61686acf75833f03a89d8e69", + "@std/fs@0.229.3": { + "integrity": "783bca21f24da92e04c3893c9e79653227ab016c48e96b3078377ebd5222e6eb", "dependencies": [ - "jsr:@std/assert@^0.224.0", - "jsr:@std/path@^0.224.0" + "jsr:@std/path@1.0.0-rc.1" ] }, - "@std/io@0.224.0": { - "integrity": "0aff885d21d829c050b8a08b1d71b54aed5841aecf227f8d77e99ec529a11e8e", + "@std/io@0.224.3": { + "integrity": "b402edeb99c6b3778d9ae3e9927bc9085b170b41e5a09bbb7064ab2ee394ae2f", "dependencies": [ - "jsr:@std/assert@^0.224.0", - "jsr:@std/bytes@^0.224.0" + "jsr:@std/bytes@^1.0.1-rc.3" ] }, - "@std/path@0.224.0": { - "integrity": "55bca6361e5a6d158b9380e82d4981d82d338ec587de02951e2b7c3a24910ee6", - "dependencies": [ - "jsr:@std/assert@^0.224.0" - ] + "@std/path@1.0.0-rc.1": { + "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6" + }, + "@std/path@1.0.1": { + "integrity": "e061ff02c28481ca49e3a14981875c345e9fc7e973190672782cd0ac8af70428" }, - "@std/semver@0.224.0": { - "integrity": "8da7354393dd9d2029278412107dbd5ca9dfb1fa240148d948eb2bfeb14f136a" + "@std/semver@0.224.3": { + "integrity": "7bb34b5ad46de2c0c73de0ca3e30081ef64b4361f66abd57c84ff1011c6a1233" }, "@std/streams@0.224.0": { - "integrity": "9c21feb45113abfc67dd536029624d1792d56dfbb029b8c1baf4ad5a2c35769e", + "integrity": "9c21feb45113abfc67dd536029624d1792d56dfbb029b8c1baf4ad5a2c35769e" + }, + "@std/streams@0.224.5": { + "integrity": "bcde7818dd5460d474cdbd674b15f6638b9cd73cd64e52bd852fba2bd4d8ec91", "dependencies": [ - "jsr:@std/bytes@^0.224.0" + "jsr:@std/bytes@^1.0.0-rc.3" ] }, - "@std/yaml@0.224.0": { - "integrity": "9bd99c6beb4d2db98de81c50853f15e68d4c95f38d737934b0e909bbeeff2b6d" + "@std/yaml@0.224.3": { + "integrity": "9da1ed0094f42ba24570b4d88a094b44a793ac7f2bc085c1939d3ac7e11cc0bb" }, "@wok/case@1.0.1": { "integrity": "409e94f961f5b278992bace87a0c7d3c6a3db516d01759bdb827d9ae4d75e9aa" @@ -79,28 +78,41 @@ "integrity": "dae7189bc7ff8ae18cd1385bab88487ab5b40090ea7d6d414b2ea4a4210b6907", "dependencies": [ "jsr:@std/collections@0.224.0", + "jsr:@std/streams@0.224.0", "jsr:@wok/openapi-client@1.0.1" ] }, "@wok/openapi-client@1.0.1": { "integrity": "267fb8a139d1b6719b1ad0ffbefbd190df8e95d32d53bd010d78694d81a777ba" }, - "@wok/typebox@0.32.30+1": { - "integrity": "da8949d6702f140b3b02c052e636adc35711e67a321be825fe5f43f85038e80b" + "@wok/typebox@0.32.35": { + "integrity": "39697de76b4a599dd9a8fcc69b4aef662a7c8f28a52eca1d5429d40748880a89" }, - "@wok/utils@1.3.2": { - "integrity": "34fea8257436378edda23621c9c1da7d7672e96e8f4e51f8baedf98d394238ab", + "@wok/utils@1.3.3": { + "integrity": "1ce08ce1edf68c2547a944f96b28a933653083377a9c7055c896d8484edabc00", "dependencies": [ - "jsr:@std/async@0.224.0", - "jsr:@std/cli@0.224.0", - "jsr:@std/fmt@0.224.0", - "jsr:@std/streams@0.224.0", + "jsr:@std/async@1.0.0", + "jsr:@std/cli@1.0.0", + "jsr:@std/fmt@0.225.6", + "jsr:@std/streams@0.224.5", "jsr:@wok/case@1.0.1", "jsr:@wok/k8s@1.30.1+1", - "jsr:@wok/typebox@0.32.30+1" + "jsr:@wok/typebox@0.32.35" ] } } }, - "remote": {} + "remote": {}, + "workspace": { + "dependencies": [ + "jsr:@std/fmt@0.225.6", + "jsr:@std/fs@0.229.3", + "jsr:@std/io@0.224.3", + "jsr:@std/path@1.0.1", + "jsr:@std/semver@0.224.3", + "jsr:@std/yaml@0.224.3", + "jsr:@wok/case@1.0.1", + "jsr:@wok/utils@1.3.3" + ] + } } diff --git a/examples/namespaces.ts b/examples/namespaces.ts index 99b3a5c..54837ad 100644 --- a/examples/namespaces.ts +++ b/examples/namespaces.ts @@ -1,5 +1,4 @@ -import { createK8sNamespace } from "../src/deps/k8s_utils.ts"; -import { defineBundle } from "../src/libs/iac_utils.ts"; +import { createK8sNamespace, defineBundle } from "../src/mod.ts"; export default defineBundle({ releaseId: "examples-namespaces", diff --git a/flake.lock b/flake.lock index 91466ea..9034b86 100644 --- a/flake.lock +++ b/flake.lock @@ -83,11 +83,11 @@ "npmlock2nixPkg": "npmlock2nixPkg" }, "locked": { - "lastModified": 1716348586, - "narHash": "sha256-Tm92LbVkxmbv4dx4H7g42dtCRwdWVGYr3VxEtdlr9EY=", + "lastModified": 1721769354, + "narHash": "sha256-1acXjp3PbMXSUX3eiZZSBgxUSRzzXSdVOuF3bK4DpJ4=", "owner": "shopstic", "repo": "nix-hot-pot", - "rev": "563eb86b303e2f217b456e95d6b5cec45743d178", + "rev": "c72617c0806c682feb482ec9ab1c1b0d7d6ff1d5", "type": "github" }, "original": { @@ -149,16 +149,16 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1715668745, - "narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=", + "lastModified": 1720553833, + "narHash": "sha256-IXMiHQMtdShDXcBW95ctA+m5Oq2kLxnBt7WlMxvDQXA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843", + "rev": "249fbde2a178a2ea2638b65b9ecebd531b338cf9", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index b4e637b..a0ca126 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,7 @@ name = "${name}-src"; filter = with pkgs.lib; (path: /* type */_: hasInfix "/src" path || + hasSuffix "/deno.json" path || hasSuffix "/deno.lock" path ); }; @@ -57,7 +58,18 @@ inherit name deno deno-cache src; inherit (hotPotPkgs) deno-app-build; appSrcPath = "./src/helmet.ts"; - denoRunFlags = "-A --no-lock"; + denoRunFlags = ''"''${DENO_RUN_FLAGS[@]}"''; + preExec = '' + DENO_RUN_FLAGS=("-A") + if [ ! -f deno.lock ]; then + DENO_RUN_FLAGS+=("--no-lock") + fi + if [ -f deno.json ]; then + DENO_RUN_FLAGS+=("--config=deno.json") + elif [ -f deno.jsonc ]; then + DENO_RUN_FLAGS+=("--config=deno.jsonc") + fi + ''; }; denoJson = builtins.fromJSON (builtins.readFile ./deno.json); in diff --git a/src/actions/blacklist_instance.ts b/src/actions/blacklist_instance.ts index 7c29664..556b91a 100644 --- a/src/actions/blacklist_instance.ts +++ b/src/actions/blacklist_instance.ts @@ -1,8 +1,8 @@ -import { Type } from "../deps/typebox.ts"; -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; +import { Type } from "@wok/utils/typebox"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; import { fetchCurrentWhitelist, updateWhitelist } from "./whitelist_instance.ts"; -import { resolvePath } from "../deps/std_path.ts"; -import { bold, red } from "../deps/std_fmt_colors.ts"; +import { resolve as resolvePath } from "@std/path"; +import { bold, red } from "@std/fmt/colors"; import { importBundleModule } from "../libs/iac_utils.ts"; export default createCliAction( diff --git a/src/actions/compile.ts b/src/actions/compile.ts index 888038a..6f6ee7b 100644 --- a/src/actions/compile.ts +++ b/src/actions/compile.ts @@ -1,11 +1,11 @@ import { stringifyYamlRelaxed } from "../libs/yaml_utils.ts"; import type { HelmetChartInstance } from "../libs/types.ts"; -import { joinPath, resolvePath } from "../deps/std_path.ts"; -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; -import { Type } from "../deps/typebox.ts"; -import { cyan } from "../deps/std_fmt_colors.ts"; +import { join as joinPath, resolve as resolvePath } from "@std/path"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; +import { Type } from "@wok/utils/typebox"; +import { cyan } from "@std/fmt/colors"; import { importBundleModule } from "../libs/iac_utils.ts"; -import { K8sKind } from "../deps/k8s_utils.ts"; +import { K8sKind } from "@wok/utils/k8s"; async function generateChildChart( { crdsPath, resourcesPath, namespacesPath, instance }: { diff --git a/src/actions/ensure_instance_whitelisted.ts b/src/actions/ensure_instance_whitelisted.ts index 8a029e9..6d6256f 100644 --- a/src/actions/ensure_instance_whitelisted.ts +++ b/src/actions/ensure_instance_whitelisted.ts @@ -1,8 +1,8 @@ -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; -import { captureExec } from "../deps/exec_utils.ts"; -import { bold, cyan, red } from "../deps/std_fmt_colors.ts"; -import { resolvePath } from "../deps/std_path.ts"; -import { Type } from "../deps/typebox.ts"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; +import { captureExec } from "@wok/utils/exec"; +import { bold, cyan, red } from "@std/fmt/colors"; +import { resolve as resolvePath } from "@std/path"; +import { Type } from "@wok/utils/typebox"; import { importBundleModule } from "../libs/iac_utils.ts"; import { fetchCurrentWhitelist } from "./whitelist_instance.ts"; diff --git a/src/actions/install.ts b/src/actions/install.ts index 9896eb7..5a3cf67 100644 --- a/src/actions/install.ts +++ b/src/actions/install.ts @@ -1,11 +1,11 @@ -import { captureExec, inheritExec, printErrLines, printOutLines } from "../deps/exec_utils.ts"; -import { validate } from "../deps/validation_utils.ts"; -import { type Static, type TObject, Type } from "../deps/typebox.ts"; -import { joinPath, resolvePath } from "../deps/std_path.ts"; -import { expandGlobSync } from "../deps/std_fs.ts"; -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; -import { cyan, gray } from "../deps/std_fmt_colors.ts"; -import { readerFromStreamReader, readLines } from "../deps/std_io.ts"; +import { captureExec, inheritExec, printErrLines, printOutLines } from "@wok/utils/exec"; +import { validate } from "@wok/utils/validation"; +import { type Static, type TObject, Type } from "@wok/utils/typebox"; +import { join as joinPath, resolve as resolvePath } from "@std/path"; +import { expandGlobSync } from "@std/fs"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; +import { cyan, gray } from "@std/fmt/colors"; +import { readerFromStreamReader, readLines } from "@std/io"; import { HelmLsResultSchema } from "../libs/iac_utils.ts"; async function helmInstall( diff --git a/src/actions/show_version.ts b/src/actions/show_version.ts index 2b95ce6..d4289ce 100644 --- a/src/actions/show_version.ts +++ b/src/actions/show_version.ts @@ -1,4 +1,4 @@ -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; export default createCliAction( {}, diff --git a/src/actions/typeify.ts b/src/actions/typeify.ts index dc3f27b..cf873e7 100644 --- a/src/actions/typeify.ts +++ b/src/actions/typeify.ts @@ -1,15 +1,15 @@ import { deepMerge } from "../libs/patch_utils.ts"; import { checkAndImport, type ImportDef, readChartCrds, type TypeifyPatch } from "../libs/iac_utils.ts"; -import { basename, joinPath, resolvePath } from "../deps/std_path.ts"; -import { expandGlobSync, fsExists } from "../deps/std_fs.ts"; -import { parseYaml } from "../deps/std_yaml.ts"; -import { pascalCase } from "../deps/case.ts"; -import { captureExec, inheritExec, printErrLines } from "../deps/exec_utils.ts"; -import { K8sCrdApiVersionV1beta1 } from "../deps/k8s_utils.ts"; -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; -import { Type } from "../deps/typebox.ts"; -import { cyan, gray } from "../deps/std_fmt_colors.ts"; +import { basename, join as joinPath, resolve as resolvePath } from "@std/path"; +import { exists as fsExists, expandGlobSync } from "@std/fs"; +import { parse as parseYaml } from "@std/yaml"; +import { pascalCase } from "@wok/case"; +import { captureExec, inheritExec, printErrLines } from "@wok/utils/exec"; +import { K8sCrdApiVersionV1beta1 } from "@wok/utils/k8s"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; +import { Type } from "@wok/utils/typebox"; +import { cyan, gray } from "@std/fmt/colors"; export type ClassifiedType = | "array" diff --git a/src/actions/uninstall.ts b/src/actions/uninstall.ts index e6ca225..f3102ed 100644 --- a/src/actions/uninstall.ts +++ b/src/actions/uninstall.ts @@ -1,6 +1,6 @@ -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; -import { inheritExec } from "../deps/exec_utils.ts"; -import { Type } from "../deps/typebox.ts"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; +import { inheritExec } from "@wok/utils/exec"; +import { Type } from "@wok/utils/typebox"; export default createCliAction( { diff --git a/src/actions/update.ts b/src/actions/update.ts index c7df183..5472ce4 100644 --- a/src/actions/update.ts +++ b/src/actions/update.ts @@ -1,12 +1,18 @@ -import { inheritExec } from "../deps/exec_utils.ts"; -import { expandGlobSync, fsExists } from "../deps/std_fs.ts"; -import { dirname, joinPath, resolvePath } from "../deps/std_path.ts"; -import { parseYaml } from "../deps/std_yaml.ts"; -import { Type } from "../deps/typebox.ts"; -import { validate } from "../deps/validation_utils.ts"; -import { maxSatisfyingSemver, type SemVer, semverFormat, semverParseRange, semverTryParse } from "../deps/semver.ts"; -import { quoteShell } from "../deps/quote_shell.ts"; -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; +import { inheritExec } from "@wok/utils/exec"; +import { exists as fsExists, expandGlobSync } from "@std/fs"; +import { dirname, join as joinPath, resolve as resolvePath } from "@std/path"; +import { parse as parseYaml } from "@std/yaml"; +import { Type } from "@wok/utils/typebox"; +import { validate } from "@wok/utils/validation"; +import { + format as semverFormat, + maxSatisfying as maxSatisfyingSemver, + parseRange as semverParseRange, + type SemVer, + tryParse as semverTryParse, +} from "@std/semver"; +import { quoteShell } from "@wok/utils/quote-shell"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; import { type ChartMetadata, ChartMetadataSchema, @@ -19,7 +25,7 @@ import { RemoteChartSource, } from "../libs/types.ts"; import { typeifyChart } from "./typeify.ts"; -import { bold, gray, green, red } from "../deps/std_fmt_colors.ts"; +import { bold, gray, green, red } from "@std/fmt/colors"; import { checkAndImport } from "../mod.ts"; interface ChartUpdateFailure { diff --git a/src/actions/whitelist_instance.ts b/src/actions/whitelist_instance.ts index b52dd9c..62dadb2 100644 --- a/src/actions/whitelist_instance.ts +++ b/src/actions/whitelist_instance.ts @@ -1,9 +1,9 @@ -import { inheritExec, printErrLines, printOutLines } from "../deps/exec_utils.ts"; -import { createK8sConfigMap } from "../deps/k8s_utils.ts"; -import { createCliAction, ExitCode } from "../deps/cli_utils.ts"; -import { Type } from "../deps/typebox.ts"; -import { resolvePath } from "../deps/std_path.ts"; -import { gray } from "../deps/std_fmt_colors.ts"; +import { inheritExec, printErrLines, printOutLines } from "@wok/utils/exec"; +import { createK8sConfigMap } from "@wok/utils/k8s"; +import { createCliAction, ExitCode } from "@wok/utils/cli"; +import { Type } from "@wok/utils/typebox"; +import { resolve as resolvePath } from "@std/path"; +import { gray } from "@std/fmt/colors"; import { importBundleModule } from "../libs/iac_utils.ts"; export const CONFIG_MAP_NAME = "helmet-whitelist"; diff --git a/src/deps/async_utils.ts b/src/deps/async_utils.ts deleted file mode 100644 index 7ade556..0000000 --- a/src/deps/async_utils.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@wok/utils@1.3.2/async"; diff --git a/src/deps/case.ts b/src/deps/case.ts deleted file mode 100644 index 4cffa09..0000000 --- a/src/deps/case.ts +++ /dev/null @@ -1 +0,0 @@ -export { pascalCase } from "jsr:@wok/case@1.0.1"; diff --git a/src/deps/cli_utils.ts b/src/deps/cli_utils.ts deleted file mode 100644 index 90f4ef1..0000000 --- a/src/deps/cli_utils.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@wok/utils@1.3.2/cli"; diff --git a/src/deps/exec_utils.ts b/src/deps/exec_utils.ts deleted file mode 100644 index 92a8763..0000000 --- a/src/deps/exec_utils.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@wok/utils@1.3.2/exec"; diff --git a/src/deps/k8s_utils.ts b/src/deps/k8s_utils.ts deleted file mode 100644 index 6b08de9..0000000 --- a/src/deps/k8s_utils.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@wok/utils@1.3.2/k8s"; diff --git a/src/deps/quote_shell.ts b/src/deps/quote_shell.ts deleted file mode 100644 index a185c11..0000000 --- a/src/deps/quote_shell.ts +++ /dev/null @@ -1 +0,0 @@ -export { quoteShell } from "jsr:@wok/utils@1.3.2/quote-shell"; diff --git a/src/deps/semver.ts b/src/deps/semver.ts deleted file mode 100644 index a62bac0..0000000 --- a/src/deps/semver.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { - format as semverFormat, - maxSatisfying as maxSatisfyingSemver, - parseRange as semverParseRange, - type Range as SemverRange, - type SemVer, - tryParse as semverTryParse, -} from "jsr:@std/semver@0.224.0"; diff --git a/src/deps/std_fmt_colors.ts b/src/deps/std_fmt_colors.ts deleted file mode 100644 index 60eef84..0000000 --- a/src/deps/std_fmt_colors.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@std/fmt@0.224.0/colors"; diff --git a/src/deps/std_fs.ts b/src/deps/std_fs.ts deleted file mode 100644 index c6a31d3..0000000 --- a/src/deps/std_fs.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { exists as fsExists } from "jsr:@std/fs@0.224.0/exists"; -export { expandGlob, expandGlobSync } from "jsr:@std/fs@0.224.0/expand-glob"; diff --git a/src/deps/std_io.ts b/src/deps/std_io.ts deleted file mode 100644 index 1f2ee28..0000000 --- a/src/deps/std_io.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { readLines } from "jsr:@std/io@0.224.0/read-lines"; -export { readerFromStreamReader } from "jsr:@std/io@0.224.0/reader-from-stream-reader"; diff --git a/src/deps/std_path.ts b/src/deps/std_path.ts deleted file mode 100644 index 9ca3512..0000000 --- a/src/deps/std_path.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { - basename, - dirname, - extname, - fromFileUrl, - join as joinPath, - resolve as resolvePath, -} from "jsr:@std/path@0.224.0"; diff --git a/src/deps/std_yaml.ts b/src/deps/std_yaml.ts deleted file mode 100644 index 2e971e5..0000000 --- a/src/deps/std_yaml.ts +++ /dev/null @@ -1 +0,0 @@ -export { parse as parseYaml, stringify as stringifyYaml } from "jsr:@std/yaml@0.224.0"; diff --git a/src/deps/typebox.ts b/src/deps/typebox.ts deleted file mode 100644 index b32e16b..0000000 --- a/src/deps/typebox.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@wok/utils@1.3.2/typebox"; diff --git a/src/deps/validation_utils.ts b/src/deps/validation_utils.ts deleted file mode 100644 index 3944b43..0000000 --- a/src/deps/validation_utils.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@wok/utils@1.3.2/validation"; diff --git a/src/helmet.ts b/src/helmet.ts index f6c3751..c7f48cc 100644 --- a/src/helmet.ts +++ b/src/helmet.ts @@ -6,9 +6,9 @@ import update from "./actions/update.ts"; import whitelistInstance from "./actions/whitelist_instance.ts"; import blacklistInstance from "./actions/blacklist_instance.ts"; import ensureInstanceWhitelisted from "./actions/ensure_instance_whitelisted.ts"; -import { CliProgram } from "./deps/cli_utils.ts"; +import { CliProgram } from "@wok/utils/cli"; import showVersion from "./actions/show_version.ts"; -import { bold, red } from "./deps/std_fmt_colors.ts"; +import { bold, red } from "@std/fmt/colors"; const program = new CliProgram() .addAction("compile", compile) diff --git a/src/libs/iac_utils.ts b/src/libs/iac_utils.ts index 8bc2c84..d4447af 100644 --- a/src/libs/iac_utils.ts +++ b/src/libs/iac_utils.ts @@ -1,10 +1,10 @@ -import { captureExec, inheritExec, NonZeroExitError, printErrLines } from "../deps/exec_utils.ts"; -import { type K8sCrd, K8sCrdKind, K8sCrdSchema, type K8sResource, K8sResourceSchema } from "../deps/k8s_utils.ts"; -import { expandGlob, fsExists } from "../deps/std_fs.ts"; -import { basename, dirname, fromFileUrl, joinPath } from "../deps/std_path.ts"; -import { parseYaml } from "../deps/std_yaml.ts"; -import { type Static, type TObject, type TProperties, Type } from "../deps/typebox.ts"; -import { createValidator, validate, type ValidationResult } from "../deps/validation_utils.ts"; +import { captureExec, inheritExec, NonZeroExitError, printErrLines } from "@wok/utils/exec"; +import { type K8sCrd, K8sCrdKind, K8sCrdSchema, type K8sResource, K8sResourceSchema } from "@wok/utils/k8s"; +import { exists as fsExists, expandGlob } from "@std/fs"; +import { basename, dirname, fromFileUrl, join as joinPath } from "@std/path"; +import { parse as parseYaml } from "@std/yaml"; +import { type Static, type TObject, type TProperties, Type } from "@wok/utils/typebox"; +import { createValidator, validate, type ValidationResult } from "@wok/utils/validation"; import { type ChartInstanceConfig, type ChartMetadata, @@ -14,9 +14,9 @@ import { KubectlClientVersionCmdOutputSchema, KubectlServerVersionCmdOutputSchema, } from "./types.ts"; -import { memoizePromise } from "../deps/async_utils.ts"; +import { memoizePromise } from "@wok/utils/async"; import { parseMultiDocumentsYaml, stringifyYamlRelaxed } from "./yaml_utils.ts"; -import { gray } from "../deps/std_fmt_colors.ts"; +import { gray } from "@std/fmt/colors"; export interface ImportDef { props: string[]; diff --git a/src/libs/types.ts b/src/libs/types.ts index bc8e2a3..612cbac 100644 --- a/src/libs/types.ts +++ b/src/libs/types.ts @@ -1,6 +1,6 @@ -import type { K8sCrd, K8sResource } from "../deps/k8s_utils.ts"; -import type { SemverRange } from "../deps/semver.ts"; -import { FlexObject, type Static, Type } from "../deps/typebox.ts"; +import type { K8sCrd, K8sResource } from "@wok/utils/k8s"; +import type { Range as SemverRange } from "@std/semver"; +import { FlexObject, type Static, Type } from "@wok/utils/typebox"; export const ChartRepoReleaseSchema = FlexObject({ apiVersion: Type.Optional(Type.String()), diff --git a/src/libs/yaml_utils.ts b/src/libs/yaml_utils.ts index de4ebb5..cb1ba5f 100644 --- a/src/libs/yaml_utils.ts +++ b/src/libs/yaml_utils.ts @@ -1,5 +1,5 @@ -import { stringifyYaml } from "../deps/std_yaml.ts"; -import { captureExec } from "../deps/exec_utils.ts"; +import { stringify as stringifyYaml } from "@std/yaml"; +import { captureExec } from "@wok/utils/exec"; export function stringifyYamlRelaxed(value: Record): string { try { diff --git a/src/mod.ts b/src/mod.ts index 8a251c3..6378719 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -1,5 +1,4 @@ -export * from "./deps/k8s_utils.ts"; -export * from "./deps/std_path.ts"; +export * from "@wok/utils/k8s"; export * from "./libs/iac_utils.ts"; export * from "./libs/types.ts"; export * from "./libs/patch_utils.ts";