Rocky_Mountain_Vending/.pnpm-store/v10/files/16/8424c173144ed8dd880d5dd3289abb76ac7decd264e68818f172dade081fc55286f6947681b5aed75ab3b97596ffd5fb05fe48059a02cbe2c5ef1df5729f53
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

38 lines
No EOL
1.2 KiB
Text

import { join } from 'node:path';
import { writeFile } from 'node:fs/promises';
export async function createEnvDefinitions({ distDir, loadedEnvFiles }) {
const envLines = [];
const seenKeys = new Set();
// env files are in order of priority
for (const { path, env } of loadedEnvFiles){
for(const key in env){
if (!seenKeys.has(key)) {
envLines.push(` /** Loaded from \`${path}\` */`);
envLines.push(` ${key}?: string`);
seenKeys.add(key);
}
}
}
const envStr = envLines.join('\n');
const definitionStr = `// Type definitions for Next.js environment variables
declare global {
namespace NodeJS {
interface ProcessEnv {
${envStr}
}
}
}
export {}`;
if (process.env.NODE_ENV === 'test') {
return definitionStr;
}
try {
// we expect the types directory to already exist
const envDtsPath = join(distDir, 'types', 'env.d.ts');
await writeFile(envDtsPath, definitionStr, 'utf-8');
} catch (e) {
console.error('Failed to write env.d.ts:', e);
}
}
//# sourceMappingURL=create-env-definitions.js.map