Rocky_Mountain_Vending/.pnpm-store/v10/files/a7/7cceb535a883ad83356261e58e5c0e9e38aa3a6c8b42f2576c6cd5aba114cc4325db59b070bb68e32dbc6cde69b26977607cae823bcdceae8f36e903bea7c8
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

50 lines
No EOL
2.1 KiB
Text

import os from 'os';
import path from 'path';
import { promises as fs } from 'fs';
export async function writeAppTypeDeclarations({ baseDir, distDir, imageImportsEnabled, hasPagesDir, hasAppDir }) {
// Reference `next` types
const appTypeDeclarations = path.join(baseDir, 'next-env.d.ts');
// Defaults EOL to system default
let eol = os.EOL;
let currentContent;
try {
currentContent = await fs.readFile(appTypeDeclarations, 'utf8');
// If file already exists then preserve its line ending
const lf = currentContent.indexOf('\n', /* skip first so we can lf - 1 */ 1);
if (lf !== -1) {
if (currentContent[lf - 1] === '\r') {
eol = '\r\n';
} else {
eol = '\n';
}
}
} catch {}
/**
* "Triple-slash directives" used to create typings files for Next.js projects
* using Typescript .
*
* @see https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html
*/ const directives = [
// Include the core Next.js typings.
'/// <reference types="next" />'
];
if (imageImportsEnabled) {
directives.push('/// <reference types="next/image-types/global" />');
}
if (hasAppDir && hasPagesDir) {
directives.push('/// <reference types="next/navigation-types/compat/navigation" />');
}
const routeTypesPath = path.posix.join(distDir.replaceAll(path.win32.sep, path.posix.sep), 'types/routes.d.ts');
// Use ESM import instead of triple-slash reference for better ESLint compatibility
directives.push(`import "./${routeTypesPath}";`);
// Push the notice in.
directives.push('', '// NOTE: This file should not be edited', `// see https://nextjs.org/docs/${hasAppDir ? 'app' : 'pages'}/api-reference/config/typescript for more information.`);
const content = directives.join(eol) + eol;
// Avoids an un-necessary write on read-only fs
if (currentContent === content) {
return;
}
await fs.writeFile(appTypeDeclarations, content);
}
//# sourceMappingURL=writeAppTypeDeclarations.js.map