@buenojs/bueno 0.8.2 → 0.8.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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Database Templates
3
+ *
4
+ * Database-specific configuration templates
5
+ */
6
+
7
+ import type { DatabaseDriver, DatabaseTemplateResult } from '../project/types';
8
+ import { sqliteTemplate } from './sqlite';
9
+ import { postgresqlTemplate } from './postgresql';
10
+ import { mysqlTemplate } from './mysql';
11
+ import { noneTemplate } from './none';
12
+
13
+ /**
14
+ * Database template registry
15
+ */
16
+ const databaseTemplates: Record<DatabaseDriver, () => DatabaseTemplateResult> = {
17
+ sqlite: sqliteTemplate,
18
+ postgresql: postgresqlTemplate,
19
+ mysql: mysqlTemplate,
20
+ none: noneTemplate,
21
+ };
22
+
23
+ /**
24
+ * Get database template based on driver
25
+ */
26
+ export function getDatabaseTemplate(driver: DatabaseDriver): DatabaseTemplateResult {
27
+ return databaseTemplates[driver]();
28
+ }
29
+
30
+ /**
31
+ * Get database selection options for prompts
32
+ */
33
+ export function getDatabaseOptions(): { value: DatabaseDriver; name: string; description: string }[] {
34
+ return [
35
+ { value: 'none', name: 'None', description: 'No database required' },
36
+ { value: 'sqlite', name: 'SQLite', description: 'Local file-based database' },
37
+ { value: 'postgresql', name: 'PostgreSQL', description: 'Production-ready relational database' },
38
+ { value: 'mysql', name: 'MySQL', description: 'Popular relational database' },
39
+ ];
40
+ }
41
+
42
+ export { sqliteTemplate, postgresqlTemplate, mysqlTemplate, noneTemplate };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * MySQL Database Template
3
+ */
4
+
5
+ import type { DatabaseTemplateResult } from '../project/types';
6
+
7
+ export function mysqlTemplate(): DatabaseTemplateResult {
8
+ return {
9
+ files: [],
10
+ directories: [],
11
+ envConfig: 'DATABASE_URL=mysql://user:password@localhost:3306/dbname',
12
+ configCode: `{ url: process.env.DATABASE_URL ?? 'mysql://localhost/dbname' }`,
13
+ };
14
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * No Database Template
3
+ *
4
+ * Template for projects that don't need a database
5
+ */
6
+
7
+ import type { DatabaseTemplateResult } from '../project/types';
8
+
9
+ export function noneTemplate(): DatabaseTemplateResult {
10
+ return {
11
+ files: [],
12
+ directories: [],
13
+ envConfig: undefined,
14
+ configCode: undefined,
15
+ };
16
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * PostgreSQL Database Template
3
+ */
4
+
5
+ import type { DatabaseTemplateResult } from '../project/types';
6
+
7
+ export function postgresqlTemplate(): DatabaseTemplateResult {
8
+ return {
9
+ files: [],
10
+ directories: [],
11
+ envConfig: 'DATABASE_URL=postgresql://user:password@localhost:5432/dbname',
12
+ configCode: `{ url: process.env.DATABASE_URL ?? 'postgresql://localhost/dbname' }`,
13
+ };
14
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * SQLite Database Template
3
+ */
4
+
5
+ import type { DatabaseTemplateResult } from '../project/types';
6
+
7
+ export function sqliteTemplate(): DatabaseTemplateResult {
8
+ return {
9
+ files: [],
10
+ directories: [],
11
+ envConfig: 'DATABASE_URL=sqlite:./data.db',
12
+ configCode: `{ url: 'sqlite:./data.db' }`,
13
+ };
14
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Frontend Templates
3
+ *
4
+ * Frontend framework-specific configuration templates
5
+ */
6
+
7
+ import type { FrontendFramework, FrontendTemplateResult } from '../project/types';
8
+ import { reactTemplate } from './react';
9
+ import { vueTemplate } from './vue';
10
+ import { svelteTemplate } from './svelte';
11
+ import { solidTemplate } from './solid';
12
+ import { noneTemplate } from './none';
13
+
14
+ /**
15
+ * Frontend template registry
16
+ */
17
+ const frontendTemplates: Record<FrontendFramework, () => FrontendTemplateResult> = {
18
+ react: reactTemplate,
19
+ vue: vueTemplate,
20
+ svelte: svelteTemplate,
21
+ solid: solidTemplate,
22
+ none: noneTemplate,
23
+ };
24
+
25
+ /**
26
+ * Get frontend template based on framework
27
+ */
28
+ export function getFrontendTemplate(framework: FrontendFramework): FrontendTemplateResult {
29
+ return frontendTemplates[framework]();
30
+ }
31
+
32
+ /**
33
+ * Get frontend selection options for prompts
34
+ */
35
+ export function getFrontendOptions(): { value: FrontendFramework; name: string; description: string }[] {
36
+ return [
37
+ { value: 'none', name: 'None', description: 'Static website or API only' },
38
+ { value: 'react', name: 'React', description: 'React with SSR support' },
39
+ { value: 'vue', name: 'Vue', description: 'Vue 3 with SSR support' },
40
+ { value: 'svelte', name: 'Svelte', description: 'Svelte with SSR support' },
41
+ { value: 'solid', name: 'Solid', description: 'SolidJS with SSR support' },
42
+ ];
43
+ }
44
+
45
+ export { reactTemplate, vueTemplate, svelteTemplate, solidTemplate, noneTemplate };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * No Frontend Template
3
+ *
4
+ * Template for API-only or static website projects
5
+ */
6
+
7
+ import type { FrontendTemplateResult } from '../project/types';
8
+
9
+ export function noneTemplate(): FrontendTemplateResult {
10
+ return {
11
+ files: [],
12
+ directories: [],
13
+ dependencies: {},
14
+ devDependencies: {},
15
+ scripts: {},
16
+ };
17
+ }
@@ -0,0 +1,140 @@
1
+ /**
2
+ * React Frontend Template
3
+ */
4
+
5
+ import type { FrontendTemplateResult } from '../project/types';
6
+
7
+ export function reactTemplate(): FrontendTemplateResult {
8
+ return {
9
+ files: [
10
+ {
11
+ path: 'client/index.html',
12
+ content: `<!DOCTYPE html>
13
+ <html lang="en">
14
+ <head>
15
+ <meta charset="UTF-8">
16
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
17
+ <title>Bueno App</title>
18
+ </head>
19
+ <body>
20
+ <div id="root"></div>
21
+ <script type="module" src="./src/main.tsx"></script>
22
+ </body>
23
+ </html>
24
+ `,
25
+ },
26
+ {
27
+ path: 'client/src/main.tsx',
28
+ content: `import { StrictMode } from 'react';
29
+ import { createRoot } from 'react-dom/client';
30
+ import { App } from './App';
31
+ import './styles/globals.css';
32
+
33
+ const root = createRoot(document.getElementById('root')!);
34
+
35
+ root.render(
36
+ <StrictMode>
37
+ <App />
38
+ </StrictMode>
39
+ );
40
+ `,
41
+ },
42
+ {
43
+ path: 'client/src/App.tsx',
44
+ content: `import { useState } from 'react';
45
+
46
+ export function App() {
47
+ const [count, setCount] = useState(0);
48
+
49
+ return (
50
+ <main className="min-h-screen bg-gradient-to-br from-slate-900 to-slate-800 text-white">
51
+ <div className="container mx-auto px-4 py-16">
52
+ <div className="max-w-2xl mx-auto text-center">
53
+ <h1 className="text-5xl font-bold mb-4 bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent">
54
+ Welcome to Bueno
55
+ </h1>
56
+ <p className="text-xl text-slate-300 mb-8">
57
+ A Bun-native full-stack framework
58
+ </p>
59
+
60
+ <div className="bg-slate-800/50 rounded-xl p-8 backdrop-blur-sm border border-slate-700">
61
+ <button
62
+ onClick={() => setCount(c => c + 1)}
63
+ className="px-6 py-3 bg-blue-500 hover:bg-blue-600 rounded-lg font-medium transition-colors"
64
+ >
65
+ Count: {count}
66
+ </button>
67
+ <p className="mt-4 text-slate-400 text-sm">
68
+ Click the button to test React hydration
69
+ </p>
70
+ </div>
71
+
72
+ <div className="mt-8 grid grid-cols-2 gap-4 text-left">
73
+ <a
74
+ href="https://bueno.github.io"
75
+ className="p-4 bg-slate-800/50 rounded-lg border border-slate-700 hover:border-blue-500 transition-colors"
76
+ >
77
+ <h3 className="font-semibold text-blue-400">Documentation</h3>
78
+ <p className="text-sm text-slate-400">Learn more about Bueno</p>
79
+ </a>
80
+ <a
81
+ href="https://github.com/buenojs/bueno"
82
+ className="p-4 bg-slate-800/50 rounded-lg border border-slate-700 hover:border-blue-500 transition-colors"
83
+ >
84
+ <h3 className="font-semibold text-blue-400">GitHub</h3>
85
+ <p className="text-sm text-slate-400">View the source code</p>
86
+ </a>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </main>
91
+ );
92
+ }
93
+ `,
94
+ },
95
+ {
96
+ path: 'client/src/styles/globals.css',
97
+ content: `@tailwind base;
98
+ @tailwind components;
99
+ @tailwind utilities;
100
+
101
+ :root {
102
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
103
+ line-height: 1.5;
104
+ font-weight: 400;
105
+ font-synthesis: none;
106
+ text-rendering: optimizeLegibility;
107
+ -webkit-font-smoothing: antialiased;
108
+ -moz-osx-font-smoothing: grayscale;
109
+ }
110
+
111
+ body {
112
+ margin: 0;
113
+ min-width: 320px;
114
+ min-height: 100vh;
115
+ }
116
+ `,
117
+ },
118
+ ],
119
+ directories: [
120
+ 'client/src/components',
121
+ 'client/src/styles',
122
+ 'client/public',
123
+ ],
124
+ dependencies: {
125
+ react: '^18.3.0',
126
+ 'react-dom': '^18.3.0',
127
+ },
128
+ devDependencies: {
129
+ '@types/react': '^18.3.0',
130
+ '@types/react-dom': '^18.3.0',
131
+ tailwindcss: '^3.4.0',
132
+ postcss: '^8.4.0',
133
+ autoprefixer: '^10.4.0',
134
+ },
135
+ scripts: {
136
+ 'dev:client': 'bun run --watch client/index.html',
137
+ 'build:client': 'bun build ./client/src/main.tsx --outdir ./dist/client',
138
+ },
139
+ };
140
+ }
@@ -0,0 +1,134 @@
1
+ /**
2
+ * SolidJS Frontend Template
3
+ */
4
+
5
+ import type { FrontendTemplateResult } from '../project/types';
6
+
7
+ export function solidTemplate(): FrontendTemplateResult {
8
+ return {
9
+ files: [
10
+ {
11
+ path: 'client/index.html',
12
+ content: `<!DOCTYPE html>
13
+ <html lang="en">
14
+ <head>
15
+ <meta charset="UTF-8">
16
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
17
+ <title>Bueno App</title>
18
+ </head>
19
+ <body>
20
+ <div id="root"></div>
21
+ <script type="module" src="./src/main.tsx"></script>
22
+ </body>
23
+ </html>
24
+ `,
25
+ },
26
+ {
27
+ path: 'client/src/main.tsx',
28
+ content: `import { render } from 'solid-js/web';
29
+ import { App } from './App';
30
+ import './styles/globals.css';
31
+
32
+ const root = document.getElementById('root');
33
+
34
+ if (root) {
35
+ render(() => <App />, root);
36
+ }
37
+ `,
38
+ },
39
+ {
40
+ path: 'client/src/App.tsx',
41
+ content: `import { createSignal } from 'solid-js';
42
+
43
+ export function App() {
44
+ const [count, setCount] = createSignal(0);
45
+
46
+ return (
47
+ <main class="min-h-screen bg-gradient-to-br from-slate-900 to-slate-800 text-white">
48
+ <div class="container mx-auto px-4 py-16">
49
+ <div class="max-w-2xl mx-auto text-center">
50
+ <h1 class="text-5xl font-bold mb-4 bg-gradient-to-r from-cyan-400 to-blue-500 bg-clip-text text-transparent">
51
+ Welcome to Bueno
52
+ </h1>
53
+ <p class="text-xl text-slate-300 mb-8">
54
+ A Bun-native full-stack framework
55
+ </p>
56
+
57
+ <div class="bg-slate-800/50 rounded-xl p-8 backdrop-blur-sm border border-slate-700">
58
+ <button
59
+ onClick={() => setCount(c => c + 1)}
60
+ class="px-6 py-3 bg-cyan-500 hover:bg-cyan-600 rounded-lg font-medium transition-colors"
61
+ >
62
+ Count: {count()}
63
+ </button>
64
+ <p class="mt-4 text-slate-400 text-sm">
65
+ Click the button to test Solid reactivity
66
+ </p>
67
+ </div>
68
+
69
+ <div class="mt-8 grid grid-cols-2 gap-4 text-left">
70
+ <a
71
+ href="https://bueno.github.io"
72
+ class="p-4 bg-slate-800/50 rounded-lg border border-slate-700 hover:border-cyan-500 transition-colors"
73
+ >
74
+ <h3 class="font-semibold text-cyan-400">Documentation</h3>
75
+ <p class="text-sm text-slate-400">Learn more about Bueno</p>
76
+ </a>
77
+ <a
78
+ href="https://github.com/buenojs/bueno"
79
+ class="p-4 bg-slate-800/50 rounded-lg border border-slate-700 hover:border-cyan-500 transition-colors"
80
+ >
81
+ <h3 class="font-semibold text-cyan-400">GitHub</h3>
82
+ <p class="text-sm text-slate-400">View the source code</p>
83
+ </a>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </main>
88
+ );
89
+ }
90
+ `,
91
+ },
92
+ {
93
+ path: 'client/src/styles/globals.css',
94
+ content: `@tailwind base;
95
+ @tailwind components;
96
+ @tailwind utilities;
97
+
98
+ :root {
99
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
100
+ line-height: 1.5;
101
+ font-weight: 400;
102
+ font-synthesis: none;
103
+ text-rendering: optimizeLegibility;
104
+ -webkit-font-smoothing: antialiased;
105
+ -moz-osx-font-smoothing: grayscale;
106
+ }
107
+
108
+ body {
109
+ margin: 0;
110
+ min-width: 320px;
111
+ min-height: 100vh;
112
+ }
113
+ `,
114
+ },
115
+ ],
116
+ directories: [
117
+ 'client/src/components',
118
+ 'client/src/styles',
119
+ 'client/public',
120
+ ],
121
+ dependencies: {
122
+ 'solid-js': '^1.8.0',
123
+ },
124
+ devDependencies: {
125
+ tailwindcss: '^3.4.0',
126
+ postcss: '^8.4.0',
127
+ autoprefixer: '^10.4.0',
128
+ },
129
+ scripts: {
130
+ 'dev:client': 'bun run --watch client/index.html',
131
+ 'build:client': 'bun build ./client/src/main.tsx --outdir ./dist/client',
132
+ },
133
+ };
134
+ }
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Svelte Frontend Template
3
+ */
4
+
5
+ import type { FrontendTemplateResult } from '../project/types';
6
+
7
+ export function svelteTemplate(): FrontendTemplateResult {
8
+ return {
9
+ files: [
10
+ {
11
+ path: 'client/index.html',
12
+ content: `<!DOCTYPE html>
13
+ <html lang="en">
14
+ <head>
15
+ <meta charset="UTF-8">
16
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
17
+ <title>Bueno App</title>
18
+ </head>
19
+ <body>
20
+ <div id="app"></div>
21
+ <script type="module" src="./src/main.ts"></script>
22
+ </body>
23
+ </html>
24
+ `,
25
+ },
26
+ {
27
+ path: 'client/src/main.ts',
28
+ content: `import App from './App.svelte';
29
+ import './styles/globals.css';
30
+
31
+ const app = new App({
32
+ target: document.getElementById('app')!,
33
+ });
34
+
35
+ export default app;
36
+ `,
37
+ },
38
+ {
39
+ path: 'client/src/App.svelte',
40
+ content: `<script lang="ts">
41
+ let count = 0;
42
+ </script>
43
+
44
+ <main class="min-h-screen bg-gradient-to-br from-slate-900 to-slate-800 text-white">
45
+ <div class="container mx-auto px-4 py-16">
46
+ <div class="max-w-2xl mx-auto text-center">
47
+ <h1 class="text-5xl font-bold mb-4 bg-gradient-to-r from-orange-400 to-red-500 bg-clip-text text-transparent">
48
+ Welcome to Bueno
49
+ </h1>
50
+ <p class="text-xl text-slate-300 mb-8">
51
+ A Bun-native full-stack framework
52
+ </p>
53
+
54
+ <div class="bg-slate-800/50 rounded-xl p-8 backdrop-blur-sm border border-slate-700">
55
+ <button
56
+ on:click={() => count++}
57
+ class="px-6 py-3 bg-orange-500 hover:bg-orange-600 rounded-lg font-medium transition-colors"
58
+ >
59
+ Count: {count}
60
+ </button>
61
+ <p class="mt-4 text-slate-400 text-sm">
62
+ Click the button to test Svelte reactivity
63
+ </p>
64
+ </div>
65
+
66
+ <div class="mt-8 grid grid-cols-2 gap-4 text-left">
67
+ <a
68
+ href="https://bueno.github.io"
69
+ class="p-4 bg-slate-800/50 rounded-lg border border-slate-700 hover:border-orange-500 transition-colors"
70
+ >
71
+ <h3 class="font-semibold text-orange-400">Documentation</h3>
72
+ <p class="text-sm text-slate-400">Learn more about Bueno</p>
73
+ </a>
74
+ <a
75
+ href="https://github.com/buenojs/bueno"
76
+ class="p-4 bg-slate-800/50 rounded-lg border border-slate-700 hover:border-orange-500 transition-colors"
77
+ >
78
+ <h3 class="font-semibold text-orange-400">GitHub</h3>
79
+ <p class="text-sm text-slate-400">View the source code</p>
80
+ </a>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ </main>
85
+ `,
86
+ },
87
+ {
88
+ path: 'client/src/styles/globals.css',
89
+ content: `@tailwind base;
90
+ @tailwind components;
91
+ @tailwind utilities;
92
+
93
+ :root {
94
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
95
+ line-height: 1.5;
96
+ font-weight: 400;
97
+ font-synthesis: none;
98
+ text-rendering: optimizeLegibility;
99
+ -webkit-font-smoothing: antialiased;
100
+ -moz-osx-font-smoothing: grayscale;
101
+ }
102
+
103
+ body {
104
+ margin: 0;
105
+ min-width: 320px;
106
+ min-height: 100vh;
107
+ }
108
+ `,
109
+ },
110
+ ],
111
+ directories: [
112
+ 'client/src/components',
113
+ 'client/src/styles',
114
+ 'client/public',
115
+ ],
116
+ dependencies: {
117
+ svelte: '^4.2.0',
118
+ },
119
+ devDependencies: {
120
+ '@sveltejs/vite-plugin-svelte': '^3.0.0',
121
+ svelte: '^4.2.0',
122
+ tailwindcss: '^3.4.0',
123
+ postcss: '^8.4.0',
124
+ autoprefixer: '^10.4.0',
125
+ },
126
+ scripts: {
127
+ 'dev:client': 'bun run --watch client/index.html',
128
+ 'build:client': 'bun build ./client/src/main.ts --outdir ./dist/client',
129
+ },
130
+ };
131
+ }