@geekmidas/cli 10.0.0-alpha.0 → 10.0.0-alpha.2
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 +0 -7
- package/dist/{config-DbPE1KXF.cjs → config-BholeD-0.cjs} +5 -5
- package/dist/config-BholeD-0.cjs.map +1 -0
- package/dist/{config-D8o6I_7Z.mjs → config-CzWnfcXM.mjs} +5 -5
- package/dist/config-CzWnfcXM.mjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.mjs +1 -1
- package/dist/{credentials-Dh0Q6HzY.mjs → credentials-BZcp3CGx.mjs} +3 -3
- package/dist/{credentials-Dh0Q6HzY.mjs.map → credentials-BZcp3CGx.mjs.map} +1 -1
- package/dist/{credentials-K961ThG3.cjs → credentials-DQmbRnr1.cjs} +3 -3
- package/dist/{credentials-K961ThG3.cjs.map → credentials-DQmbRnr1.cjs.map} +1 -1
- package/dist/index.cjs +248 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +248 -273
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-CgpMWMmM.mjs → openapi-CY9xFkTH.mjs} +2 -2
- package/dist/{openapi-CgpMWMmM.mjs.map → openapi-CY9xFkTH.mjs.map} +1 -1
- package/dist/{openapi-CljONd_M.cjs → openapi-c9bpieI5.cjs} +2 -2
- package/dist/{openapi-CljONd_M.cjs.map → openapi-c9bpieI5.cjs.map} +1 -1
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.mjs +2 -2
- package/dist/{setup-DOsYueeQ.mjs → setup-Bc73t0ve.mjs} +3 -3
- package/dist/{setup-DOsYueeQ.mjs.map → setup-Bc73t0ve.mjs.map} +1 -1
- package/dist/{setup-CJiQM2pX.cjs → setup-C48C9hto.cjs} +3 -3
- package/dist/{setup-CJiQM2pX.cjs.map → setup-C48C9hto.cjs.map} +1 -1
- package/dist/{setup-DSutDAlt.mjs → setup-DCuudnCl.mjs} +3 -3
- package/dist/{setup-DMtU3p41.cjs → setup-fG_ivuxO.cjs} +3 -3
- package/dist/{workspace-8acupeaI.cjs → workspace-BO_KWohI.cjs} +2 -2
- package/dist/{workspace-yP5AHnrn.mjs → workspace-DK4WWJIn.mjs} +2 -2
- package/package.json +11 -11
- package/dist/config-D8o6I_7Z.mjs.map +0 -1
- package/dist/config-DbPE1KXF.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -1224,13 +1224,6 @@ export default defineWorkspace({
|
|
|
1224
1224
|
schema: 'zod',
|
|
1225
1225
|
},
|
|
1226
1226
|
},
|
|
1227
|
-
// Backend selection, and nothing else. Whether a Postgres exists comes from
|
|
1228
|
-
// declaring a database, not from a flag here — so `db` and `storage` are
|
|
1229
|
-
// ignored rather than obeyed, and the two cannot disagree.
|
|
1230
|
-
services: {
|
|
1231
|
-
cache: 'db',
|
|
1232
|
-
mail: 'ses',
|
|
1233
|
-
},
|
|
1234
1227
|
deploy: {
|
|
1235
1228
|
default: 'dokploy',
|
|
1236
1229
|
},
|
|
@@ -128,14 +128,14 @@ function resolveAppSpec(id, spec, workspaceRoot, kind) {
|
|
|
128
128
|
return {
|
|
129
129
|
...spec,
|
|
130
130
|
path,
|
|
131
|
-
...kind
|
|
131
|
+
...kind !== "site" && !givenAGlob ? { code: __geekmidas_manifest.DEFAULT_APP_CODE } : {}
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
function derivedApps(manifest, workspace) {
|
|
135
135
|
const apps = {};
|
|
136
136
|
const defaultTarget = workspace.deploy?.default ?? "dokploy";
|
|
137
137
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
138
|
-
if (declaration.kind !== "site" && declaration.kind !== "rest-api") continue;
|
|
138
|
+
if (declaration.kind !== "site" && declaration.kind !== "rest-api" && declaration.kind !== "worker") continue;
|
|
139
139
|
const spec = resolveAppSpec(id, declaration.app ?? {}, workspace.root, declaration.kind);
|
|
140
140
|
const name = appKey(id);
|
|
141
141
|
const configured = workspace.apps[name];
|
|
@@ -177,10 +177,10 @@ function derivedApps(manifest, workspace) {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
180
|
-
if (declaration.kind !== "site" && declaration.kind !== "rest-api") continue;
|
|
180
|
+
if (declaration.kind !== "site" && declaration.kind !== "rest-api" && declaration.kind !== "worker") continue;
|
|
181
181
|
const app = apps[appKey(id)];
|
|
182
182
|
if (!app) continue;
|
|
183
|
-
const edges = declaration.kind === "
|
|
183
|
+
const edges = declaration.kind === "rest-api" ? declaration.calls ?? [] : declaration.dependencies ?? [];
|
|
184
184
|
const names = /* @__PURE__ */ new Set();
|
|
185
185
|
for (const edge of edges) {
|
|
186
186
|
if (edge.kind !== "rest-api") continue;
|
|
@@ -532,4 +532,4 @@ Object.defineProperty(exports, 'resolveAppSpec', {
|
|
|
532
532
|
return resolveAppSpec;
|
|
533
533
|
}
|
|
534
534
|
});
|
|
535
|
-
//# sourceMappingURL=config-
|
|
535
|
+
//# sourceMappingURL=config-BholeD-0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-BholeD-0.cjs","names":["FRAMEWORKS: Record<string, Framework>","id: string","manifest: ConstructManifest","apps: Record<string, NormalizedAppConfig>","name: string","app: NormalizedAppConfig","workspaceRoot: string","construct: string","expected: string","spec: AppSpec","kind: 'site' | 'rest-api' | 'worker'","DEFAULT_APP_CODE","workspace: NormalizedWorkspace","defaultTarget: DeployTarget","config: GkmConfig","configString: string","defaultAlias: string","cwd: string","loaded: LoadedConfig","loadedConfig: LoadedConfig","appName: string"],"sources":["../src/workspace/derive.ts","../src/config.ts"],"sourcesContent":["/**\n * The apps a manifest implies.\n *\n * `gkm.config.ts` used to carry an `apps` block naming every app: its type, its\n * path, its port, its framework, which other apps it depended on. Every one of\n * those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`\n * and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',\n * dependencies: ['api'] }` are the same statement written twice, and only one of\n * them was checked against anything — so the copy in config was free to drift,\n * and a surface config had no entry for simply never deployed.\n *\n * So the list comes from the graph. A `site` is an app. A `rest-api` that named\n * an `app` is an app. A `rest-api` that did not is served by the surface that\n * named it as its authenticator, which is the same collapsing rule the deploy\n * already used, now stated once and read by everybody.\n *\n * What config still supplies is what no graph can answer: the backends a cache\n * and a mailer resolve to, the deploy endpoint, the stage's domain.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport {\n\ttype AppSpec,\n\ttype ConstructManifest,\n\tDEFAULT_APP_CODE,\n\tkebabCase,\n} from '@geekmidas/manifest';\nimport type {\n\tAppDomainConfig,\n\tDeployTarget,\n\tFramework,\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from './types.js';\n\n/** Which frontend framework builds each site variant. */\nconst FRAMEWORKS: Record<string, Framework> = {\n\tstatic: 'vite',\n\tnext: 'nextjs',\n\ttanstack: 'tanstack-start',\n};\n\n/**\n * The app key a construct id becomes.\n *\n * The same kebab form every physical name is built from, so `Api` is `api` in\n * the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an\n * environment — one id, three renderings, no second list.\n */\nexport function appKey(id: string): string {\n\treturn kebabCase(id);\n}\n\n/**\n * The app serving a surface: its own, always.\n *\n * Every surface gets a container. There is no arrangement in which one runs\n * inside another — two surfaces in a process share a filesystem, an\n * environment, and every credential either was granted, so an auth server\n * beside an API is one bug in the API away from being read by it.\n */\nexport function hostOf(\n\tmanifest: ConstructManifest,\n\tid: string,\n): string | undefined {\n\tconst declaration = manifest[id];\n\tif (!declaration || declaration.kind !== 'rest-api') return undefined;\n\n\treturn id;\n}\n\n/**\n * Local ports, assigned so that adding a site does not renumber the others.\n *\n * Backends first, then the site holding the base domain, then the rest\n * alphabetically. The ordering is arbitrary but it is *fixed*, which is the\n * property that matters: a port that moves when an unrelated app is added is a\n * port nobody can put in a bookmark. A construct that names its own port keeps\n * it, and is skipped here.\n */\nfunction assignPorts(apps: Record<string, NormalizedAppConfig>): void {\n\tconst rank = (\n\t\tname: string,\n\t\tapp: NormalizedAppConfig,\n\t): [number, number, string] => [\n\t\tapp.type === 'backend' ? 0 : app.type === 'web' ? 1 : 2,\n\t\tapp.root ? 0 : 1,\n\t\tname,\n\t];\n\n\tconst ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {\n\t\tconst [at, ar, an] = rank(aName, a);\n\t\tconst [bt, br, bn] = rank(bName, b);\n\t\treturn at - bt || ar - br || an.localeCompare(bn);\n\t});\n\n\tconst taken = new Set(\n\t\tordered.map(([, app]) => app.port).filter((p): p is number => !!p),\n\t);\n\n\tlet next = 3000;\n\tfor (const [, app] of ordered) {\n\t\tif (app.port) continue;\n\t\twhile (taken.has(next)) next += 1;\n\t\tapp.port = next;\n\t\ttaken.add(next);\n\t}\n}\n\n/**\n * Whichever site holds the base domain.\n *\n * The convention first — a site named `web` — because it is one people already\n * rely on. Then an explicit `root: true`. A project with one site needs neither.\n */\nfunction markRoot(apps: Record<string, NormalizedAppConfig>): void {\n\tconst sites = Object.entries(apps).filter(([, a]) => a.type === 'web');\n\tif (sites.length === 0) return;\n\tif (sites.some(([, a]) => a.root)) return;\n\n\tconst chosen =\n\t\tsites.find(([name]) => name === 'web') ??\n\t\t(sites.length === 1 ? sites[0] : undefined);\n\tif (chosen) chosen[1].root = true;\n}\n\n/**\n * What `app: true` means, and what the object form leaves out.\n *\n * Both fields follow from the construct's own id, so neither was worth making\n * someone write down:\n *\n * - `path` is `apps/<kebab-id>` where that directory exists, and the workspace\n * root otherwise. `Api` means `apps/api` in a monorepo and `.` in a\n * single-app project, and which of the two you are in is answerable by\n * looking.\n * - `code` is the conventional directories under `path`. A glob is worth\n * writing only when the code is somewhere else, which is the case the field\n * still exists for.\n *\n * A site takes no `code`: its build is its framework's, not ours.\n */\n/**\n * Where an app lives when it did not say.\n *\n * `apps/<kebab-id>`, which is what the id already said — or the project root\n * when there is no `apps/` at all, because then there is one app and it is the\n * project.\n *\n * In between, it refuses. A workspace *with* an `apps/` directory and no\n * `apps/<key>` in it is a construct naming a directory nobody wrote, and\n * quietly answering `.` there makes the app the whole repository: the build\n * filters turbo on the root `package.json` and builds the wrong thing, or\n * itself. A missing directory is a typo or an unconventional layout, and both\n * want saying out loud.\n */\nfunction conventionalPath(id: string, workspaceRoot: string): string {\n\tconst conventional = join('apps', appKey(id));\n\tif (existsSync(join(workspaceRoot, conventional))) return conventional;\n\n\t// No `apps/` at all: one app, and it is the project.\n\tif (!existsSync(join(workspaceRoot, 'apps'))) return '.';\n\n\tthrow new MisplacedApp(id, conventional);\n}\n\n/** A construct whose directory is not where its id says it is. */\nexport class MisplacedApp extends Error {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly expected: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${construct}\" has no directory at ${expected}.\\n` +\n\t\t\t\t`Create it, or say where it lives:\\n` +\n\t\t\t\t` new StaticSite('${construct}', { path: 'sites/${appKey(construct)}' })\\n` +\n\t\t\t\t` new RestApi('${construct}', { …, app: { path: 'services/${appKey(construct)}' } })`,\n\t\t);\n\t\tthis.name = 'MisplacedApp';\n\t}\n}\n\nexport function resolveAppSpec(\n\tid: string,\n\tspec: AppSpec,\n\tworkspaceRoot: string,\n\tkind: 'site' | 'rest-api' | 'worker',\n): AppSpec {\n\tconst path = spec.path ?? conventionalPath(id, workspaceRoot);\n\n\tconst givenAGlob =\n\t\tspec.code !== undefined ||\n\t\tspec.routes !== undefined ||\n\t\tspec.functions !== undefined ||\n\t\tspec.crons !== undefined ||\n\t\tspec.queues !== undefined ||\n\t\tspec.topics !== undefined ||\n\t\tspec.subscribers !== undefined;\n\n\treturn {\n\t\t...spec,\n\t\tpath,\n\t\t// A site takes none — its build is its framework's. The two that run our\n\t\t// code take the conventional directories.\n\t\t...(kind !== 'site' && !givenAGlob ? { code: DEFAULT_APP_CODE } : {}),\n\t};\n}\n\nexport function derivedApps(\n\tmanifest: ConstructManifest,\n\tworkspace: NormalizedWorkspace,\n): Record<string, NormalizedAppConfig> {\n\tconst apps: Record<string, NormalizedAppConfig> = {};\n\tconst defaultTarget: DeployTarget = workspace.deploy?.default ?? 'dokploy';\n\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, an HTTP surface, and a worker — the\n\t\t// process with no port. Everything else is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'worker'\n\t\t)\n\t\t\tcontinue;\n\n\t\t// No opt-in to be had. A site is an app and so is a surface; `app` is an\n\t\t// override for a layout that differs, and having none is the ordinary\n\t\t// case rather than a surface with nowhere to run.\n\t\tconst spec = resolveAppSpec(\n\t\t\tid,\n\t\t\tdeclaration.app ?? {},\n\t\t\tworkspace.root,\n\t\t\tdeclaration.kind,\n\t\t);\n\n\t\tconst name = appKey(id);\n\t\t// A config entry of the same name still wins, so a workspace can override\n\t\t// one field without restating the app. Nothing in this repo needs to.\n\t\tconst configured = workspace.apps[name];\n\n\t\tapps[name] = {\n\t\t\t...configured,\n\t\t\ttype: declaration.kind === 'site' ? 'web' : 'backend',\n\t\t\tpath: spec.path,\n\t\t\tport: spec.port ?? configured?.port ?? 0,\n\t\t\tdependencies: [],\n\t\t\tresolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,\n\t\t\t...(declaration.kind === 'site'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? FRAMEWORKS[declaration.variant],\n\t\t\t\t\t\t...(declaration.root ? { root: true } : {}),\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t// One glob fans out to the six the build reads, because each generator\n\t\t\t// already inspects every export and keeps what it recognises. A\n\t\t\t// per-kind field still wins where one was given.\n\t\t\t...(spec.code !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\troutes: spec.code,\n\t\t\t\t\t\tfunctions: spec.code,\n\t\t\t\t\t\tcrons: spec.code,\n\t\t\t\t\t\tqueues: spec.code,\n\t\t\t\t\t\ttopics: spec.code,\n\t\t\t\t\t\tsubscribers: spec.code,\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...(spec.routes !== undefined ? { routes: spec.routes } : {}),\n\t\t\t...(spec.functions !== undefined ? { functions: spec.functions } : {}),\n\t\t\t...(spec.crons !== undefined ? { crons: spec.crons } : {}),\n\t\t\t...(spec.queues !== undefined ? { queues: spec.queues } : {}),\n\t\t\t...(spec.topics !== undefined ? { topics: spec.topics } : {}),\n\t\t\t...(spec.subscribers !== undefined\n\t\t\t\t? { subscribers: spec.subscribers }\n\t\t\t\t: {}),\n\t\t\t...(spec.envParser !== undefined ? { envParser: spec.envParser } : {}),\n\t\t\t...(spec.logger !== undefined ? { logger: spec.logger } : {}),\n\t\t\t...(spec.telescope !== undefined ? { telescope: spec.telescope } : {}),\n\t\t\t...(spec.studio !== undefined ? { studio: spec.studio } : {}),\n\t\t\t...(spec.openapi !== undefined ? { openapi: spec.openapi } : {}),\n\t\t\t...(spec.runtime !== undefined ? { runtime: spec.runtime } : {}),\n\t\t\t...(spec.env !== undefined ? { env: spec.env } : {}),\n\t\t\t...(spec.entry !== undefined ? { entry: spec.entry } : {}),\n\t\t\t...(configured?.domain\n\t\t\t\t? { domain: configured.domain as AppDomainConfig }\n\t\t\t\t: {}),\n\t\t} as NormalizedAppConfig;\n\t}\n\n\t// Build order, from the edges rather than from a hand-kept list. A site that\n\t// depends on a surface depends on the app that serves it — which for a\n\t// mounted auth server is its host, not a container that does not exist.\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, an HTTP surface, and a worker — the\n\t\t// process with no port. Everything else is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'worker'\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst app = apps[appKey(id)];\n\t\tif (!app) continue;\n\n\t\t// A site names its edges `dependencies`, a surface names them `calls`, and\n\t\t// a worker — which depends on things without being an HTTP client of\n\t\t// them — names them `dependencies` too.\n\t\tconst edges =\n\t\t\tdeclaration.kind === 'rest-api'\n\t\t\t\t? (declaration.calls ?? [])\n\t\t\t\t: (declaration.dependencies ?? []);\n\n\t\tconst names = new Set<string>();\n\t\tfor (const edge of edges) {\n\t\t\tif (edge.kind !== 'rest-api') continue;\n\t\t\tconst host = hostOf(manifest, edge.target);\n\t\t\tif (!host) continue;\n\t\t\tconst key = appKey(host);\n\t\t\tif (key !== appKey(id) && apps[key]) names.add(key);\n\t\t}\n\n\t\tapp.dependencies = [...names].sort();\n\t}\n\n\tmarkRoot(apps);\n\tassignPorts(apps);\n\n\t// Apps config declared that the graph knows nothing about — a `type: 'mobile'`\n\t// entry, or a hand-run process. Kept rather than dropped: config is still the\n\t// escape hatch for what nothing declares.\n\tfor (const [name, app] of Object.entries(workspace.apps)) {\n\t\tif (!apps[name]) apps[name] = app;\n\t}\n\n\treturn apps;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, parse } from 'node:path';\nimport { discover } from './reconcile/discover.js';\nimport type { GkmConfig } from './types.js';\nimport { derivedApps } from './workspace/derive.js';\nimport {\n\tallConstructGlobs,\n\tgetAppGkmConfig,\n\tisWorkspaceConfig,\n\ttype LoadedConfig,\n\ttype NormalizedAppConfig,\n\ttype NormalizedWorkspace,\n\tprocessConfig,\n\ttype WorkspaceConfig,\n} from './workspace/index.js';\n\nexport type { GkmConfig } from './types.js';\nexport type { LoadedConfig, WorkspaceConfig } from './workspace/index.js';\nexport { defineWorkspace } from './workspace/index.js';\n/**\n * Define GKM configuration with full TypeScript support.\n * This is an identity function that provides type safety and autocomplete.\n *\n * @example\n * ```ts\n * // gkm.config.ts\n * import { defineConfig } from '@geekmidas/cli/config';\n *\n * export default defineConfig({\n * routes: './src/endpoints/**\\/*.ts',\n * envParser: './src/config/env',\n * logger: './src/config/logger',\n * telescope: true,\n * });\n * ```\n */\nexport function defineConfig(config: GkmConfig): GkmConfig {\n\treturn config;\n}\n\nexport interface ParsedModuleConfig {\n\tpath: string;\n\timportPattern: string;\n}\n\n/**\n * Parse a module config string into path and import pattern.\n *\n * @param configString - Config string in format \"./path/to/module\" or \"./path/to/module#exportName\"\n * @param defaultAlias - The default alias name to use if no export name specified\n * @returns Object with path and import pattern\n *\n * @example\n * parseModuleConfig('./src/config/env', 'envParser')\n * // { path: './src/config/env', importPattern: 'envParser' }\n *\n * parseModuleConfig('./src/config/env#envParser', 'envParser')\n * // { path: './src/config/env', importPattern: '{ envParser }' }\n *\n * parseModuleConfig('./src/config/env#myEnv', 'envParser')\n * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }\n */\nexport function parseModuleConfig(\n\tconfigString: string,\n\tdefaultAlias: string,\n): ParsedModuleConfig {\n\tconst parts = configString.split('#');\n\tconst path = parts[0] ?? configString;\n\tconst exportName = parts[1];\n\tconst importPattern = !exportName\n\t\t? defaultAlias\n\t\t: exportName === defaultAlias\n\t\t\t? `{ ${defaultAlias} }`\n\t\t\t: `{ ${exportName} as ${defaultAlias} }`;\n\n\treturn { path, importPattern };\n}\n\nexport interface ConfigDiscoveryResult {\n\tconfigPath: string;\n\tworkspaceRoot: string;\n}\n\n/**\n * Find and return the path to the config file.\n *\n * Resolution order:\n * 1. GKM_CONFIG_PATH env var (set by workspace dev command)\n * 2. Walk up directory tree from cwd\n */\nfunction findConfigPath(cwd: string): ConfigDiscoveryResult {\n\tconst files = ['gkm.config.json', 'gkm.config.ts', 'gkm.config.js'];\n\n\t// Check GKM_CONFIG_PATH env var first (set by workspace dev command)\n\tconst envConfigPath = process.env.GKM_CONFIG_PATH;\n\tif (envConfigPath && existsSync(envConfigPath)) {\n\t\treturn {\n\t\t\tconfigPath: envConfigPath,\n\t\t\tworkspaceRoot: dirname(envConfigPath),\n\t\t};\n\t}\n\n\t// Walk up directory tree to find config\n\tlet currentDir = cwd;\n\tconst { root } = parse(currentDir);\n\n\twhile (currentDir !== root) {\n\t\tfor (const file of files) {\n\t\t\tconst configPath = join(currentDir, file);\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn {\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tworkspaceRoot: currentDir,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcurrentDir = dirname(currentDir);\n\t}\n\n\tthrow new Error(\n\t\t'Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.',\n\t);\n}\n\n/**\n * Get app name from package.json in the given directory.\n * Handles scoped packages by extracting the name after the scope.\n *\n * @example\n * getAppNameFromCwd('/path/to/apps/api')\n * // package.json: { \"name\": \"@myorg/api\" }\n * // Returns: 'api'\n */\nexport function getAppNameFromCwd(cwd: string = process.cwd()): string | null {\n\tconst packageJsonPath = join(cwd, 'package.json');\n\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\tconst name = packageJson.name as string | undefined;\n\n\t\tif (!name) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Handle scoped packages: @scope/name -> name\n\t\tif (name.startsWith('@') && name.includes('/')) {\n\t\t\treturn name.split('/')[1] ?? null;\n\t\t}\n\n\t\treturn name;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\ninterface RawConfigResult {\n\tconfig: GkmConfig | WorkspaceConfig;\n\tworkspaceRoot: string;\n}\n\n/**\n * Load raw configuration from file.\n */\nasync function loadRawConfig(cwd: string): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\n\ttry {\n\t\tconst config = await import(configPath);\n\t\treturn {\n\t\t\tconfig: config.default,\n\t\t\tworkspaceRoot,\n\t\t};\n\t} catch (error) {\n\t\tthrow new Error(`Failed to load config: ${(error as Error).message}`);\n\t}\n}\n\n/**\n * Load configuration file (single-app format).\n * For backwards compatibility with existing code.\n *\n * @deprecated Use loadWorkspaceConfig for new code\n */\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n): Promise<GkmConfig> {\n\tconst { config } = await loadRawConfig(cwd);\n\n\t// If it's a workspace config, throw an error\n\tif (isWorkspaceConfig(config)) {\n\t\tthrow new Error(\n\t\t\t'Workspace configuration detected. Use loadWorkspaceConfig() instead.',\n\t\t);\n\t}\n\n\treturn config;\n}\n\n/**\n * Load configuration file and process it as a workspace.\n * Works with both single-app and workspace configurations.\n *\n * Single-app configs are automatically wrapped as a workspace with one app.\n *\n * @example\n * ```ts\n * const { type, workspace } = await loadWorkspaceConfig();\n *\n * if (type === 'workspace') {\n * console.log('Multi-app workspace:', workspace.apps);\n * } else {\n * console.log('Single app wrapped as workspace');\n * }\n * ```\n */\nexport async function loadWorkspaceConfig(\n\tcwd: string = process.cwd(),\n): Promise<LoadedConfig> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\treturn withDerivedApps(processConfig(config, workspaceRoot));\n}\n\n/**\n * The loaded config, with its apps read off the graph.\n *\n * Here rather than at each call site because every command needs the same\n * answer, and the ones that forgot to ask were exactly the bugs: a site that\n * never deployed, a surface that could not be its own process. `gkm dev`,\n * `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without\n * any of them knowing a derivation happened.\n *\n * Discovery imports the construct modules — declarations only, not endpoints —\n * which is the same import the reconciler and the build already do. A workspace\n * with no `constructs` glob discovers nothing and keeps whatever its config\n * said, so nothing that worked before changes.\n *\n * A construct file that throws is reported and skipped rather than taking the\n * command down: `gkm dev` failing to start because a half-written declaration\n * cannot be imported is a worse failure than starting with the app it does not\n * describe yet.\n */\nasync function withDerivedApps(loaded: LoadedConfig): Promise<LoadedConfig> {\n\tconst globs = allConstructGlobs(loaded.workspace);\n\tif (globs.length === 0) return loaded;\n\n\ttry {\n\t\tconst manifest = await discover({\n\t\t\tpatterns: globs,\n\t\t\tcwd: loaded.workspace.root,\n\t\t});\n\n\t\treturn {\n\t\t\t...loaded,\n\t\t\tmanifest,\n\t\t\tworkspace: {\n\t\t\t\t...loaded.workspace,\n\t\t\t\tapps: derivedApps(manifest, loaded.workspace),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(\n\t\t\t`⚠️ Could not read constructs, so apps come from config alone: ${message}`,\n\t\t);\n\t\treturn loaded;\n\t}\n}\n\nexport interface AppConfigResult {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tgkmConfig: GkmConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n\tappRoot: string;\n}\n\n/**\n * The app a package directory refers to, and what the workspace calls it.\n *\n * A single-app config is wrapped as a one-app workspace keyed `api`, which is\n * almost never the package name. Matching on the key alone means an app like\n * `@geekmidas/example` resolves to nothing and silently loses everything that\n * comes from the workspace — including the URLs its constructs declare.\n */\nfunction resolveWorkspaceApp(\n\tloadedConfig: LoadedConfig,\n\tappName: string,\n): { key: string; app: NormalizedAppConfig } | undefined {\n\tconst apps = loadedConfig.workspace.apps;\n\n\tconst named = apps[appName];\n\tif (named) return { key: appName, app: named };\n\n\tconst names = Object.keys(apps);\n\tconst only = names[0];\n\tif (loadedConfig.type !== 'single' || names.length !== 1 || !only) {\n\t\treturn undefined;\n\t}\n\n\tconst app = apps[only];\n\n\treturn app ? { key: only, app } : undefined;\n}\n\n/**\n * Load app-specific configuration from workspace.\n * Uses the app name from package.json to find the correct app config.\n *\n * @example\n * ```ts\n * // From apps/api directory with package.json: { \"name\": \"@myorg/api\" }\n * const { app, workspace, workspaceRoot } = await loadAppConfig();\n * console.log(app.routes); // './src/endpoints/**\\/*.ts'\n * ```\n */\nexport async function loadAppConfig(\n\tcwd: string = process.cwd(),\n): Promise<AppConfigResult> {\n\tconst appName = getAppNameFromCwd(cwd);\n\n\tif (!appName) {\n\t\tthrow new Error(\n\t\t\t'Could not determine app name. Ensure package.json exists with a \"name\" field.',\n\t\t);\n\t}\n\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, appName);\n\n\tif (!resolved) {\n\t\tthrow new Error(\n\t\t\t`App \"${appName}\" not found in workspace config. Available apps: ${Object.keys(\n\t\t\t\tloadedConfig.workspace.apps,\n\t\t\t).join(', ')}. ` +\n\t\t\t\t`Ensure the package.json name matches the app key in gkm.config.ts.`,\n\t\t);\n\t}\n\n\tconst { key, app } = resolved;\n\n\t// Keyed by what the workspace calls the app, not by the package name — for a\n\t// single-app config those differ.\n\tconst gkmConfig = getAppGkmConfig(loadedConfig.workspace, key);\n\n\tif (!gkmConfig) {\n\t\tthrow new Error(\n\t\t\t`App \"${appName}\" is not a backend app and cannot be run with gkm dev.`,\n\t\t);\n\t}\n\n\treturn {\n\t\tappName,\n\t\tapp,\n\t\tgkmConfig,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t\tappRoot: join(workspaceRoot, app.path),\n\t};\n}\n\nexport interface WorkspaceAppInfo {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n}\n\n/**\n * Load workspace info for any app (frontend or backend).\n * Unlike loadAppConfig, this does NOT require the app to have a gkm config\n * (routes, entry, etc.), making it suitable for gkm exec/test from frontend apps.\n */\nexport async function loadWorkspaceAppInfo(\n\tcwd: string = process.cwd(),\n): Promise<WorkspaceAppInfo> {\n\tconst appName = getAppNameFromCwd(cwd);\n\n\tif (!appName) {\n\t\tthrow new Error(\n\t\t\t'Could not determine app name. Ensure package.json exists with a \"name\" field.',\n\t\t);\n\t}\n\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, appName);\n\n\tif (!resolved) {\n\t\tconst availableApps = Object.keys(loadedConfig.workspace.apps).join(', ');\n\t\tthrow new Error(\n\t\t\t`App \"${appName}\" not found in workspace config. Available apps: ${availableApps}. ` +\n\t\t\t\t`Ensure the package.json name matches the app key in gkm.config.ts.`,\n\t\t);\n\t}\n\n\treturn {\n\t\tappName,\n\t\tapp: resolved.app,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t};\n}\n"],"mappings":";;;;;;;;;AAqCA,MAAMA,aAAwC;CAC7C,QAAQ;CACR,MAAM;CACN,UAAU;AACV;;;;;;;;AASD,SAAgB,OAAOC,IAAoB;AAC1C,QAAO,oCAAU,GAAG;AACpB;;;;;;;;;AAUD,SAAgB,OACfC,UACAD,IACqB;CACrB,MAAM,cAAc,SAAS;AAC7B,MAAK,eAAe,YAAY,SAAS,WAAY;AAErD,QAAO;AACP;;;;;;;;;;AAWD,SAAS,YAAYE,MAAiD;CACrE,MAAM,OAAO,CACZC,MACAC,QAC8B;EAC9B,IAAI,SAAS,YAAY,IAAI,IAAI,SAAS,QAAQ,IAAI;EACtD,IAAI,OAAO,IAAI;EACf;CACA;CAED,MAAM,UAAU,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK;EACrE,MAAM,CAAC,IAAI,IAAI,GAAG,GAAG,KAAK,OAAO,EAAE;EACnC,MAAM,CAAC,IAAI,IAAI,GAAG,GAAG,KAAK,OAAO,EAAE;AACnC,SAAO,KAAK,MAAM,KAAK,MAAM,GAAG,cAAc,GAAG;CACjD,EAAC;CAEF,MAAM,QAAQ,IAAI,IACjB,QAAQ,IAAI,CAAC,GAAG,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAqB,EAAE;CAGnE,IAAI,OAAO;AACX,MAAK,MAAM,GAAG,IAAI,IAAI,SAAS;AAC9B,MAAI,IAAI,KAAM;AACd,SAAO,MAAM,IAAI,KAAK,CAAE,SAAQ;AAChC,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,IAAI,OACR,OAAO,QAAQ,mDAAmD,cAAc;CAGlF;AAED,QAAO;EACN;EACA,KAAK,SAAS;EACd,WAAW,aAAa;EACxB;CACA;AACD"}
|
|
@@ -127,14 +127,14 @@ function resolveAppSpec(id, spec, workspaceRoot, kind) {
|
|
|
127
127
|
return {
|
|
128
128
|
...spec,
|
|
129
129
|
path,
|
|
130
|
-
...kind
|
|
130
|
+
...kind !== "site" && !givenAGlob ? { code: DEFAULT_APP_CODE } : {}
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
function derivedApps(manifest, workspace) {
|
|
134
134
|
const apps = {};
|
|
135
135
|
const defaultTarget = workspace.deploy?.default ?? "dokploy";
|
|
136
136
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
137
|
-
if (declaration.kind !== "site" && declaration.kind !== "rest-api") continue;
|
|
137
|
+
if (declaration.kind !== "site" && declaration.kind !== "rest-api" && declaration.kind !== "worker") continue;
|
|
138
138
|
const spec = resolveAppSpec(id, declaration.app ?? {}, workspace.root, declaration.kind);
|
|
139
139
|
const name = appKey(id);
|
|
140
140
|
const configured = workspace.apps[name];
|
|
@@ -176,10 +176,10 @@ function derivedApps(manifest, workspace) {
|
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
179
|
-
if (declaration.kind !== "site" && declaration.kind !== "rest-api") continue;
|
|
179
|
+
if (declaration.kind !== "site" && declaration.kind !== "rest-api" && declaration.kind !== "worker") continue;
|
|
180
180
|
const app = apps[appKey(id)];
|
|
181
181
|
if (!app) continue;
|
|
182
|
-
const edges = declaration.kind === "
|
|
182
|
+
const edges = declaration.kind === "rest-api" ? declaration.calls ?? [] : declaration.dependencies ?? [];
|
|
183
183
|
const names = /* @__PURE__ */ new Set();
|
|
184
184
|
for (const edge of edges) {
|
|
185
185
|
if (edge.kind !== "rest-api") continue;
|
|
@@ -466,4 +466,4 @@ async function loadWorkspaceAppInfo(cwd = process.cwd()) {
|
|
|
466
466
|
|
|
467
467
|
//#endregion
|
|
468
468
|
export { appKey, defineConfig, derivedApps, getAppNameFromCwd, hostOf, loadAppConfig, loadConfig, loadWorkspaceAppInfo, loadWorkspaceConfig, parseModuleConfig, resolveAppSpec };
|
|
469
|
-
//# sourceMappingURL=config-
|
|
469
|
+
//# sourceMappingURL=config-CzWnfcXM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-CzWnfcXM.mjs","names":["FRAMEWORKS: Record<string, Framework>","id: string","manifest: ConstructManifest","apps: Record<string, NormalizedAppConfig>","name: string","app: NormalizedAppConfig","workspaceRoot: string","construct: string","expected: string","spec: AppSpec","kind: 'site' | 'rest-api' | 'worker'","workspace: NormalizedWorkspace","defaultTarget: DeployTarget","config: GkmConfig","configString: string","defaultAlias: string","cwd: string","loaded: LoadedConfig","loadedConfig: LoadedConfig","appName: string"],"sources":["../src/workspace/derive.ts","../src/config.ts"],"sourcesContent":["/**\n * The apps a manifest implies.\n *\n * `gkm.config.ts` used to carry an `apps` block naming every app: its type, its\n * path, its port, its framework, which other apps it depended on. Every one of\n * those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`\n * and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',\n * dependencies: ['api'] }` are the same statement written twice, and only one of\n * them was checked against anything — so the copy in config was free to drift,\n * and a surface config had no entry for simply never deployed.\n *\n * So the list comes from the graph. A `site` is an app. A `rest-api` that named\n * an `app` is an app. A `rest-api` that did not is served by the surface that\n * named it as its authenticator, which is the same collapsing rule the deploy\n * already used, now stated once and read by everybody.\n *\n * What config still supplies is what no graph can answer: the backends a cache\n * and a mailer resolve to, the deploy endpoint, the stage's domain.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport {\n\ttype AppSpec,\n\ttype ConstructManifest,\n\tDEFAULT_APP_CODE,\n\tkebabCase,\n} from '@geekmidas/manifest';\nimport type {\n\tAppDomainConfig,\n\tDeployTarget,\n\tFramework,\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from './types.js';\n\n/** Which frontend framework builds each site variant. */\nconst FRAMEWORKS: Record<string, Framework> = {\n\tstatic: 'vite',\n\tnext: 'nextjs',\n\ttanstack: 'tanstack-start',\n};\n\n/**\n * The app key a construct id becomes.\n *\n * The same kebab form every physical name is built from, so `Api` is `api` in\n * the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an\n * environment — one id, three renderings, no second list.\n */\nexport function appKey(id: string): string {\n\treturn kebabCase(id);\n}\n\n/**\n * The app serving a surface: its own, always.\n *\n * Every surface gets a container. There is no arrangement in which one runs\n * inside another — two surfaces in a process share a filesystem, an\n * environment, and every credential either was granted, so an auth server\n * beside an API is one bug in the API away from being read by it.\n */\nexport function hostOf(\n\tmanifest: ConstructManifest,\n\tid: string,\n): string | undefined {\n\tconst declaration = manifest[id];\n\tif (!declaration || declaration.kind !== 'rest-api') return undefined;\n\n\treturn id;\n}\n\n/**\n * Local ports, assigned so that adding a site does not renumber the others.\n *\n * Backends first, then the site holding the base domain, then the rest\n * alphabetically. The ordering is arbitrary but it is *fixed*, which is the\n * property that matters: a port that moves when an unrelated app is added is a\n * port nobody can put in a bookmark. A construct that names its own port keeps\n * it, and is skipped here.\n */\nfunction assignPorts(apps: Record<string, NormalizedAppConfig>): void {\n\tconst rank = (\n\t\tname: string,\n\t\tapp: NormalizedAppConfig,\n\t): [number, number, string] => [\n\t\tapp.type === 'backend' ? 0 : app.type === 'web' ? 1 : 2,\n\t\tapp.root ? 0 : 1,\n\t\tname,\n\t];\n\n\tconst ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {\n\t\tconst [at, ar, an] = rank(aName, a);\n\t\tconst [bt, br, bn] = rank(bName, b);\n\t\treturn at - bt || ar - br || an.localeCompare(bn);\n\t});\n\n\tconst taken = new Set(\n\t\tordered.map(([, app]) => app.port).filter((p): p is number => !!p),\n\t);\n\n\tlet next = 3000;\n\tfor (const [, app] of ordered) {\n\t\tif (app.port) continue;\n\t\twhile (taken.has(next)) next += 1;\n\t\tapp.port = next;\n\t\ttaken.add(next);\n\t}\n}\n\n/**\n * Whichever site holds the base domain.\n *\n * The convention first — a site named `web` — because it is one people already\n * rely on. Then an explicit `root: true`. A project with one site needs neither.\n */\nfunction markRoot(apps: Record<string, NormalizedAppConfig>): void {\n\tconst sites = Object.entries(apps).filter(([, a]) => a.type === 'web');\n\tif (sites.length === 0) return;\n\tif (sites.some(([, a]) => a.root)) return;\n\n\tconst chosen =\n\t\tsites.find(([name]) => name === 'web') ??\n\t\t(sites.length === 1 ? sites[0] : undefined);\n\tif (chosen) chosen[1].root = true;\n}\n\n/**\n * What `app: true` means, and what the object form leaves out.\n *\n * Both fields follow from the construct's own id, so neither was worth making\n * someone write down:\n *\n * - `path` is `apps/<kebab-id>` where that directory exists, and the workspace\n * root otherwise. `Api` means `apps/api` in a monorepo and `.` in a\n * single-app project, and which of the two you are in is answerable by\n * looking.\n * - `code` is the conventional directories under `path`. A glob is worth\n * writing only when the code is somewhere else, which is the case the field\n * still exists for.\n *\n * A site takes no `code`: its build is its framework's, not ours.\n */\n/**\n * Where an app lives when it did not say.\n *\n * `apps/<kebab-id>`, which is what the id already said — or the project root\n * when there is no `apps/` at all, because then there is one app and it is the\n * project.\n *\n * In between, it refuses. A workspace *with* an `apps/` directory and no\n * `apps/<key>` in it is a construct naming a directory nobody wrote, and\n * quietly answering `.` there makes the app the whole repository: the build\n * filters turbo on the root `package.json` and builds the wrong thing, or\n * itself. A missing directory is a typo or an unconventional layout, and both\n * want saying out loud.\n */\nfunction conventionalPath(id: string, workspaceRoot: string): string {\n\tconst conventional = join('apps', appKey(id));\n\tif (existsSync(join(workspaceRoot, conventional))) return conventional;\n\n\t// No `apps/` at all: one app, and it is the project.\n\tif (!existsSync(join(workspaceRoot, 'apps'))) return '.';\n\n\tthrow new MisplacedApp(id, conventional);\n}\n\n/** A construct whose directory is not where its id says it is. */\nexport class MisplacedApp extends Error {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly expected: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${construct}\" has no directory at ${expected}.\\n` +\n\t\t\t\t`Create it, or say where it lives:\\n` +\n\t\t\t\t` new StaticSite('${construct}', { path: 'sites/${appKey(construct)}' })\\n` +\n\t\t\t\t` new RestApi('${construct}', { …, app: { path: 'services/${appKey(construct)}' } })`,\n\t\t);\n\t\tthis.name = 'MisplacedApp';\n\t}\n}\n\nexport function resolveAppSpec(\n\tid: string,\n\tspec: AppSpec,\n\tworkspaceRoot: string,\n\tkind: 'site' | 'rest-api' | 'worker',\n): AppSpec {\n\tconst path = spec.path ?? conventionalPath(id, workspaceRoot);\n\n\tconst givenAGlob =\n\t\tspec.code !== undefined ||\n\t\tspec.routes !== undefined ||\n\t\tspec.functions !== undefined ||\n\t\tspec.crons !== undefined ||\n\t\tspec.queues !== undefined ||\n\t\tspec.topics !== undefined ||\n\t\tspec.subscribers !== undefined;\n\n\treturn {\n\t\t...spec,\n\t\tpath,\n\t\t// A site takes none — its build is its framework's. The two that run our\n\t\t// code take the conventional directories.\n\t\t...(kind !== 'site' && !givenAGlob ? { code: DEFAULT_APP_CODE } : {}),\n\t};\n}\n\nexport function derivedApps(\n\tmanifest: ConstructManifest,\n\tworkspace: NormalizedWorkspace,\n): Record<string, NormalizedAppConfig> {\n\tconst apps: Record<string, NormalizedAppConfig> = {};\n\tconst defaultTarget: DeployTarget = workspace.deploy?.default ?? 'dokploy';\n\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, an HTTP surface, and a worker — the\n\t\t// process with no port. Everything else is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'worker'\n\t\t)\n\t\t\tcontinue;\n\n\t\t// No opt-in to be had. A site is an app and so is a surface; `app` is an\n\t\t// override for a layout that differs, and having none is the ordinary\n\t\t// case rather than a surface with nowhere to run.\n\t\tconst spec = resolveAppSpec(\n\t\t\tid,\n\t\t\tdeclaration.app ?? {},\n\t\t\tworkspace.root,\n\t\t\tdeclaration.kind,\n\t\t);\n\n\t\tconst name = appKey(id);\n\t\t// A config entry of the same name still wins, so a workspace can override\n\t\t// one field without restating the app. Nothing in this repo needs to.\n\t\tconst configured = workspace.apps[name];\n\n\t\tapps[name] = {\n\t\t\t...configured,\n\t\t\ttype: declaration.kind === 'site' ? 'web' : 'backend',\n\t\t\tpath: spec.path,\n\t\t\tport: spec.port ?? configured?.port ?? 0,\n\t\t\tdependencies: [],\n\t\t\tresolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,\n\t\t\t...(declaration.kind === 'site'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? FRAMEWORKS[declaration.variant],\n\t\t\t\t\t\t...(declaration.root ? { root: true } : {}),\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t// One glob fans out to the six the build reads, because each generator\n\t\t\t// already inspects every export and keeps what it recognises. A\n\t\t\t// per-kind field still wins where one was given.\n\t\t\t...(spec.code !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\troutes: spec.code,\n\t\t\t\t\t\tfunctions: spec.code,\n\t\t\t\t\t\tcrons: spec.code,\n\t\t\t\t\t\tqueues: spec.code,\n\t\t\t\t\t\ttopics: spec.code,\n\t\t\t\t\t\tsubscribers: spec.code,\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...(spec.routes !== undefined ? { routes: spec.routes } : {}),\n\t\t\t...(spec.functions !== undefined ? { functions: spec.functions } : {}),\n\t\t\t...(spec.crons !== undefined ? { crons: spec.crons } : {}),\n\t\t\t...(spec.queues !== undefined ? { queues: spec.queues } : {}),\n\t\t\t...(spec.topics !== undefined ? { topics: spec.topics } : {}),\n\t\t\t...(spec.subscribers !== undefined\n\t\t\t\t? { subscribers: spec.subscribers }\n\t\t\t\t: {}),\n\t\t\t...(spec.envParser !== undefined ? { envParser: spec.envParser } : {}),\n\t\t\t...(spec.logger !== undefined ? { logger: spec.logger } : {}),\n\t\t\t...(spec.telescope !== undefined ? { telescope: spec.telescope } : {}),\n\t\t\t...(spec.studio !== undefined ? { studio: spec.studio } : {}),\n\t\t\t...(spec.openapi !== undefined ? { openapi: spec.openapi } : {}),\n\t\t\t...(spec.runtime !== undefined ? { runtime: spec.runtime } : {}),\n\t\t\t...(spec.env !== undefined ? { env: spec.env } : {}),\n\t\t\t...(spec.entry !== undefined ? { entry: spec.entry } : {}),\n\t\t\t...(configured?.domain\n\t\t\t\t? { domain: configured.domain as AppDomainConfig }\n\t\t\t\t: {}),\n\t\t} as NormalizedAppConfig;\n\t}\n\n\t// Build order, from the edges rather than from a hand-kept list. A site that\n\t// depends on a surface depends on the app that serves it — which for a\n\t// mounted auth server is its host, not a container that does not exist.\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, an HTTP surface, and a worker — the\n\t\t// process with no port. Everything else is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'worker'\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst app = apps[appKey(id)];\n\t\tif (!app) continue;\n\n\t\t// A site names its edges `dependencies`, a surface names them `calls`, and\n\t\t// a worker — which depends on things without being an HTTP client of\n\t\t// them — names them `dependencies` too.\n\t\tconst edges =\n\t\t\tdeclaration.kind === 'rest-api'\n\t\t\t\t? (declaration.calls ?? [])\n\t\t\t\t: (declaration.dependencies ?? []);\n\n\t\tconst names = new Set<string>();\n\t\tfor (const edge of edges) {\n\t\t\tif (edge.kind !== 'rest-api') continue;\n\t\t\tconst host = hostOf(manifest, edge.target);\n\t\t\tif (!host) continue;\n\t\t\tconst key = appKey(host);\n\t\t\tif (key !== appKey(id) && apps[key]) names.add(key);\n\t\t}\n\n\t\tapp.dependencies = [...names].sort();\n\t}\n\n\tmarkRoot(apps);\n\tassignPorts(apps);\n\n\t// Apps config declared that the graph knows nothing about — a `type: 'mobile'`\n\t// entry, or a hand-run process. Kept rather than dropped: config is still the\n\t// escape hatch for what nothing declares.\n\tfor (const [name, app] of Object.entries(workspace.apps)) {\n\t\tif (!apps[name]) apps[name] = app;\n\t}\n\n\treturn apps;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, parse } from 'node:path';\nimport { discover } from './reconcile/discover.js';\nimport type { GkmConfig } from './types.js';\nimport { derivedApps } from './workspace/derive.js';\nimport {\n\tallConstructGlobs,\n\tgetAppGkmConfig,\n\tisWorkspaceConfig,\n\ttype LoadedConfig,\n\ttype NormalizedAppConfig,\n\ttype NormalizedWorkspace,\n\tprocessConfig,\n\ttype WorkspaceConfig,\n} from './workspace/index.js';\n\nexport type { GkmConfig } from './types.js';\nexport type { LoadedConfig, WorkspaceConfig } from './workspace/index.js';\nexport { defineWorkspace } from './workspace/index.js';\n/**\n * Define GKM configuration with full TypeScript support.\n * This is an identity function that provides type safety and autocomplete.\n *\n * @example\n * ```ts\n * // gkm.config.ts\n * import { defineConfig } from '@geekmidas/cli/config';\n *\n * export default defineConfig({\n * routes: './src/endpoints/**\\/*.ts',\n * envParser: './src/config/env',\n * logger: './src/config/logger',\n * telescope: true,\n * });\n * ```\n */\nexport function defineConfig(config: GkmConfig): GkmConfig {\n\treturn config;\n}\n\nexport interface ParsedModuleConfig {\n\tpath: string;\n\timportPattern: string;\n}\n\n/**\n * Parse a module config string into path and import pattern.\n *\n * @param configString - Config string in format \"./path/to/module\" or \"./path/to/module#exportName\"\n * @param defaultAlias - The default alias name to use if no export name specified\n * @returns Object with path and import pattern\n *\n * @example\n * parseModuleConfig('./src/config/env', 'envParser')\n * // { path: './src/config/env', importPattern: 'envParser' }\n *\n * parseModuleConfig('./src/config/env#envParser', 'envParser')\n * // { path: './src/config/env', importPattern: '{ envParser }' }\n *\n * parseModuleConfig('./src/config/env#myEnv', 'envParser')\n * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }\n */\nexport function parseModuleConfig(\n\tconfigString: string,\n\tdefaultAlias: string,\n): ParsedModuleConfig {\n\tconst parts = configString.split('#');\n\tconst path = parts[0] ?? configString;\n\tconst exportName = parts[1];\n\tconst importPattern = !exportName\n\t\t? defaultAlias\n\t\t: exportName === defaultAlias\n\t\t\t? `{ ${defaultAlias} }`\n\t\t\t: `{ ${exportName} as ${defaultAlias} }`;\n\n\treturn { path, importPattern };\n}\n\nexport interface ConfigDiscoveryResult {\n\tconfigPath: string;\n\tworkspaceRoot: string;\n}\n\n/**\n * Find and return the path to the config file.\n *\n * Resolution order:\n * 1. GKM_CONFIG_PATH env var (set by workspace dev command)\n * 2. Walk up directory tree from cwd\n */\nfunction findConfigPath(cwd: string): ConfigDiscoveryResult {\n\tconst files = ['gkm.config.json', 'gkm.config.ts', 'gkm.config.js'];\n\n\t// Check GKM_CONFIG_PATH env var first (set by workspace dev command)\n\tconst envConfigPath = process.env.GKM_CONFIG_PATH;\n\tif (envConfigPath && existsSync(envConfigPath)) {\n\t\treturn {\n\t\t\tconfigPath: envConfigPath,\n\t\t\tworkspaceRoot: dirname(envConfigPath),\n\t\t};\n\t}\n\n\t// Walk up directory tree to find config\n\tlet currentDir = cwd;\n\tconst { root } = parse(currentDir);\n\n\twhile (currentDir !== root) {\n\t\tfor (const file of files) {\n\t\t\tconst configPath = join(currentDir, file);\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn {\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tworkspaceRoot: currentDir,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcurrentDir = dirname(currentDir);\n\t}\n\n\tthrow new Error(\n\t\t'Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.',\n\t);\n}\n\n/**\n * Get app name from package.json in the given directory.\n * Handles scoped packages by extracting the name after the scope.\n *\n * @example\n * getAppNameFromCwd('/path/to/apps/api')\n * // package.json: { \"name\": \"@myorg/api\" }\n * // Returns: 'api'\n */\nexport function getAppNameFromCwd(cwd: string = process.cwd()): string | null {\n\tconst packageJsonPath = join(cwd, 'package.json');\n\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\tconst name = packageJson.name as string | undefined;\n\n\t\tif (!name) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Handle scoped packages: @scope/name -> name\n\t\tif (name.startsWith('@') && name.includes('/')) {\n\t\t\treturn name.split('/')[1] ?? null;\n\t\t}\n\n\t\treturn name;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\ninterface RawConfigResult {\n\tconfig: GkmConfig | WorkspaceConfig;\n\tworkspaceRoot: string;\n}\n\n/**\n * Load raw configuration from file.\n */\nasync function loadRawConfig(cwd: string): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\n\ttry {\n\t\tconst config = await import(configPath);\n\t\treturn {\n\t\t\tconfig: config.default,\n\t\t\tworkspaceRoot,\n\t\t};\n\t} catch (error) {\n\t\tthrow new Error(`Failed to load config: ${(error as Error).message}`);\n\t}\n}\n\n/**\n * Load configuration file (single-app format).\n * For backwards compatibility with existing code.\n *\n * @deprecated Use loadWorkspaceConfig for new code\n */\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n): Promise<GkmConfig> {\n\tconst { config } = await loadRawConfig(cwd);\n\n\t// If it's a workspace config, throw an error\n\tif (isWorkspaceConfig(config)) {\n\t\tthrow new Error(\n\t\t\t'Workspace configuration detected. Use loadWorkspaceConfig() instead.',\n\t\t);\n\t}\n\n\treturn config;\n}\n\n/**\n * Load configuration file and process it as a workspace.\n * Works with both single-app and workspace configurations.\n *\n * Single-app configs are automatically wrapped as a workspace with one app.\n *\n * @example\n * ```ts\n * const { type, workspace } = await loadWorkspaceConfig();\n *\n * if (type === 'workspace') {\n * console.log('Multi-app workspace:', workspace.apps);\n * } else {\n * console.log('Single app wrapped as workspace');\n * }\n * ```\n */\nexport async function loadWorkspaceConfig(\n\tcwd: string = process.cwd(),\n): Promise<LoadedConfig> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\treturn withDerivedApps(processConfig(config, workspaceRoot));\n}\n\n/**\n * The loaded config, with its apps read off the graph.\n *\n * Here rather than at each call site because every command needs the same\n * answer, and the ones that forgot to ask were exactly the bugs: a site that\n * never deployed, a surface that could not be its own process. `gkm dev`,\n * `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without\n * any of them knowing a derivation happened.\n *\n * Discovery imports the construct modules — declarations only, not endpoints —\n * which is the same import the reconciler and the build already do. A workspace\n * with no `constructs` glob discovers nothing and keeps whatever its config\n * said, so nothing that worked before changes.\n *\n * A construct file that throws is reported and skipped rather than taking the\n * command down: `gkm dev` failing to start because a half-written declaration\n * cannot be imported is a worse failure than starting with the app it does not\n * describe yet.\n */\nasync function withDerivedApps(loaded: LoadedConfig): Promise<LoadedConfig> {\n\tconst globs = allConstructGlobs(loaded.workspace);\n\tif (globs.length === 0) return loaded;\n\n\ttry {\n\t\tconst manifest = await discover({\n\t\t\tpatterns: globs,\n\t\t\tcwd: loaded.workspace.root,\n\t\t});\n\n\t\treturn {\n\t\t\t...loaded,\n\t\t\tmanifest,\n\t\t\tworkspace: {\n\t\t\t\t...loaded.workspace,\n\t\t\t\tapps: derivedApps(manifest, loaded.workspace),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(\n\t\t\t`⚠️ Could not read constructs, so apps come from config alone: ${message}`,\n\t\t);\n\t\treturn loaded;\n\t}\n}\n\nexport interface AppConfigResult {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tgkmConfig: GkmConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n\tappRoot: string;\n}\n\n/**\n * The app a package directory refers to, and what the workspace calls it.\n *\n * A single-app config is wrapped as a one-app workspace keyed `api`, which is\n * almost never the package name. Matching on the key alone means an app like\n * `@geekmidas/example` resolves to nothing and silently loses everything that\n * comes from the workspace — including the URLs its constructs declare.\n */\nfunction resolveWorkspaceApp(\n\tloadedConfig: LoadedConfig,\n\tappName: string,\n): { key: string; app: NormalizedAppConfig } | undefined {\n\tconst apps = loadedConfig.workspace.apps;\n\n\tconst named = apps[appName];\n\tif (named) return { key: appName, app: named };\n\n\tconst names = Object.keys(apps);\n\tconst only = names[0];\n\tif (loadedConfig.type !== 'single' || names.length !== 1 || !only) {\n\t\treturn undefined;\n\t}\n\n\tconst app = apps[only];\n\n\treturn app ? { key: only, app } : undefined;\n}\n\n/**\n * Load app-specific configuration from workspace.\n * Uses the app name from package.json to find the correct app config.\n *\n * @example\n * ```ts\n * // From apps/api directory with package.json: { \"name\": \"@myorg/api\" }\n * const { app, workspace, workspaceRoot } = await loadAppConfig();\n * console.log(app.routes); // './src/endpoints/**\\/*.ts'\n * ```\n */\nexport async function loadAppConfig(\n\tcwd: string = process.cwd(),\n): Promise<AppConfigResult> {\n\tconst appName = getAppNameFromCwd(cwd);\n\n\tif (!appName) {\n\t\tthrow new Error(\n\t\t\t'Could not determine app name. Ensure package.json exists with a \"name\" field.',\n\t\t);\n\t}\n\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, appName);\n\n\tif (!resolved) {\n\t\tthrow new Error(\n\t\t\t`App \"${appName}\" not found in workspace config. Available apps: ${Object.keys(\n\t\t\t\tloadedConfig.workspace.apps,\n\t\t\t).join(', ')}. ` +\n\t\t\t\t`Ensure the package.json name matches the app key in gkm.config.ts.`,\n\t\t);\n\t}\n\n\tconst { key, app } = resolved;\n\n\t// Keyed by what the workspace calls the app, not by the package name — for a\n\t// single-app config those differ.\n\tconst gkmConfig = getAppGkmConfig(loadedConfig.workspace, key);\n\n\tif (!gkmConfig) {\n\t\tthrow new Error(\n\t\t\t`App \"${appName}\" is not a backend app and cannot be run with gkm dev.`,\n\t\t);\n\t}\n\n\treturn {\n\t\tappName,\n\t\tapp,\n\t\tgkmConfig,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t\tappRoot: join(workspaceRoot, app.path),\n\t};\n}\n\nexport interface WorkspaceAppInfo {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n}\n\n/**\n * Load workspace info for any app (frontend or backend).\n * Unlike loadAppConfig, this does NOT require the app to have a gkm config\n * (routes, entry, etc.), making it suitable for gkm exec/test from frontend apps.\n */\nexport async function loadWorkspaceAppInfo(\n\tcwd: string = process.cwd(),\n): Promise<WorkspaceAppInfo> {\n\tconst appName = getAppNameFromCwd(cwd);\n\n\tif (!appName) {\n\t\tthrow new Error(\n\t\t\t'Could not determine app name. Ensure package.json exists with a \"name\" field.',\n\t\t);\n\t}\n\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, appName);\n\n\tif (!resolved) {\n\t\tconst availableApps = Object.keys(loadedConfig.workspace.apps).join(', ');\n\t\tthrow new Error(\n\t\t\t`App \"${appName}\" not found in workspace config. Available apps: ${availableApps}. ` +\n\t\t\t\t`Ensure the package.json name matches the app key in gkm.config.ts.`,\n\t\t);\n\t}\n\n\treturn {\n\t\tappName,\n\t\tapp: resolved.app,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t};\n}\n"],"mappings":";;;;;;;;AAqCA,MAAMA,aAAwC;CAC7C,QAAQ;CACR,MAAM;CACN,UAAU;AACV;;;;;;;;AASD,SAAgB,OAAOC,IAAoB;AAC1C,QAAO,UAAU,GAAG;AACpB;;;;;;;;;AAUD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C1B,cAAc,QAAQ,cAAc,CACpC;CAED,MAAM,WAAW,oBAAoB,cAAc,QAAQ;AAE3D,MAAK,SACJ,OAAM,IAAI,OACR,OAAO,QAAQ,mDAAmD,OAAO,KACzE,aAAa,UAAU,KACvB,CAAC,KAAK,KAAK,CAAC;CAKf,MAAM,EAAE,KAAK,KAAK,GAAG;CAIrB,MAAM,YAAY,gBAAgB,aAAa,WAAW,IAAI;AAE9D,MAAK,UACJ,OAAM,IAAI,OACR,OAAO,QAAQ;AAIlB,QAAO;EACN;EACA;EACA;EACA,WAAW,aAAa;EACxB;EACA,SAAS,KAAK,eAAe,IAAI,KAAK;CACtC;AACD;;;;;;AAcD,eAAsB,qBACrBA,MAAc,QAAQ,KAAK,EACC;CAC5B,MAAM,UAAU,kBAAkB,IAAI;AAEtC,MAAK,QACJ,OAAM,IAAI,MACT;CAIF,MAAM,EAAE,QAAQ,eAAe,GAAG,MAAM,cAAc,IAAI;CAC1D,MAAM,eAAe,MAAM,gBAC1B,cAAc,QAAQ,cAAc,CACpC;CAED,MAAM,WAAW,oBAAoB,cAAc,QAAQ;AAE3D,MAAK,UAAU;EACd,MAAM,gBAAgB,OAAO,KAAK,aAAa,UAAU,KAAK,CAAC,KAAK,KAAK;AACzE,QAAM,IAAI,OACR,OAAO,QAAQ,mDAAmD,cAAc;CAGlF;AAED,QAAO;EACN;EACA,KAAK,SAAS;EACd,WAAW,aAAa;EACxB;CACA;AACD"}
|
package/dist/config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require('./discover-DTmFeloL.cjs');
|
|
2
|
-
const require_config = require('./config-
|
|
2
|
+
const require_config = require('./config-BholeD-0.cjs');
|
|
3
3
|
const require_workspace = require('./workspace-XvqO9jIv.cjs');
|
|
4
4
|
|
|
5
5
|
exports.defineConfig = require_config.defineConfig;
|
package/dist/config.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./discover-CAlFgYec.mjs";
|
|
2
|
-
import { defineConfig, getAppNameFromCwd, loadAppConfig, loadConfig, loadWorkspaceAppInfo, loadWorkspaceConfig, parseModuleConfig } from "./config-
|
|
2
|
+
import { defineConfig, getAppNameFromCwd, loadAppConfig, loadConfig, loadWorkspaceAppInfo, loadWorkspaceConfig, parseModuleConfig } from "./config-CzWnfcXM.mjs";
|
|
3
3
|
import { defineWorkspace } from "./workspace-7FqprxuJ.mjs";
|
|
4
4
|
|
|
5
5
|
export { defineConfig, defineWorkspace, getAppNameFromCwd, loadAppConfig, loadConfig, loadWorkspaceAppInfo, loadWorkspaceConfig, parseModuleConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_CACHE, DEFAULT_EMAIL, DEFAULT_STORAGE, discover } from "./discover-CAlFgYec.mjs";
|
|
2
|
-
import { appKey, getAppNameFromCwd, hostOf, loadWorkspaceAppInfo } from "./config-
|
|
2
|
+
import { appKey, getAppNameFromCwd, hostOf, loadWorkspaceAppInfo } from "./config-CzWnfcXM.mjs";
|
|
3
3
|
import { allConstructGlobs, getDependencyEnvVars } from "./workspace-7FqprxuJ.mjs";
|
|
4
4
|
import { generatePgBossUrl } from "./generator-VE2JrFlY.mjs";
|
|
5
5
|
import { readStageSecrets, secretsExist, toEmbeddableSecrets } from "./storage-Bi24WfoW.mjs";
|
|
@@ -2472,7 +2472,7 @@ async function prepareEntryCredentials(options) {
|
|
|
2472
2472
|
credentials.PORT = String(resolvedPort);
|
|
2473
2473
|
const declaredKeys = [];
|
|
2474
2474
|
if (appInfo && usesConstructs(appInfo.workspace)) {
|
|
2475
|
-
const { reconcileWorkspace: reconcileWorkspace$1 } = await import("./workspace-
|
|
2475
|
+
const { reconcileWorkspace: reconcileWorkspace$1 } = await import("./workspace-DK4WWJIn.mjs");
|
|
2476
2476
|
const reconciled = await reconcileWorkspace$1(appInfo.workspace, {
|
|
2477
2477
|
stage: options.reconcileStage ?? "development",
|
|
2478
2478
|
start: options.startDocker ?? false
|
|
@@ -2545,4 +2545,4 @@ async function prepareEntryCredentials(options) {
|
|
|
2545
2545
|
|
|
2546
2546
|
//#endregion
|
|
2547
2547
|
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-
|
|
2548
|
+
//# sourceMappingURL=credentials-BZcp3CGx.mjs.map
|