@geekmidas/cli 10.0.0-alpha.6 → 10.0.0-alpha.9
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 +12 -8
- package/bin/adjacent-tsconfig.mjs +59 -0
- package/bin/gkm.mjs +7 -1
- package/dist/{config-CNz5KaSR.cjs → config-BZ1F0WuA.cjs} +6 -50
- package/dist/config-BZ1F0WuA.cjs.map +1 -0
- package/dist/{config-CxP7P-qG.mjs → config-DVVph9yz.mjs} +7 -45
- package/dist/config-DVVph9yz.mjs.map +1 -0
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +2 -2
- package/dist/{credentials-DzsXZzkx.cjs → credentials-Xamqe_NJ.cjs} +19 -18
- package/dist/credentials-Xamqe_NJ.cjs.map +1 -0
- package/dist/{credentials-BK3Z93MX.mjs → credentials-dP8vRVRv.mjs} +19 -18
- package/dist/credentials-dP8vRVRv.mjs.map +1 -0
- package/dist/discover-CAlFgYec.mjs.map +1 -1
- package/dist/discover-DTmFeloL.cjs.map +1 -1
- package/dist/{index-BGGdjueF.d.cts → index-C6e-ULLx.d.mts} +2 -2
- package/dist/index-C6e-ULLx.d.mts.map +1 -0
- package/dist/{index-DEbaleny.d.mts → index-CR5urhWX.d.cts} +2 -2
- package/dist/index-CR5urhWX.d.cts.map +1 -0
- package/dist/index.cjs +596 -248
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +596 -248
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-D-dx9Akj.cjs → openapi-SjsgARie.cjs} +4 -4
- package/dist/{openapi-D-dx9Akj.cjs.map → openapi-SjsgARie.cjs.map} +1 -1
- package/dist/{openapi-Bw8DWFWz.mjs → openapi-Xx0A7Wg0.mjs} +4 -4
- package/dist/{openapi-Bw8DWFWz.mjs.map → openapi-Xx0A7Wg0.mjs.map} +1 -1
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.d.cts +3 -3
- package/dist/openapi.d.mts +3 -3
- package/dist/openapi.mjs +3 -3
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{setup-DGIPd2fh.mjs → setup-BA8ciTPU.mjs} +4 -4
- package/dist/setup-BsZvZP6f.cjs +11 -0
- package/dist/{setup-BWMhbW-p.mjs → setup-C8KOx8_8.mjs} +5 -5
- package/dist/setup-C8KOx8_8.mjs.map +1 -0
- package/dist/{setup-D7L4BgBT.cjs → setup-hC6hI86f.cjs} +5 -5
- package/dist/setup-hC6hI86f.cjs.map +1 -0
- package/dist/{types-BLSNdrk0.d.cts → types-6pkp2RRj.d.mts} +48 -4
- package/dist/types-6pkp2RRj.d.mts.map +1 -0
- package/dist/{types-C3POXhw3.d.mts → types-Y3fKQSAK.d.cts} +45 -1
- package/dist/types-Y3fKQSAK.d.cts.map +1 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/workspace-BzrG_2SI.mjs +8 -0
- package/dist/{workspace-LKiNyaDy.cjs → workspace-C6VJQVtG.cjs} +79 -1
- package/dist/workspace-C6VJQVtG.cjs.map +1 -0
- package/dist/{workspace-CGaUAw5A.cjs → workspace-XXtNhqJl.cjs} +3 -3
- package/dist/{workspace-DIuZx-cc.mjs → workspace-zoqRbihZ.mjs} +62 -2
- package/dist/workspace-zoqRbihZ.mjs.map +1 -0
- package/package.json +14 -13
- package/dist/config-CNz5KaSR.cjs.map +0 -1
- package/dist/config-CxP7P-qG.mjs.map +0 -1
- package/dist/credentials-BK3Z93MX.mjs.map +0 -1
- package/dist/credentials-DzsXZzkx.cjs.map +0 -1
- package/dist/index-BGGdjueF.d.cts.map +0 -1
- package/dist/index-DEbaleny.d.mts.map +0 -1
- package/dist/setup-8IWPsRIN.cjs +0 -11
- package/dist/setup-BWMhbW-p.mjs.map +0 -1
- package/dist/setup-D7L4BgBT.cjs.map +0 -1
- package/dist/types-BLSNdrk0.d.cts.map +0 -1
- package/dist/types-C3POXhw3.d.mts.map +0 -1
- package/dist/workspace-CnTqIlB3.mjs +0 -8
- package/dist/workspace-DIuZx-cc.mjs.map +0 -1
- package/dist/workspace-LKiNyaDy.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_CACHE, DEFAULT_EMAIL, DEFAULT_STORAGE, discover } from "./discover-CAlFgYec.mjs";
|
|
2
|
-
import { appKey, getAppNameFromCwd, hostOf, loadWorkspaceAppInfo } from "./config-
|
|
3
|
-
import { allConstructGlobs, getDependencyEnvVars } from "./workspace-
|
|
2
|
+
import { appKey, getAppNameFromCwd, hostOf, loadWorkspaceAppInfo } from "./config-DVVph9yz.mjs";
|
|
3
|
+
import { allConstructGlobs, getDependencyEnvVars } from "./workspace-zoqRbihZ.mjs";
|
|
4
4
|
import { generatePgBossUrl } from "./generator-VE2JrFlY.mjs";
|
|
5
5
|
import { readStageSecrets, secretsExist, toEmbeddableSecrets } from "./storage-Bi24WfoW.mjs";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -795,8 +795,6 @@ const dockerCli = {
|
|
|
795
795
|
|
|
796
796
|
//#endregion
|
|
797
797
|
//#region src/reconcile/plan.ts
|
|
798
|
-
/** The stage whose resources carry no suffix. */
|
|
799
|
-
const DEFAULT_STAGE = "development";
|
|
800
798
|
/**
|
|
801
799
|
* Which container serves a kind.
|
|
802
800
|
*
|
|
@@ -915,13 +913,13 @@ const SEPARATORS = {
|
|
|
915
913
|
/**
|
|
916
914
|
* The stage-scoped name for a resource.
|
|
917
915
|
*
|
|
918
|
-
* The
|
|
919
|
-
* developer's psql history, saved connections, and muscle memory survive
|
|
920
|
-
* change. Every other stage is suffixed.
|
|
916
|
+
* The local stage carries no suffix, so `gkm dev` keeps using `orders` and a
|
|
917
|
+
* developer's psql history, saved connections, and muscle memory survive a
|
|
918
|
+
* change of stage name. Every other stage is suffixed.
|
|
921
919
|
*/
|
|
922
|
-
function resourceName(id, kind, stage) {
|
|
920
|
+
function resourceName(id, kind, stage, localStage) {
|
|
923
921
|
const base = id.toLowerCase();
|
|
924
|
-
if (stage ===
|
|
922
|
+
if (stage === localStage) return base;
|
|
925
923
|
return `${base}${SEPARATORS[kind] ?? "-"}${stage}`;
|
|
926
924
|
}
|
|
927
925
|
/**
|
|
@@ -965,7 +963,7 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
965
963
|
id,
|
|
966
964
|
kind: declaration.kind,
|
|
967
965
|
...container ? { container } : {},
|
|
968
|
-
name: resourceName(id, declaration.kind, stage),
|
|
966
|
+
name: resourceName(id, declaration.kind, stage, options.localStage),
|
|
969
967
|
envKey: providedKeyFor(id, declaration.kind, ROLES[declaration.kind] ?? "url"),
|
|
970
968
|
provisions: PROVISIONS[declaration.kind] === true,
|
|
971
969
|
...declaration.kind === "rest-api" ? { callers: dependentsOf(manifest, id) } : {},
|
|
@@ -1840,6 +1838,7 @@ const CADDY_ROOT_IN_CONTAINER = "/data/caddy/pki/authorities/local/root.crt";
|
|
|
1840
1838
|
async function reconcile(options) {
|
|
1841
1839
|
const { root, project, manifest, stage, start = true, provision = true, docker = dockerCli, probe = isPortFree, sql = pgClient, buckets = bucketClient } = options;
|
|
1842
1840
|
const plan = planFor(manifest, stage, provisionOrder(manifest), {
|
|
1841
|
+
localStage: options.localStage,
|
|
1843
1842
|
events: options.events,
|
|
1844
1843
|
cache: options.cache,
|
|
1845
1844
|
extraContainers: options.extraContainers,
|
|
@@ -1999,6 +1998,7 @@ async function derivedContainers(workspace, stage, manifest) {
|
|
|
1999
1998
|
cwd: workspace.root
|
|
2000
1999
|
});
|
|
2001
2000
|
return planFor(found, stage, provisionOrder(found), {
|
|
2001
|
+
localStage: workspace.stages.local,
|
|
2002
2002
|
events: workspace.services.events,
|
|
2003
2003
|
cache: cacheBackendOf(workspace.services.cache, providerOf(workspace))
|
|
2004
2004
|
}).containers;
|
|
@@ -2019,6 +2019,7 @@ async function reconcileWorkspace(workspace, options) {
|
|
|
2019
2019
|
project: workspace.name,
|
|
2020
2020
|
manifest,
|
|
2021
2021
|
stage: options.stage,
|
|
2022
|
+
localStage: workspace.stages.local,
|
|
2022
2023
|
events: workspace.services.events,
|
|
2023
2024
|
cache: cacheBackendOf(workspace.services.cache, providerOf(workspace)),
|
|
2024
2025
|
images: imagePins(workspace),
|
|
@@ -2358,14 +2359,13 @@ async function startWorkspaceServices(workspace, portEnv, secretsEnv) {
|
|
|
2358
2359
|
* For workspace app: maps {APP}_DATABASE_URL → DATABASE_URL.
|
|
2359
2360
|
* @internal Exported for testing
|
|
2360
2361
|
*/
|
|
2361
|
-
async function loadSecretsForApp(secretsRoot,
|
|
2362
|
+
async function loadSecretsForApp(secretsRoot, stage, appName) {
|
|
2362
2363
|
let secrets = {};
|
|
2363
|
-
|
|
2364
|
+
if (secretsExist(stage, secretsRoot)) {
|
|
2364
2365
|
const stageSecrets = await readStageSecrets(stage, secretsRoot);
|
|
2365
2366
|
if (stageSecrets) {
|
|
2366
2367
|
logger.log(`🔐 Loading secrets from stage: ${stage}`);
|
|
2367
2368
|
secrets = toEmbeddableSecrets(stageSecrets);
|
|
2368
|
-
break;
|
|
2369
2369
|
}
|
|
2370
2370
|
}
|
|
2371
2371
|
if (Object.keys(secrets).length === 0) return {};
|
|
@@ -2446,7 +2446,7 @@ await import('${entryPath}');
|
|
|
2446
2446
|
* @param options.resolveDockerPorts - How to resolve Docker ports:
|
|
2447
2447
|
* - `'full'` (default): probe running containers, saved state, then find available ports. Used by dev/test.
|
|
2448
2448
|
* - `'readonly'`: check running containers and saved state only, never probe for new ports. Used by exec.
|
|
2449
|
-
* @param options.
|
|
2449
|
+
* @param options.stage - The stage whose secrets to load. Default: the project's `stages.local`.
|
|
2450
2450
|
* @param options.startDocker - Start Docker Compose services after port resolution. Default: false.
|
|
2451
2451
|
* @param options.secretsFileName - Custom secrets JSON filename. Default: 'dev-secrets-{appName}.json' or 'dev-secrets.json'.
|
|
2452
2452
|
* @internal Exported for testing
|
|
@@ -2468,13 +2468,14 @@ async function prepareEntryCredentials(options) {
|
|
|
2468
2468
|
appName = getAppNameFromCwd(cwd) ?? void 0;
|
|
2469
2469
|
}
|
|
2470
2470
|
const resolvedPort = options.explicitPort ?? workspaceAppPort ?? 3e3;
|
|
2471
|
-
const
|
|
2471
|
+
const stage = options.stage ?? appInfo?.workspace.stages.local;
|
|
2472
|
+
const credentials = stage ? await loadSecretsForApp(secretsRoot, stage, appName) : {};
|
|
2472
2473
|
credentials.PORT = String(resolvedPort);
|
|
2473
2474
|
const declaredKeys = [];
|
|
2474
2475
|
if (appInfo && usesConstructs(appInfo.workspace)) {
|
|
2475
|
-
const { reconcileWorkspace: reconcileWorkspace$1 } = await import("./workspace-
|
|
2476
|
+
const { reconcileWorkspace: reconcileWorkspace$1 } = await import("./workspace-BzrG_2SI.mjs");
|
|
2476
2477
|
const reconciled = await reconcileWorkspace$1(appInfo.workspace, {
|
|
2477
|
-
stage: options.reconcileStage ??
|
|
2478
|
+
stage: options.reconcileStage ?? appInfo.workspace.stages.local,
|
|
2478
2479
|
start: options.startDocker ?? false
|
|
2479
2480
|
});
|
|
2480
2481
|
Object.assign(credentials, reconciled.env);
|
|
@@ -2545,4 +2546,4 @@ async function prepareEntryCredentials(options) {
|
|
|
2545
2546
|
|
|
2546
2547
|
//#endregion
|
|
2547
2548
|
export { LOCAL_CA_PATH, applyPostgres, cacheBackendOf, constructGlobs, createCredentialsPreload, createEntryWrapper, derivedContainers, emailBackendOf, findAvailablePort, imagePins, isPortAvailable, loadEnvFiles, loadSecretsForApp, prepareEntryCredentials, providerOf, reconcileWorkspace, resolveServicePorts, resourceName, rewriteUrlsWithPorts, startWorkspaceServices, storageBackendOf, usesConstructs };
|
|
2548
|
-
//# sourceMappingURL=credentials-
|
|
2549
|
+
//# sourceMappingURL=credentials-dP8vRVRv.mjs.map
|