create-oven 0.2.1 → 0.2.3
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/index.js +9 -133
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -131,14 +131,14 @@ async function main() {
|
|
|
131
131
|
|
|
132
132
|
// Show version
|
|
133
133
|
if (args.includes('--version') || args.includes('-v')) {
|
|
134
|
-
console.log('create-oven v0.2.
|
|
134
|
+
console.log('create-oven v0.2.3');
|
|
135
135
|
process.exit(0);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
console.log(`
|
|
139
139
|
${c.bold}${c.cyan} ╔═══════════════════════════════════════╗
|
|
140
140
|
║ ║
|
|
141
|
-
║ 🔥 Create Oven App v0.2.
|
|
141
|
+
║ 🔥 Create Oven App v0.2.3 ║
|
|
142
142
|
║ ║
|
|
143
143
|
║ Next.js-style framework for Bun ║
|
|
144
144
|
║ ║
|
|
@@ -216,8 +216,6 @@ ${c.bold}${c.cyan} ╔═══════════════════
|
|
|
216
216
|
// Create directories
|
|
217
217
|
const dirs = [
|
|
218
218
|
appDir,
|
|
219
|
-
path.join(appDir, 'api', 'hello'),
|
|
220
|
-
path.join(appDir, 'about'),
|
|
221
219
|
path.join(projectDir, 'public'),
|
|
222
220
|
];
|
|
223
221
|
|
|
@@ -363,36 +361,6 @@ export default config;
|
|
|
363
361
|
// Create app files
|
|
364
362
|
const spin3 = spinner('Creating app files...');
|
|
365
363
|
|
|
366
|
-
// Types
|
|
367
|
-
const typesContent = `export interface PageProps {
|
|
368
|
-
params: Record<string, string>;
|
|
369
|
-
searchParams: Record<string, string | string[] | undefined>;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export interface LayoutProps {
|
|
373
|
-
children: ${useTypescript ? 'string' : 'any'};
|
|
374
|
-
params: Record<string, string>;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export interface Metadata {
|
|
378
|
-
title?: string | { default: string; template?: string };
|
|
379
|
-
description?: string;
|
|
380
|
-
keywords?: string[];
|
|
381
|
-
openGraph?: {
|
|
382
|
-
title?: string;
|
|
383
|
-
description?: string;
|
|
384
|
-
images?: { url: string }[];
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
export interface OvenConfig {
|
|
389
|
-
port?: number;
|
|
390
|
-
appDir?: string;
|
|
391
|
-
publicDir?: string;
|
|
392
|
-
}
|
|
393
|
-
`;
|
|
394
|
-
fs.writeFileSync(path.join(appDir, `types.${ext}`), typesContent);
|
|
395
|
-
|
|
396
364
|
// globals.css
|
|
397
365
|
const globalsCss = useTailwind ? `@tailwind base;
|
|
398
366
|
@tailwind components;
|
|
@@ -444,8 +412,7 @@ a {
|
|
|
444
412
|
fs.writeFileSync(path.join(projectDir, 'public', '.gitkeep'), '');
|
|
445
413
|
|
|
446
414
|
// Root Layout
|
|
447
|
-
const layoutContent = `import
|
|
448
|
-
import './globals.css';
|
|
415
|
+
const layoutContent = `import './globals.css';
|
|
449
416
|
|
|
450
417
|
export const metadata = {
|
|
451
418
|
title: {
|
|
@@ -455,7 +422,7 @@ export const metadata = {
|
|
|
455
422
|
description: 'Built with Oven - A Next.js-style framework for Bun',
|
|
456
423
|
};
|
|
457
424
|
|
|
458
|
-
export default function RootLayout({ children }${useTypescript ? ':
|
|
425
|
+
export default function RootLayout({ children }${useTypescript ? ': { children: string }' : ''}) {
|
|
459
426
|
return \`
|
|
460
427
|
<!DOCTYPE html>
|
|
461
428
|
<html lang="en">
|
|
@@ -474,14 +441,12 @@ export default function RootLayout({ children }${useTypescript ? ': LayoutProps'
|
|
|
474
441
|
fs.writeFileSync(path.join(appDir, `layout.${ext}x`), layoutContent);
|
|
475
442
|
|
|
476
443
|
// Home Page
|
|
477
|
-
const homePageContent = `
|
|
478
|
-
|
|
479
|
-
export const metadata${useTypescript ? ': Metadata' : ''} = {
|
|
444
|
+
const homePageContent = `export const metadata = {
|
|
480
445
|
title: 'Home',
|
|
481
446
|
description: 'Welcome to ${projectName}',
|
|
482
447
|
};
|
|
483
448
|
|
|
484
|
-
export default function HomePage(
|
|
449
|
+
export default function HomePage() {
|
|
485
450
|
return \`
|
|
486
451
|
<main ${useTailwind ? 'class="flex min-h-screen flex-col items-center justify-center p-24"' : 'style="display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 6rem;"'}>
|
|
487
452
|
<div ${useTailwind ? 'class="text-center"' : 'style="text-align: center;"'}>
|
|
@@ -497,11 +462,8 @@ export default function HomePage({ searchParams }${useTypescript ? ': PageProps'
|
|
|
497
462
|
</p>
|
|
498
463
|
|
|
499
464
|
<div ${useTailwind ? 'class="flex gap-4 flex-wrap justify-center"' : 'style="display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center;"'}>
|
|
500
|
-
<a href="/
|
|
501
|
-
|
|
502
|
-
</a>
|
|
503
|
-
<a href="/api/hello" ${useTailwind ? 'class="px-6 py-3 bg-gray-900 text-white rounded-lg font-medium hover:bg-gray-800 transition"' : 'style="padding: 0.75rem 1.5rem; background: #1a1a1a; color: white; border-radius: 8px; font-weight: 500;"'}>
|
|
504
|
-
API Example
|
|
465
|
+
<a href="https://github.com/oven-ttta/oven-framework" target="_blank" ${useTailwind ? 'class="px-6 py-3 bg-gradient-to-r from-oven-400 to-oven-500 text-white rounded-lg font-medium hover:opacity-90 transition"' : 'style="padding: 0.75rem 1.5rem; background: linear-gradient(135deg, #ff6b35, #f7931e); color: white; border-radius: 8px; font-weight: 500;"'}>
|
|
466
|
+
Documentation →
|
|
505
467
|
</a>
|
|
506
468
|
<a href="https://github.com/oven-ttta/oven-framework" target="_blank" ${useTailwind ? 'class="px-6 py-3 border border-gray-300 rounded-lg font-medium hover:border-gray-400 transition"' : 'style="padding: 0.75rem 1.5rem; border: 1px solid #ddd; border-radius: 8px; font-weight: 500;"'}>
|
|
507
469
|
GitHub ⭐
|
|
@@ -537,87 +499,6 @@ export default function HomePage({ searchParams }${useTypescript ? ': PageProps'
|
|
|
537
499
|
`;
|
|
538
500
|
fs.writeFileSync(path.join(appDir, `page.${ext}x`), homePageContent);
|
|
539
501
|
|
|
540
|
-
// About Page
|
|
541
|
-
const aboutPageContent = `import${useTypescript ? ' type' : ''} { PageProps, Metadata } from '../types';
|
|
542
|
-
|
|
543
|
-
export const metadata${useTypescript ? ': Metadata' : ''} = {
|
|
544
|
-
title: 'About',
|
|
545
|
-
description: 'About ${projectName}',
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
export default function AboutPage({ params }${useTypescript ? ': PageProps' : ''}) {
|
|
549
|
-
return \`
|
|
550
|
-
<main ${useTailwind ? 'class="max-w-4xl mx-auto px-6 py-16"' : 'style="max-width: 900px; margin: 0 auto; padding: 4rem 1.5rem;"'}>
|
|
551
|
-
<a href="/" ${useTailwind ? 'class="text-oven-400 hover:underline mb-8 inline-block"' : 'style="color: #ff6b35; margin-bottom: 2rem; display: inline-block;"'}>
|
|
552
|
-
← Back to Home
|
|
553
|
-
</a>
|
|
554
|
-
|
|
555
|
-
<h1 ${useTailwind ? 'class="text-4xl font-bold mb-6"' : 'style="font-size: 2.5rem; font-weight: bold; margin-bottom: 1.5rem;"'}>
|
|
556
|
-
About ${projectName}
|
|
557
|
-
</h1>
|
|
558
|
-
|
|
559
|
-
<p ${useTailwind ? 'class="text-lg text-gray-600 mb-8 leading-relaxed"' : 'style="font-size: 1.1rem; color: #666; margin-bottom: 2rem; line-height: 1.8;"'}>
|
|
560
|
-
This project was bootstrapped with <strong>create-oven</strong>,
|
|
561
|
-
a Next.js-style framework powered by the Bun runtime.
|
|
562
|
-
</p>
|
|
563
|
-
|
|
564
|
-
<div ${useTailwind ? 'class="bg-oven-50 border-l-4 border-oven-400 p-6 rounded-r-lg mb-8"' : 'style="background: #fff5f2; border-left: 4px solid #ff6b35; padding: 1.5rem; border-radius: 0 8px 8px 0; margin-bottom: 2rem;"'}>
|
|
565
|
-
<h2 ${useTailwind ? 'class="text-xl font-semibold mb-4"' : 'style="font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem;"'}>
|
|
566
|
-
🚀 Why Oven?
|
|
567
|
-
</h2>
|
|
568
|
-
<ul ${useTailwind ? 'class="space-y-2 text-gray-700"' : 'style="list-style: none;"'}>
|
|
569
|
-
<li ${useTailwind ? '' : 'style="margin-bottom: 0.5rem; color: #444;"'}>✓ Built for Bun runtime - 4x faster than Node.js</li>
|
|
570
|
-
<li ${useTailwind ? '' : 'style="margin-bottom: 0.5rem; color: #444;"'}>✓ Next.js-style file-based routing</li>
|
|
571
|
-
<li ${useTailwind ? '' : 'style="margin-bottom: 0.5rem; color: #444;"'}>✓ Zero configuration needed</li>
|
|
572
|
-
<li ${useTailwind ? '' : 'style="margin-bottom: 0.5rem; color: #444;"'}>✓ Full TypeScript support</li>
|
|
573
|
-
${useTailwind ? "<li>✓ Tailwind CSS integration</li>" : ""}
|
|
574
|
-
</ul>
|
|
575
|
-
</div>
|
|
576
|
-
|
|
577
|
-
<h2 ${useTailwind ? 'class="text-2xl font-semibold mb-4"' : 'style="font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem;"'}>
|
|
578
|
-
Learn More
|
|
579
|
-
</h2>
|
|
580
|
-
|
|
581
|
-
<div ${useTailwind ? 'class="flex gap-4 flex-wrap"' : 'style="display: flex; gap: 1rem; flex-wrap: wrap;"'}>
|
|
582
|
-
<a href="https://github.com/oven-ttta/oven-framework" target="_blank"
|
|
583
|
-
${useTailwind ? 'class="px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition"' : 'style="padding: 0.5rem 1rem; background: #1a1a1a; color: white; border-radius: 8px;"'}>
|
|
584
|
-
GitHub
|
|
585
|
-
</a>
|
|
586
|
-
<a href="https://bun.sh/docs" target="_blank"
|
|
587
|
-
${useTailwind ? 'class="px-4 py-2 border border-gray-300 rounded-lg hover:border-gray-400 transition"' : 'style="padding: 0.5rem 1rem; border: 1px solid #ddd; border-radius: 8px;"'}>
|
|
588
|
-
Bun Docs
|
|
589
|
-
</a>
|
|
590
|
-
</div>
|
|
591
|
-
</main>
|
|
592
|
-
\`;
|
|
593
|
-
}
|
|
594
|
-
`;
|
|
595
|
-
fs.writeFileSync(path.join(appDir, 'about', `page.${ext}x`), aboutPageContent);
|
|
596
|
-
|
|
597
|
-
// API Route
|
|
598
|
-
const apiRouteContent = `// API Route: GET /api/hello
|
|
599
|
-
|
|
600
|
-
export async function GET(request${useTypescript ? ': Request' : ''}) {
|
|
601
|
-
return Response.json({
|
|
602
|
-
message: 'Hello from ${projectName}!',
|
|
603
|
-
timestamp: new Date().toISOString(),
|
|
604
|
-
framework: 'Oven 🔥',
|
|
605
|
-
runtime: 'Bun',
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
export async function POST(request${useTypescript ? ': Request' : ''}) {
|
|
610
|
-
const body = await request.json().catch(() => ({}));
|
|
611
|
-
|
|
612
|
-
return Response.json({
|
|
613
|
-
message: 'Data received!',
|
|
614
|
-
data: body,
|
|
615
|
-
timestamp: new Date().toISOString(),
|
|
616
|
-
}, { status: 201 });
|
|
617
|
-
}
|
|
618
|
-
`;
|
|
619
|
-
fs.writeFileSync(path.join(appDir, 'api', 'hello', `route.${ext}`), apiRouteContent);
|
|
620
|
-
|
|
621
502
|
// Server file
|
|
622
503
|
const serverContent = `/**
|
|
623
504
|
* Oven Server - ${projectName}
|
|
@@ -808,12 +689,7 @@ ${projectName}/
|
|
|
808
689
|
├── ${useSrcDir ? 'src/' : ''}app/
|
|
809
690
|
│ ├── layout.${ext}x # Root layout
|
|
810
691
|
│ ├── page.${ext}x # Home page (/)
|
|
811
|
-
│
|
|
812
|
-
│ ├── about/
|
|
813
|
-
│ │ └── page.${ext}x # About page (/about)
|
|
814
|
-
│ └── api/
|
|
815
|
-
│ └── hello/
|
|
816
|
-
│ └── route.${ext} # API route (/api/hello)
|
|
692
|
+
│ └── globals.css # Global styles
|
|
817
693
|
├── public/ # Static files
|
|
818
694
|
${useTailwind ? '├── tailwind.config.js # Tailwind config\n' : ''}├── oven.config.${ext} # Oven config
|
|
819
695
|
└── package.json
|