@geekmidas/cli 10.0.0-alpha.26 → 10.0.0-alpha.27
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/{config-Dn9DW2Fz.cjs → config-7R_-WyHq.cjs} +24 -3
- package/dist/{config-Dn9DW2Fz.cjs.map → config-7R_-WyHq.cjs.map} +1 -1
- package/dist/{config-DBGpRTUy.mjs → config-DXrrYvob.mjs} +19 -4
- package/dist/{config-DBGpRTUy.mjs.map → config-DXrrYvob.mjs.map} +1 -1
- package/dist/config.cjs +3 -2
- package/dist/config.d.cts +12 -1
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +12 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +3 -3
- package/dist/{github-D5SBlOx5.mjs → github-Ba5kXEJo.mjs} +4 -4
- package/dist/{github-D5SBlOx5.mjs.map → github-Ba5kXEJo.mjs.map} +1 -1
- package/dist/{github-D58lt7RR.cjs → github-CQflOKKV.cjs} +4 -4
- package/dist/{github-D58lt7RR.cjs.map → github-CQflOKKV.cjs.map} +1 -1
- package/dist/{index-RCUizGxL.d.cts → index-BPN7kghQ.d.cts} +2 -12
- package/dist/{index-B4H4XF7A.d.mts.map → index-BPN7kghQ.d.cts.map} +1 -1
- package/dist/{index-B4H4XF7A.d.mts → index-BqWKWRm0.d.mts} +2 -12
- package/dist/{index-RCUizGxL.d.cts.map → index-BqWKWRm0.d.mts.map} +1 -1
- package/dist/index.cjs +100 -170
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +51 -121
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-DHQlstv6.mjs → openapi-3NLVvtz-.mjs} +2 -2
- package/dist/{openapi-DHQlstv6.mjs.map → openapi-3NLVvtz-.mjs.map} +1 -1
- package/dist/{openapi-BAKQLho-.cjs → openapi-rhJdy2GC.cjs} +2 -2
- package/dist/{openapi-BAKQLho-.cjs.map → openapi-rhJdy2GC.cjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.mjs +1 -1
- package/dist/{generator-LfZU7NlU.mjs → reconcile-DhbCvh4K.mjs} +111 -2
- package/dist/reconcile-DhbCvh4K.mjs.map +1 -0
- package/dist/{generator-Wdfp0jCS.cjs → reconcile-szmJw_Sb.cjs} +130 -3
- package/dist/reconcile-szmJw_Sb.cjs.map +1 -0
- package/dist/{transfer-CAJs_vhu.mjs → transfer-BV00TxZv.mjs} +4 -4
- package/dist/{transfer-CAJs_vhu.mjs.map → transfer-BV00TxZv.mjs.map} +1 -1
- package/dist/{transfer-D2qLFXsw.cjs → transfer-BYIn7z8m.cjs} +4 -4
- package/dist/{transfer-D2qLFXsw.cjs.map → transfer-BYIn7z8m.cjs.map} +1 -1
- package/dist/workspace/index.cjs +1 -2
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +2 -2
- package/dist/{workspace-CRD9YinV.cjs → workspace-Bav3TVrP.cjs} +47 -78
- package/dist/workspace-Bav3TVrP.cjs.map +1 -0
- package/dist/{credentials-DI9kJcaP.mjs → workspace-CUmR_k4J.mjs} +228 -492
- package/dist/workspace-CUmR_k4J.mjs.map +1 -0
- package/dist/{credentials-fQSAe4Nb.cjs → workspace-DgeVgxmm.cjs} +229 -517
- package/dist/workspace-DgeVgxmm.cjs.map +1 -0
- package/dist/{workspace-Bu3xNCej.mjs → workspace-T4IVGSoB.mjs} +48 -73
- package/dist/workspace-T4IVGSoB.mjs.map +1 -0
- package/package.json +14 -14
- package/dist/credentials-DI9kJcaP.mjs.map +0 -1
- package/dist/credentials-fQSAe4Nb.cjs.map +0 -1
- package/dist/generator-LfZU7NlU.mjs.map +0 -1
- package/dist/generator-Wdfp0jCS.cjs.map +0 -1
- package/dist/reconcile-gb1lz1Dk.mjs +0 -113
- package/dist/reconcile-gb1lz1Dk.mjs.map +0 -1
- package/dist/reconcile-hx_vBvux.cjs +0 -136
- package/dist/reconcile-hx_vBvux.cjs.map +0 -1
- package/dist/workspace-Bu3xNCej.mjs.map +0 -1
- package/dist/workspace-CRD9YinV.cjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
2
|
import { n as __require, t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
3
3
|
import { i as DEFAULT_CACHE, r as ConstructGenerator, s as isPartitionedRoutes, t as discover } from "./discover-0fhCbnk0.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { C as providerOf, S as eventsBackendFor, _ as COMPOSE_PATH, a as loadEnvFiles, b as resourceName, c as resolveServicePorts, d as backendsOf, f as constructGlobs, h as usesConstructs, i as isPortAvailable, l as rewriteUrlsWithPorts, m as reconcileWorkspace, n as createEntryWrapper, o as loadSecretsForApp, p as derivedContainers, r as findAvailablePort, s as prepareEntryCredentials, t as createCredentialsPreload, u as startWorkspaceServices, v as LOCAL_CA_PATH, w as storageBackendFor, x as cacheBackendFor, y as applyPostgres } from "./credentials-DI9kJcaP.mjs";
|
|
7
|
-
import { a as generateServiceCredentials, i as generateSecurePassword, n as generateConnectionUrls, o as rotateServicePassword, t as createStageSecrets } from "./generator-LfZU7NlU.mjs";
|
|
4
|
+
import { a as loadConfig, c as parseModuleConfig, i as loadAppConfig, r as getAppNameFromCwd, s as loadWorkspaceConfig, u as derivedApps } from "./config-DXrrYvob.mjs";
|
|
5
|
+
import { D as assertDeployedStage, E as TEST_STAGE, O as deployedProblems, T as InvalidStages, a as getAppBuildOrder, b as getDeployTargetError, k as stageProblems, m as stripPublicPrefix, o as getAppGkmConfig, p as getPublicEnvPrefix, t as allConstructGlobs, x as isDeployTargetSupported } from "./workspace-T4IVGSoB.mjs";
|
|
8
6
|
import { c as getKeyPath, i as setCustomSecret, n as readStageSecrets, o as toEmbeddableSecrets, r as secretsExist, s as writeStageSecrets, t as maskPassword } from "./storage-TP0x118M.mjs";
|
|
9
|
-
import {
|
|
7
|
+
import { _ as isPortAvailable, b as prepareEntryCredentials, c as applyPostgres, d as eventsBackendFor, f as providerOf, g as findAvailablePort, h as createEntryWrapper, i as reconcileWorkspace, l as resourceName, m as createCredentialsPreload, n as constructGlobs, o as COMPOSE_PATH, p as storageBackendFor, r as derivedContainers, s as LOCAL_CA_PATH, t as backendsOf, u as cacheBackendFor, v as loadEnvFiles, y as loadSecretsForApp } from "./workspace-CUmR_k4J.mjs";
|
|
8
|
+
import { a as openapiCommand, c as EndpointGenerator, l as runtimeFor, n as generateOpenApi, o as resolveOpenApiConfig, s as OpenApiTsGenerator, t as OPENAPI_OUTPUT_PATH$1 } from "./openapi-3NLVvtz-.mjs";
|
|
10
9
|
import { i as withRoutes, r as withCompute } from "./emit-Bzq7JsMP.mjs";
|
|
11
|
-
import { i as writeDockerEnvFromSecrets, r as generateFullstackCustomSecrets } from "./reconcile-
|
|
12
|
-
import { a as isRemoteStore, n as pullStageSecrets, r as pushStageSecrets, t as NoStoredSecrets } from "./transfer-
|
|
10
|
+
import { a as createStageSecrets, c as generateServiceCredentials, i as writeDockerEnvFromSecrets, l as rotateServicePassword, o as generateConnectionUrls, r as generateFullstackCustomSecrets, s as generateSecurePassword } from "./reconcile-DhbCvh4K.mjs";
|
|
11
|
+
import { a as isRemoteStore, n as pullStageSecrets, r as pushStageSecrets, t as NoStoredSecrets } from "./transfer-BV00TxZv.mjs";
|
|
13
12
|
import { createRequire } from "node:module";
|
|
14
13
|
import { Command } from "commander";
|
|
15
14
|
import { stdin, stdout } from "node:process";
|
|
@@ -22,13 +21,13 @@ import { execFile, execSync, spawn } from "node:child_process";
|
|
|
22
21
|
import { cacheTable, canonicalId, cloudName, cookieDomain, dependentsOf, kebabCase, provideKey, provisionOrder, scopedName, serviceKey } from "@geekmidas/manifest";
|
|
23
22
|
import fg from "fast-glob";
|
|
24
23
|
import chokidar from "chokidar";
|
|
25
|
-
import { parse as parse$1, parseDocument } from "yaml";
|
|
26
24
|
import { createCipheriv, createHash, randomBytes } from "node:crypto";
|
|
25
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
27
26
|
import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
|
|
28
27
|
import { Client } from "pg";
|
|
28
|
+
import { parse as parse$1, parseDocument } from "yaml";
|
|
29
29
|
import { promisify } from "node:util";
|
|
30
30
|
import { cacheTableStatements } from "@geekmidas/cache/postgres";
|
|
31
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
32
31
|
import { Cron } from "@geekmidas/constructs/crons";
|
|
33
32
|
import { Function } from "@geekmidas/constructs/functions";
|
|
34
33
|
import { Queue } from "@geekmidas/constructs/queue";
|
|
@@ -39,7 +38,7 @@ import prompts from "prompts";
|
|
|
39
38
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
40
39
|
import { serviceContext } from "@geekmidas/services";
|
|
41
40
|
//#region package.json
|
|
42
|
-
var version = "10.0.0-alpha.
|
|
41
|
+
var version = "10.0.0-alpha.27";
|
|
43
42
|
//#endregion
|
|
44
43
|
//#region src/auth/credentials.ts
|
|
45
44
|
/**
|
|
@@ -431,10 +430,7 @@ async function execCommand(commandArgs, options = {}) {
|
|
|
431
430
|
if (!commandArgs[0]) throw new NoCommandSpecified();
|
|
432
431
|
const defaultEnv = loadEnvFiles(".env");
|
|
433
432
|
if (defaultEnv.loaded.length > 0) logger$12.log(`📦 Loaded env: ${defaultEnv.loaded.join(", ")}`);
|
|
434
|
-
const { credentials, secretsJsonPath, appName } = await prepareEntryCredentials({
|
|
435
|
-
cwd,
|
|
436
|
-
resolveDockerPorts: "readonly"
|
|
437
|
-
});
|
|
433
|
+
const { credentials, secretsJsonPath, appName } = await prepareEntryCredentials({ cwd });
|
|
438
434
|
if (appName) logger$12.log(`📦 App: ${appName}`);
|
|
439
435
|
const secretCount = Object.keys(credentials).filter((k) => k !== "PORT").length;
|
|
440
436
|
if (secretCount > 0) logger$12.log(`🔐 Loaded ${secretCount} secret(s)`);
|
|
@@ -592,6 +588,7 @@ async function devCommand(options) {
|
|
|
592
588
|
return workspaceDevCommand(loadedConfig.workspace, options);
|
|
593
589
|
}
|
|
594
590
|
config = loadedConfig.raw;
|
|
591
|
+
workspace = loadedConfig.workspace;
|
|
595
592
|
}
|
|
596
593
|
else {
|
|
597
594
|
const loadedConfig = await loadWorkspaceConfig();
|
|
@@ -636,24 +633,13 @@ async function devCommand(options) {
|
|
|
636
633
|
const runtime = config.runtime ?? "node";
|
|
637
634
|
let secretsJsonPath;
|
|
638
635
|
const appSecrets = await loadSecretsForApp(secretsRoot, config.stages.local, workspaceAppName);
|
|
639
|
-
if (workspace
|
|
636
|
+
if (workspace) {
|
|
640
637
|
const reconciled = await reconcileWorkspace(workspace, { stage: workspace.stages.local });
|
|
641
638
|
if (reconciled.changed && reconciled.plan.containers.length > 0) {
|
|
642
639
|
logger$11.log(`🐳 Services: ${reconciled.plan.containers.join(", ")}`);
|
|
643
640
|
for (const [container, address] of Object.entries(reconciled.addresses)) logger$11.log(` ${container}: ${address}`);
|
|
644
641
|
}
|
|
645
642
|
Object.assign(appSecrets, reconciled.env);
|
|
646
|
-
} else {
|
|
647
|
-
const resolvedPorts = await resolveServicePorts(secretsRoot);
|
|
648
|
-
if (Object.keys(resolvedPorts.ports).length > 0) {
|
|
649
|
-
const rewritten = rewriteUrlsWithPorts(appSecrets, resolvedPorts);
|
|
650
|
-
Object.assign(appSecrets, rewritten);
|
|
651
|
-
logger$11.log(`🔌 Applied ${Object.keys(resolvedPorts.ports).length} port mapping(s)`);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
if (workspace && workspaceAppName) {
|
|
655
|
-
const depEnv = getDependencyEnvVars(workspace, workspaceAppName);
|
|
656
|
-
for (const [key, value] of Object.entries(depEnv)) appSecrets[key] ??= value;
|
|
657
643
|
}
|
|
658
644
|
if (Object.keys(appSecrets).length > 0) {
|
|
659
645
|
const secretsDir = join(secretsRoot, ".gkm");
|
|
@@ -722,19 +708,6 @@ async function devCommand(options) {
|
|
|
722
708
|
process.on("SIGTERM", shutdown);
|
|
723
709
|
}
|
|
724
710
|
/**
|
|
725
|
-
* Generate all dependency environment variables for all apps.
|
|
726
|
-
* Returns a flat object with all {APP_NAME}_URL variables.
|
|
727
|
-
* @internal Exported for testing
|
|
728
|
-
*/
|
|
729
|
-
function generateAllDependencyEnvVars(workspace, urlPrefix = "http://localhost") {
|
|
730
|
-
const env = {};
|
|
731
|
-
for (const appName of Object.keys(workspace.apps)) {
|
|
732
|
-
const appEnv = getDependencyEnvVars(workspace, appName, urlPrefix);
|
|
733
|
-
Object.assign(env, appEnv);
|
|
734
|
-
}
|
|
735
|
-
return env;
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
711
|
* Check for port conflicts across all apps.
|
|
739
712
|
* Returns list of conflicts if any ports are duplicated.
|
|
740
713
|
* @internal Exported for testing
|
|
@@ -959,38 +932,26 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
959
932
|
logger$11.log("✅ Frontend apps validated");
|
|
960
933
|
}
|
|
961
934
|
const rawSecrets = await loadDevSecrets(workspace);
|
|
962
|
-
|
|
935
|
+
const reconciled = await reconcileWorkspace(workspace, { stage: workspace.stages.local });
|
|
936
|
+
if (reconciled.changed && reconciled.plan.containers.length > 0) {
|
|
937
|
+
logger$11.log(`🐳 Services: ${reconciled.plan.containers.join(", ")}`);
|
|
938
|
+
for (const [container, address] of Object.entries(reconciled.addresses)) logger$11.log(` ${container}: ${address}`);
|
|
939
|
+
}
|
|
940
|
+
const secretsEnv = {
|
|
941
|
+
...rawSecrets,
|
|
942
|
+
...reconciled.env
|
|
943
|
+
};
|
|
963
944
|
const appUrls = {};
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
for (const [container, address] of Object.entries(reconciled.addresses)) logger$11.log(` ${container}: ${address}`);
|
|
969
|
-
}
|
|
970
|
-
secretsEnv = {
|
|
971
|
-
...rawSecrets,
|
|
972
|
-
...reconciled.env
|
|
973
|
-
};
|
|
974
|
-
for (const resource of reconciled.plan.resources) {
|
|
975
|
-
if (resource.kind !== "rest-api" && resource.kind !== "site") continue;
|
|
976
|
-
const address = reconciled.env[resource.envKey];
|
|
977
|
-
if (address) appUrls[resource.id] = address;
|
|
978
|
-
}
|
|
979
|
-
} else {
|
|
980
|
-
const resolvedPorts = await resolveServicePorts(workspace.root);
|
|
981
|
-
await startWorkspaceServices(workspace, resolvedPorts.dockerEnv, rawSecrets);
|
|
982
|
-
secretsEnv = rewriteUrlsWithPorts(rawSecrets, resolvedPorts);
|
|
945
|
+
for (const resource of reconciled.plan.resources) {
|
|
946
|
+
if (resource.kind !== "rest-api" && resource.kind !== "site") continue;
|
|
947
|
+
const address = reconciled.env[resource.envKey];
|
|
948
|
+
if (address) appUrls[resource.id] = address;
|
|
983
949
|
}
|
|
984
950
|
if (Object.keys(secretsEnv).length > 0) logger$11.log(` Loaded ${Object.keys(secretsEnv).length} secret(s)`);
|
|
985
951
|
if (Object.keys(appUrls).length > 0) {
|
|
986
952
|
logger$11.log("🔒 App URLs:");
|
|
987
953
|
for (const [id, address] of Object.entries(appUrls)) logger$11.log(` ${id}: ${address}`);
|
|
988
954
|
}
|
|
989
|
-
const dependencyEnv = Object.fromEntries(Object.entries(generateAllDependencyEnvVars(workspace)).filter(([key]) => secretsEnv[key] === void 0));
|
|
990
|
-
if (Object.keys(dependencyEnv).length > 0) {
|
|
991
|
-
logger$11.log("📡 Dependency URLs:");
|
|
992
|
-
for (const [key, value] of Object.entries(dependencyEnv)) logger$11.log(` ${key}=${value}`);
|
|
993
|
-
}
|
|
994
955
|
let turboFilter = [];
|
|
995
956
|
if (options.app) {
|
|
996
957
|
if (!workspace.apps[options.app]) {
|
|
@@ -1033,7 +994,6 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
1033
994
|
const turboEnv = {
|
|
1034
995
|
...process.env,
|
|
1035
996
|
...secretsEnv,
|
|
1036
|
-
...dependencyEnv,
|
|
1037
997
|
NODE_ENV: "development",
|
|
1038
998
|
...configPath ? { GKM_CONFIG_PATH: configPath } : {}
|
|
1039
999
|
};
|
|
@@ -3567,10 +3527,6 @@ var UnprovisionableBucket = class extends Error {
|
|
|
3567
3527
|
*/
|
|
3568
3528
|
/**
|
|
3569
3529
|
* Provision everything the workspace declares, and return what it resolved.
|
|
3570
|
-
*
|
|
3571
|
-
* Nothing happens for a project that has not adopted the model: `usesConstructs`
|
|
3572
|
-
* is the same hard switch reconcile reads, so an existing deploy is untouched
|
|
3573
|
-
* until it declares something.
|
|
3574
3530
|
*/
|
|
3575
3531
|
async function provisionDeclared(options) {
|
|
3576
3532
|
const { workspace } = options;
|
|
@@ -3580,7 +3536,6 @@ async function provisionDeclared(options) {
|
|
|
3580
3536
|
provisioned: {},
|
|
3581
3537
|
clusters: {}
|
|
3582
3538
|
};
|
|
3583
|
-
if (!usesConstructs(workspace)) return empty;
|
|
3584
3539
|
const manifest = options.manifest ?? await discover({
|
|
3585
3540
|
patterns: constructGlobs(workspace),
|
|
3586
3541
|
cwd: workspace.root
|
|
@@ -8586,26 +8541,26 @@ function loadPackageJson() {
|
|
|
8586
8541
|
* Run: pnpm --filter @geekmidas/cli sync-versions
|
|
8587
8542
|
*/
|
|
8588
8543
|
const GEEKMIDAS_VERSIONS = {
|
|
8589
|
-
"@geekmidas/audit": "~10.0.0-alpha.
|
|
8590
|
-
"@geekmidas/auth": "~10.0.0-alpha.
|
|
8591
|
-
"@geekmidas/cache": "~10.0.0-alpha.
|
|
8592
|
-
"@geekmidas/client": "~10.0.0-alpha.
|
|
8593
|
-
"@geekmidas/cloud": "~10.0.0-alpha.
|
|
8594
|
-
"@geekmidas/constructs": "~10.0.0-alpha.
|
|
8595
|
-
"@geekmidas/db": "~10.0.0-alpha.
|
|
8596
|
-
"@geekmidas/emailkit": "~10.0.0-alpha.
|
|
8597
|
-
"@geekmidas/envkit": "~10.0.0-alpha.
|
|
8598
|
-
"@geekmidas/errors": "~10.0.0-alpha.
|
|
8599
|
-
"@geekmidas/events": "~10.0.0-alpha.
|
|
8600
|
-
"@geekmidas/logger": "~10.0.0-alpha.
|
|
8601
|
-
"@geekmidas/manifest": "~10.0.0-alpha.
|
|
8602
|
-
"@geekmidas/rate-limit": "~10.0.0-alpha.
|
|
8603
|
-
"@geekmidas/schema": "~10.0.0-alpha.
|
|
8604
|
-
"@geekmidas/services": "~10.0.0-alpha.
|
|
8605
|
-
"@geekmidas/storage": "~10.0.0-alpha.
|
|
8606
|
-
"@geekmidas/studio": "~10.0.0-alpha.
|
|
8607
|
-
"@geekmidas/telescope": "~10.0.0-alpha.
|
|
8608
|
-
"@geekmidas/testkit": "~10.0.0-alpha.
|
|
8544
|
+
"@geekmidas/audit": "~10.0.0-alpha.27",
|
|
8545
|
+
"@geekmidas/auth": "~10.0.0-alpha.27",
|
|
8546
|
+
"@geekmidas/cache": "~10.0.0-alpha.27",
|
|
8547
|
+
"@geekmidas/client": "~10.0.0-alpha.27",
|
|
8548
|
+
"@geekmidas/cloud": "~10.0.0-alpha.27",
|
|
8549
|
+
"@geekmidas/constructs": "~10.0.0-alpha.27",
|
|
8550
|
+
"@geekmidas/db": "~10.0.0-alpha.27",
|
|
8551
|
+
"@geekmidas/emailkit": "~10.0.0-alpha.27",
|
|
8552
|
+
"@geekmidas/envkit": "~10.0.0-alpha.27",
|
|
8553
|
+
"@geekmidas/errors": "~10.0.0-alpha.27",
|
|
8554
|
+
"@geekmidas/events": "~10.0.0-alpha.27",
|
|
8555
|
+
"@geekmidas/logger": "~10.0.0-alpha.27",
|
|
8556
|
+
"@geekmidas/manifest": "~10.0.0-alpha.27",
|
|
8557
|
+
"@geekmidas/rate-limit": "~10.0.0-alpha.27",
|
|
8558
|
+
"@geekmidas/schema": "~10.0.0-alpha.27",
|
|
8559
|
+
"@geekmidas/services": "~10.0.0-alpha.27",
|
|
8560
|
+
"@geekmidas/storage": "~10.0.0-alpha.27",
|
|
8561
|
+
"@geekmidas/studio": "~10.0.0-alpha.27",
|
|
8562
|
+
"@geekmidas/telescope": "~10.0.0-alpha.27",
|
|
8563
|
+
"@geekmidas/testkit": "~10.0.0-alpha.27",
|
|
8609
8564
|
"@geekmidas/cli": `~${loadPackageJson().version}`
|
|
8610
8565
|
};
|
|
8611
8566
|
//#endregion
|
|
@@ -15551,7 +15506,6 @@ async function testCommand(options = {}) {
|
|
|
15551
15506
|
stage,
|
|
15552
15507
|
startDocker: !options.prepare,
|
|
15553
15508
|
secretsFileName: "test-secrets.json",
|
|
15554
|
-
resolveDockerPorts: "full",
|
|
15555
15509
|
reconcileStage: "test"
|
|
15556
15510
|
});
|
|
15557
15511
|
let finalCredentials = { ...result.credentials };
|
|
@@ -15565,14 +15519,13 @@ async function testCommand(options = {}) {
|
|
|
15565
15519
|
console.log(` 🔍 Sniffed ${sniffed.requiredEnvVars.length} required env var(s)` + (result.declaredKeys.length > 0 ? `, kept ${result.declaredKeys.length} declared` : ""));
|
|
15566
15520
|
}
|
|
15567
15521
|
}
|
|
15568
|
-
finalCredentials = rewriteDatabaseUrlForTests(finalCredentials);
|
|
15569
15522
|
console.log("");
|
|
15570
15523
|
await writeFile(result.secretsJsonPath, JSON.stringify(finalCredentials, null, 2));
|
|
15571
15524
|
const gkmDir = join(cwd, ".gkm");
|
|
15572
15525
|
const preloadPath = join(gkmDir, "test-credentials-preload.ts");
|
|
15573
15526
|
await createCredentialsPreload(preloadPath, result.secretsJsonPath);
|
|
15574
15527
|
const workspace = await loadWorkspaceConfig(cwd).then((loaded) => loaded.workspace).catch(() => void 0);
|
|
15575
|
-
const manifestPath = workspace
|
|
15528
|
+
const manifestPath = workspace ? await writeTestHarness({
|
|
15576
15529
|
root: workspace.root,
|
|
15577
15530
|
targets: [workspace.root, ...Object.values(workspace.apps).map((app) => isAbsolute(app.path) ? app.path : join(workspace.root, app.path))],
|
|
15578
15531
|
patterns: constructGlobs(workspace),
|
|
@@ -15616,29 +15569,6 @@ async function testCommand(options = {}) {
|
|
|
15616
15569
|
});
|
|
15617
15570
|
});
|
|
15618
15571
|
}
|
|
15619
|
-
const TEST_DB_SUFFIX = "_test";
|
|
15620
|
-
/**
|
|
15621
|
-
* Rewrite DATABASE_URL to point to a separate test database.
|
|
15622
|
-
* Appends `_test` to the database name (e.g., `app` -> `app_test`).
|
|
15623
|
-
* @internal Exported for testing
|
|
15624
|
-
*/
|
|
15625
|
-
function rewriteDatabaseUrlForTests(env) {
|
|
15626
|
-
const result = { ...env };
|
|
15627
|
-
for (const key of Object.keys(result)) {
|
|
15628
|
-
if (!key.includes("DATABASE_URL")) continue;
|
|
15629
|
-
const value = result[key];
|
|
15630
|
-
try {
|
|
15631
|
-
const url = new URL(value);
|
|
15632
|
-
const dbName = url.pathname.slice(1);
|
|
15633
|
-
if (dbName && !dbName.endsWith(TEST_DB_SUFFIX)) {
|
|
15634
|
-
url.pathname = `/${dbName}${TEST_DB_SUFFIX}`;
|
|
15635
|
-
result[key] = url.toString();
|
|
15636
|
-
console.log(` 🧪 ${key}: using test database "${dbName}${TEST_DB_SUFFIX}"`);
|
|
15637
|
-
}
|
|
15638
|
-
} catch {}
|
|
15639
|
-
}
|
|
15640
|
-
return result;
|
|
15641
|
-
}
|
|
15642
15572
|
/** `gkm test` outside a project that declares stages, with none named. */
|
|
15643
15573
|
var NoStageToTest = class extends Error {
|
|
15644
15574
|
constructor() {
|
|
@@ -16179,7 +16109,7 @@ program.command("secrets:push").description("Send a deployed stage's secrets to
|
|
|
16179
16109
|
const globalOptions = program.opts();
|
|
16180
16110
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
16181
16111
|
const { loadWorkspaceConfig } = await import("./config.mjs");
|
|
16182
|
-
const { pushStageSecrets } = await import("./transfer-
|
|
16112
|
+
const { pushStageSecrets } = await import("./transfer-BV00TxZv.mjs").then((n) => n.i);
|
|
16183
16113
|
const { workspace } = await loadWorkspaceConfig();
|
|
16184
16114
|
const { addedKeys } = await pushStageSecrets(workspace, options.stage, { profile: options.profile });
|
|
16185
16115
|
for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
|
|
@@ -16194,7 +16124,7 @@ program.command("secrets:pull").description("Bring a deployed stage's secrets fr
|
|
|
16194
16124
|
const globalOptions = program.opts();
|
|
16195
16125
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
16196
16126
|
const { loadWorkspaceConfig } = await import("./config.mjs");
|
|
16197
|
-
const { pullStageSecrets } = await import("./transfer-
|
|
16127
|
+
const { pullStageSecrets } = await import("./transfer-BV00TxZv.mjs").then((n) => n.i);
|
|
16198
16128
|
const { workspace } = await loadWorkspaceConfig();
|
|
16199
16129
|
const { addedKeys } = await pullStageSecrets(workspace, options.stage, { profile: options.profile });
|
|
16200
16130
|
for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
|
|
@@ -16209,7 +16139,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
16209
16139
|
const globalOptions = program.opts();
|
|
16210
16140
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
16211
16141
|
const { loadWorkspaceConfig } = await import("./config.mjs");
|
|
16212
|
-
const { reconcileMissingSecrets } = await import("./reconcile-
|
|
16142
|
+
const { reconcileMissingSecrets } = await import("./reconcile-DhbCvh4K.mjs").then((n) => n.n);
|
|
16213
16143
|
const { readStageSecrets, writeStageSecrets } = await import("./storage-TP0x118M.mjs").then((n) => n.a);
|
|
16214
16144
|
const { workspace } = await loadWorkspaceConfig();
|
|
16215
16145
|
const stage = options.stage ?? workspace.stages.local;
|
|
@@ -16218,7 +16148,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
16218
16148
|
console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
|
|
16219
16149
|
process.exit(1);
|
|
16220
16150
|
}
|
|
16221
|
-
const { derivedContainers } = await import("./
|
|
16151
|
+
const { derivedContainers } = await import("./workspace-CUmR_k4J.mjs").then((n) => n.a);
|
|
16222
16152
|
const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
|
|
16223
16153
|
if (!result) {
|
|
16224
16154
|
console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);
|
|
@@ -16277,7 +16207,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
|
|
|
16277
16207
|
try {
|
|
16278
16208
|
const globalOptions = program.opts();
|
|
16279
16209
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
16280
|
-
const { deployGithubCommand } = await import("./github-
|
|
16210
|
+
const { deployGithubCommand } = await import("./github-Ba5kXEJo.mjs");
|
|
16281
16211
|
await deployGithubCommand(options);
|
|
16282
16212
|
} catch (error) {
|
|
16283
16213
|
console.error(formatError(error));
|