create-rotor 0.3.0 → 0.3.2
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/dist/index.js +3 -5
- package/package.json +1 -1
- package/template/.vscode/settings.json +4 -0
- package/template/app/error.tsx +4 -4
- package/template/app/layout.tsx +10 -10
- package/template/app/not-found.tsx +1 -1
- package/template/app/page.tsx +1 -1
- package/template/biome.json +2 -1
- package/template/lib/ai.ts +4 -4
- package/template/lib/db.ts +5 -5
- package/template/lib/fetcher.ts +3 -3
- package/template/lib/schema.ts +2 -2
- package/template/lib/utils.ts +3 -3
- package/template/package.json +1 -1
- package/template/app/api/.gitkeep +0 -0
- package/template/components/ui/.gitkeep +0 -0
package/dist/index.js
CHANGED
|
@@ -1301,7 +1301,7 @@ function replaceProjectName(projectDir, projectName) {
|
|
|
1301
1301
|
writeFileSync(filePath, content.replaceAll("{{PROJECT_NAME}}", projectName));
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
|
-
function trimCssShadcn(cssPath) {
|
|
1304
|
+
function trimCssShadcn(cssPath, removeContent = true) {
|
|
1305
1305
|
if (!existsSync(cssPath))
|
|
1306
1306
|
return;
|
|
1307
1307
|
const content = readFileSync(cssPath, "utf-8");
|
|
@@ -1318,7 +1318,7 @@ function trimCssShadcn(cssPath) {
|
|
|
1318
1318
|
skipping = false;
|
|
1319
1319
|
continue;
|
|
1320
1320
|
}
|
|
1321
|
-
if (!skipping) {
|
|
1321
|
+
if (!skipping || !removeContent) {
|
|
1322
1322
|
result.push(line);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
@@ -1433,9 +1433,7 @@ async function main() {
|
|
|
1433
1433
|
removeHusky: !initGit
|
|
1434
1434
|
});
|
|
1435
1435
|
const hasEnv = trimEnvFile(join2(targetDir, ".env.example"), selectedModules);
|
|
1436
|
-
|
|
1437
|
-
trimCssShadcn(join2(targetDir, "app", "globals.css"));
|
|
1438
|
-
}
|
|
1436
|
+
trimCssShadcn(join2(targetDir, "app", "globals.css"), !selectedModules.includes("shadcn"));
|
|
1439
1437
|
if (!initGit) {
|
|
1440
1438
|
removeHuskyFiles(targetDir);
|
|
1441
1439
|
}
|
package/package.json
CHANGED
package/template/app/error.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use client'
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
3
|
export default function ErrorPage({
|
|
4
4
|
reset,
|
|
5
5
|
}: {
|
|
6
|
-
error: Error & { digest?: string }
|
|
7
|
-
reset: () => void
|
|
6
|
+
error: Error & { digest?: string }
|
|
7
|
+
reset: () => void
|
|
8
8
|
}) {
|
|
9
9
|
return (
|
|
10
10
|
<main className="flex min-h-screen flex-col items-center justify-center p-24">
|
|
@@ -17,5 +17,5 @@ export default function ErrorPage({
|
|
|
17
17
|
Try again
|
|
18
18
|
</button>
|
|
19
19
|
</main>
|
|
20
|
-
)
|
|
20
|
+
)
|
|
21
21
|
}
|
package/template/app/layout.tsx
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type { Metadata } from 'next'
|
|
2
|
-
import { Geist, Geist_Mono } from 'next/font/google'
|
|
3
|
-
import './globals.css'
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import { Geist, Geist_Mono } from 'next/font/google'
|
|
3
|
+
import './globals.css'
|
|
4
4
|
|
|
5
5
|
const geistSans = Geist({
|
|
6
6
|
variable: '--font-geist-sans',
|
|
7
7
|
subsets: ['latin'],
|
|
8
|
-
})
|
|
8
|
+
})
|
|
9
9
|
|
|
10
10
|
const geistMono = Geist_Mono({
|
|
11
11
|
variable: '--font-geist-mono',
|
|
12
12
|
subsets: ['latin'],
|
|
13
|
-
})
|
|
13
|
+
})
|
|
14
14
|
|
|
15
15
|
export const metadata: Metadata = {
|
|
16
16
|
title: '{{PROJECT_NAME}}',
|
|
17
17
|
description: '',
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export default function RootLayout({
|
|
21
21
|
children,
|
|
22
|
-
}:
|
|
23
|
-
children: React.ReactNode
|
|
24
|
-
}
|
|
22
|
+
}: {
|
|
23
|
+
children: React.ReactNode
|
|
24
|
+
}) {
|
|
25
25
|
return (
|
|
26
26
|
<html lang="en">
|
|
27
27
|
<body
|
|
@@ -30,5 +30,5 @@ export default function RootLayout({
|
|
|
30
30
|
{children}
|
|
31
31
|
</body>
|
|
32
32
|
</html>
|
|
33
|
-
)
|
|
33
|
+
)
|
|
34
34
|
}
|
package/template/app/page.tsx
CHANGED
package/template/biome.json
CHANGED
package/template/lib/ai.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { openai } from '@ai-sdk/openai'
|
|
2
|
-
import { generateText } from 'ai'
|
|
1
|
+
import { openai } from '@ai-sdk/openai'
|
|
2
|
+
import { generateText } from 'ai'
|
|
3
3
|
|
|
4
4
|
export async function generate(prompt: string) {
|
|
5
5
|
const { text } = await generateText({
|
|
6
6
|
model: openai('gpt-4o'),
|
|
7
7
|
prompt,
|
|
8
|
-
})
|
|
9
|
-
return text
|
|
8
|
+
})
|
|
9
|
+
return text
|
|
10
10
|
}
|
package/template/lib/db.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
2
|
-
import postgres from 'postgres'
|
|
1
|
+
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
2
|
+
import postgres from 'postgres'
|
|
3
3
|
|
|
4
|
-
const connectionString = process.env.DATABASE_URL ?? ''
|
|
5
|
-
const client = postgres(connectionString)
|
|
4
|
+
const connectionString = process.env.DATABASE_URL ?? ''
|
|
5
|
+
const client = postgres(connectionString)
|
|
6
6
|
|
|
7
|
-
export const db = drizzle({ client })
|
|
7
|
+
export const db = drizzle({ client })
|
package/template/lib/fetcher.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function fetcher<T>(url: string): Promise<T> {
|
|
2
|
-
const res = await fetch(url)
|
|
2
|
+
const res = await fetch(url)
|
|
3
3
|
|
|
4
4
|
if (!res.ok) {
|
|
5
|
-
throw new Error(`Fetch error: ${res.status}`)
|
|
5
|
+
throw new Error(`Fetch error: ${res.status}`)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
return res.json() as Promise<T
|
|
8
|
+
return res.json() as Promise<T>
|
|
9
9
|
}
|
package/template/lib/schema.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { integer, pgTable, text, timestamp } from 'drizzle-orm/pg-core'
|
|
1
|
+
import { integer, pgTable, text, timestamp } from 'drizzle-orm/pg-core'
|
|
2
2
|
|
|
3
3
|
export const posts = pgTable('posts', {
|
|
4
4
|
id: integer('id').primaryKey().generatedAlwaysAsIdentity(),
|
|
5
5
|
title: text('title').notNull(),
|
|
6
6
|
content: text('content'),
|
|
7
7
|
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
8
|
-
})
|
|
8
|
+
})
|
package/template/lib/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ClassValue, clsx } from 'clsx'
|
|
2
|
-
import { twMerge } from 'tailwind-merge'
|
|
1
|
+
import { type ClassValue, clsx } from 'clsx'
|
|
2
|
+
import { twMerge } from 'tailwind-merge'
|
|
3
3
|
|
|
4
4
|
export function cn(...inputs: ClassValue[]) {
|
|
5
|
-
return twMerge(clsx(inputs))
|
|
5
|
+
return twMerge(clsx(inputs))
|
|
6
6
|
}
|
package/template/package.json
CHANGED
|
File without changes
|
|
File without changes
|