Lines 8-48javascript
8import { join } from 'path';
9import { createJiti } from 'jiti';
10const VENTURE_CONFIG_FILE = 'vk.config.ts';
12 * Load vk.config.ts from the given project directory.
14 * Uses jiti for runtime TypeScript transpilation so consumers
15 * don't need tsx/ts-node installed.
17 * @throws if vk.config.ts is not found or fails to load
19export async function loadVentureConfig(projectDir, stage) {
20 const configPath = join(projectDir, VENTURE_CONFIG_FILE);
21 if (!existsSync(configPath)) {
22 throw new Error(`No ${VENTURE_CONFIG_FILE} found in ${projectDir}. Run \`vk init <name>\` first.`);
24 // Create a jiti instance rooted at the project dir
25 const jiti = createJiti(projectDir, {
29 const mod = await jiti.import(configPath);
30 const config = mod?.default ?? mod;
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/utils/config-loader.jsView on unpkg · L28 31 // defineVenture() returns { app(), _routesDir, _resolveInfrastructure, _definition }
32 if (typeof config?.app === 'function') {
33 const currentStage = stage || 'dev';
34 const appConfig = config.app({ stage: currentStage });
35 // Extract infrastructure intents from the env config for the current stage
36 const resolvedInfra = typeof config._resolveInfrastructure === 'function'
37 ? config._resolveInfrastructure(currentStage)
40 name: appConfig.name || 'venture-app',
41 region: appConfig.providers?.aws?.region || 'us-east-1',
42 routesDir: config._routesDir || 'src/routes',
43 functionsDir: config._functionsDir || 'src/functions',
44 queuesDir: config._queuesDir || 'src/queues',
45 cronsDir: config._cronsDir || 'src/crons',
46 wsDir: config._wsDir || 'src/ws',
47 infrastructure: resolvedInfra,
48 definition: config._definition,