create-oven 0.2.2 → 0.2.4
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 +16 -50
- 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.4');
|
|
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.4 ║
|
|
142
142
|
║ ║
|
|
143
143
|
║ Next.js-style framework for Bun ║
|
|
144
144
|
║ ║
|
|
@@ -229,7 +229,7 @@ ${c.bold}${c.cyan} ╔═══════════════════
|
|
|
229
229
|
const spin2 = spinner('Creating configuration files...');
|
|
230
230
|
|
|
231
231
|
// package.json
|
|
232
|
-
const ext = useTypescript ? '
|
|
232
|
+
const ext = useTypescript ? 'tsx' : 'js';
|
|
233
233
|
const pkg = {
|
|
234
234
|
name: projectName,
|
|
235
235
|
version: '0.1.0',
|
|
@@ -238,7 +238,7 @@ ${c.bold}${c.cyan} ╔═══════════════════
|
|
|
238
238
|
dev: `bun run --hot ${useSrcDir ? 'src/' : ''}server.${ext}`,
|
|
239
239
|
build: `bun build ./${useSrcDir ? 'src/' : ''}server.${ext} --outdir ./dist --target bun`,
|
|
240
240
|
start: 'bun run dist/server.js',
|
|
241
|
-
lint: useEslint ? 'eslint . --ext .
|
|
241
|
+
lint: useEslint ? 'eslint . --ext .tsx' : undefined,
|
|
242
242
|
},
|
|
243
243
|
dependencies: {},
|
|
244
244
|
devDependencies: {
|
|
@@ -276,7 +276,7 @@ ${c.bold}${c.cyan} ╔═══════════════════
|
|
|
276
276
|
},
|
|
277
277
|
baseUrl: '.',
|
|
278
278
|
},
|
|
279
|
-
include: [useSrcDir ? 'src/**/*.
|
|
279
|
+
include: [useSrcDir ? 'src/**/*.tsx' : '**/*.tsx'],
|
|
280
280
|
exclude: ['node_modules', 'dist'],
|
|
281
281
|
};
|
|
282
282
|
fs.writeFileSync(path.join(projectDir, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2));
|
|
@@ -361,36 +361,6 @@ export default config;
|
|
|
361
361
|
// Create app files
|
|
362
362
|
const spin3 = spinner('Creating app files...');
|
|
363
363
|
|
|
364
|
-
// Types
|
|
365
|
-
const typesContent = `export interface PageProps {
|
|
366
|
-
params: Record<string, string>;
|
|
367
|
-
searchParams: Record<string, string | string[] | undefined>;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
export interface LayoutProps {
|
|
371
|
-
children: ${useTypescript ? 'string' : 'any'};
|
|
372
|
-
params: Record<string, string>;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
export interface Metadata {
|
|
376
|
-
title?: string | { default: string; template?: string };
|
|
377
|
-
description?: string;
|
|
378
|
-
keywords?: string[];
|
|
379
|
-
openGraph?: {
|
|
380
|
-
title?: string;
|
|
381
|
-
description?: string;
|
|
382
|
-
images?: { url: string }[];
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
export interface OvenConfig {
|
|
387
|
-
port?: number;
|
|
388
|
-
appDir?: string;
|
|
389
|
-
publicDir?: string;
|
|
390
|
-
}
|
|
391
|
-
`;
|
|
392
|
-
fs.writeFileSync(path.join(appDir, `types.${ext}`), typesContent);
|
|
393
|
-
|
|
394
364
|
// globals.css
|
|
395
365
|
const globalsCss = useTailwind ? `@tailwind base;
|
|
396
366
|
@tailwind components;
|
|
@@ -442,8 +412,7 @@ a {
|
|
|
442
412
|
fs.writeFileSync(path.join(projectDir, 'public', '.gitkeep'), '');
|
|
443
413
|
|
|
444
414
|
// Root Layout
|
|
445
|
-
const layoutContent = `import
|
|
446
|
-
import './globals.css';
|
|
415
|
+
const layoutContent = `import './globals.css';
|
|
447
416
|
|
|
448
417
|
export const metadata = {
|
|
449
418
|
title: {
|
|
@@ -453,7 +422,7 @@ export const metadata = {
|
|
|
453
422
|
description: 'Built with Oven - A Next.js-style framework for Bun',
|
|
454
423
|
};
|
|
455
424
|
|
|
456
|
-
export default function RootLayout({ children }${useTypescript ? ':
|
|
425
|
+
export default function RootLayout({ children }${useTypescript ? ': { children: string }' : ''}) {
|
|
457
426
|
return \`
|
|
458
427
|
<!DOCTYPE html>
|
|
459
428
|
<html lang="en">
|
|
@@ -469,17 +438,15 @@ export default function RootLayout({ children }${useTypescript ? ': LayoutProps'
|
|
|
469
438
|
\`;
|
|
470
439
|
}
|
|
471
440
|
`;
|
|
472
|
-
fs.writeFileSync(path.join(appDir, `layout.${ext}
|
|
441
|
+
fs.writeFileSync(path.join(appDir, `layout.${ext}`), layoutContent);
|
|
473
442
|
|
|
474
443
|
// Home Page
|
|
475
|
-
const homePageContent = `
|
|
476
|
-
|
|
477
|
-
export const metadata${useTypescript ? ': Metadata' : ''} = {
|
|
444
|
+
const homePageContent = `export const metadata = {
|
|
478
445
|
title: 'Home',
|
|
479
446
|
description: 'Welcome to ${projectName}',
|
|
480
447
|
};
|
|
481
448
|
|
|
482
|
-
export default function HomePage(
|
|
449
|
+
export default function HomePage() {
|
|
483
450
|
return \`
|
|
484
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;"'}>
|
|
485
452
|
<div ${useTailwind ? 'class="text-center"' : 'style="text-align: center;"'}>
|
|
@@ -490,7 +457,7 @@ export default function HomePage({ searchParams }${useTypescript ? ': PageProps'
|
|
|
490
457
|
<p ${useTailwind ? 'class="text-xl text-gray-600 mb-8"' : 'style="font-size: 1.25rem; color: #666; margin-bottom: 2rem;"'}>
|
|
491
458
|
Get started by editing
|
|
492
459
|
<code ${useTailwind ? 'class="px-2 py-1 bg-gray-100 rounded text-oven-400 font-mono"' : 'style="padding: 0.25rem 0.5rem; background: #f5f5f5; border-radius: 4px; color: #ff6b35; font-family: monospace;"'}>
|
|
493
|
-
${useSrcDir ? 'src/' : ''}app/page.${ext}
|
|
460
|
+
${useSrcDir ? 'src/' : ''}app/page.${ext}
|
|
494
461
|
</code>
|
|
495
462
|
</p>
|
|
496
463
|
|
|
@@ -530,7 +497,7 @@ export default function HomePage({ searchParams }${useTypescript ? ': PageProps'
|
|
|
530
497
|
\`;
|
|
531
498
|
}
|
|
532
499
|
`;
|
|
533
|
-
fs.writeFileSync(path.join(appDir, `page.${ext}
|
|
500
|
+
fs.writeFileSync(path.join(appDir, `page.${ext}`), homePageContent);
|
|
534
501
|
|
|
535
502
|
// Server file
|
|
536
503
|
const serverContent = `/**
|
|
@@ -713,17 +680,16 @@ bun run dev
|
|
|
713
680
|
|
|
714
681
|
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
715
682
|
|
|
716
|
-
You can start editing the page by modifying \`${useSrcDir ? 'src/' : ''}app/page.${ext}
|
|
683
|
+
You can start editing the page by modifying \`${useSrcDir ? 'src/' : ''}app/page.${ext}\`. The page auto-updates as you edit the file.
|
|
717
684
|
|
|
718
685
|
## Project Structure
|
|
719
686
|
|
|
720
687
|
\`\`\`
|
|
721
688
|
${projectName}/
|
|
722
689
|
├── ${useSrcDir ? 'src/' : ''}app/
|
|
723
|
-
│ ├── layout.${ext}
|
|
724
|
-
│ ├── page.${ext}
|
|
725
|
-
│
|
|
726
|
-
│ └── types.${ext} # TypeScript types
|
|
690
|
+
│ ├── layout.${ext} # Root layout
|
|
691
|
+
│ ├── page.${ext} # Home page (/)
|
|
692
|
+
│ └── globals.css # Global styles
|
|
727
693
|
├── public/ # Static files
|
|
728
694
|
${useTailwind ? '├── tailwind.config.js # Tailwind config\n' : ''}├── oven.config.${ext} # Oven config
|
|
729
695
|
└── package.json
|