create-kofi-stack 1.2.4 → 1.2.6
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 +151 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1720,7 +1720,7 @@ async function generateGlobalsCss(config, appDir) {
|
|
|
1720
1720
|
}
|
|
1721
1721
|
|
|
1722
1722
|
/* Dark mode */
|
|
1723
|
-
|
|
1723
|
+
.dark {
|
|
1724
1724
|
--color-background: ${darkBase.background};
|
|
1725
1725
|
--color-foreground: ${darkBase.foreground};
|
|
1726
1726
|
--color-card: ${darkBase.card};
|
|
@@ -3279,6 +3279,7 @@ async function generatePayloadPackageJson(marketingDir) {
|
|
|
3279
3279
|
}
|
|
3280
3280
|
async function generatePayloadConfig(config, marketingDir) {
|
|
3281
3281
|
const content = `import path from 'path'
|
|
3282
|
+
import { fileURLToPath } from 'url'
|
|
3282
3283
|
import { buildConfig } from 'payload'
|
|
3283
3284
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
3284
3285
|
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
|
@@ -3292,11 +3293,14 @@ import { Posts } from './collections/Posts'
|
|
|
3292
3293
|
import { SiteSettings } from './globals/SiteSettings'
|
|
3293
3294
|
import { Navigation } from './globals/Navigation'
|
|
3294
3295
|
|
|
3296
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
3297
|
+
const __dirname = path.dirname(__filename)
|
|
3298
|
+
|
|
3295
3299
|
export default buildConfig({
|
|
3296
3300
|
admin: {
|
|
3297
3301
|
user: Users.slug,
|
|
3298
3302
|
importMap: {
|
|
3299
|
-
baseDir: path.resolve(
|
|
3303
|
+
baseDir: path.resolve(__dirname),
|
|
3300
3304
|
},
|
|
3301
3305
|
},
|
|
3302
3306
|
db: postgresAdapter({
|
|
@@ -3332,7 +3336,7 @@ export default buildConfig({
|
|
|
3332
3336
|
],
|
|
3333
3337
|
secret: process.env.PAYLOAD_SECRET!,
|
|
3334
3338
|
typescript: {
|
|
3335
|
-
outputFile: path.resolve(
|
|
3339
|
+
outputFile: path.resolve(__dirname, 'payload-types.ts'),
|
|
3336
3340
|
},
|
|
3337
3341
|
})
|
|
3338
3342
|
`;
|
|
@@ -4220,18 +4224,12 @@ async function generateFumadocsTsConfig(docsDir) {
|
|
|
4220
4224
|
await writeJSON(path16.join(docsDir, "tsconfig.json"), tsConfig);
|
|
4221
4225
|
}
|
|
4222
4226
|
async function generateFumadocsSource(docsDir) {
|
|
4223
|
-
const content = `import { docs
|
|
4227
|
+
const content = `import { docs } from 'fumadocs-mdx:collections/server'
|
|
4224
4228
|
import { loader } from 'fumadocs-core/source'
|
|
4225
4229
|
|
|
4226
4230
|
export const source = loader({
|
|
4227
4231
|
baseUrl: '/docs',
|
|
4228
|
-
source:
|
|
4229
|
-
files: docs.map((doc) => ({
|
|
4230
|
-
type: 'page',
|
|
4231
|
-
path: doc.slugs.join('/'),
|
|
4232
|
-
data: doc,
|
|
4233
|
-
})),
|
|
4234
|
-
},
|
|
4232
|
+
source: docs.toFumadocsSource(),
|
|
4235
4233
|
})
|
|
4236
4234
|
`;
|
|
4237
4235
|
await writeFile(path16.join(docsDir, "src/lib/source.ts"), content);
|
|
@@ -4352,12 +4350,10 @@ export default function HomePage() {
|
|
|
4352
4350
|
@source '../node_modules/fumadocs-ui/dist/**/*.js';
|
|
4353
4351
|
`;
|
|
4354
4352
|
await writeFile(path16.join(docsDir, "src/app/global.css"), globalCssContent);
|
|
4355
|
-
const sourceConfigContent = `import {
|
|
4353
|
+
const sourceConfigContent = `import { defineDocs, defineConfig } from 'fumadocs-mdx/config'
|
|
4356
4354
|
|
|
4357
|
-
export const
|
|
4358
|
-
|
|
4359
|
-
dir: 'content/docs',
|
|
4360
|
-
},
|
|
4355
|
+
export const docs = defineDocs({
|
|
4356
|
+
dir: 'content/docs',
|
|
4361
4357
|
})
|
|
4362
4358
|
|
|
4363
4359
|
export default defineConfig()
|
|
@@ -4590,10 +4586,10 @@ Update the theme colors in the CSS:
|
|
|
4590
4586
|
|
|
4591
4587
|
### Dark Mode
|
|
4592
4588
|
|
|
4593
|
-
Dark mode is supported out of the box.
|
|
4589
|
+
Dark mode is supported out of the box. Define dark mode styles with:
|
|
4594
4590
|
|
|
4595
4591
|
\`\`\`css
|
|
4596
|
-
|
|
4592
|
+
.dark {
|
|
4597
4593
|
--color-background: oklch(0.145 0 0);
|
|
4598
4594
|
}
|
|
4599
4595
|
\`\`\`
|
|
@@ -4715,6 +4711,7 @@ async function generateDesignSystemApp(config, targetDir) {
|
|
|
4715
4711
|
await ensureDir(path17.join(appDir, "src/app/brand"));
|
|
4716
4712
|
await ensureDir(path17.join(appDir, "src/app/blocks"));
|
|
4717
4713
|
await ensureDir(path17.join(appDir, "src/app/components"));
|
|
4714
|
+
await ensureDir(path17.join(appDir, "src/app/components/[slug]"));
|
|
4718
4715
|
await ensureDir(path17.join(appDir, "src/lib"));
|
|
4719
4716
|
await ensureDir(path17.join(appDir, "public/brand"));
|
|
4720
4717
|
await generatePackageJson2(config, appDir);
|
|
@@ -4730,6 +4727,7 @@ async function generateDesignSystemApp(config, targetDir) {
|
|
|
4730
4727
|
await generateBrandPage(config, appDir);
|
|
4731
4728
|
await generateBlocksPage(appDir);
|
|
4732
4729
|
await generateComponentsPage(appDir);
|
|
4730
|
+
await generateComponentSlugPage(appDir);
|
|
4733
4731
|
await generateUtils(appDir);
|
|
4734
4732
|
}
|
|
4735
4733
|
async function generatePackageJson2(config, appDir) {
|
|
@@ -6170,6 +6168,110 @@ function CategoryCard({
|
|
|
6170
6168
|
`;
|
|
6171
6169
|
await writeFile(path17.join(appDir, "src/app/components/page.tsx"), content);
|
|
6172
6170
|
}
|
|
6171
|
+
async function generateComponentSlugPage(appDir) {
|
|
6172
|
+
const content = `import { notFound } from 'next/navigation'
|
|
6173
|
+
|
|
6174
|
+
const components = [
|
|
6175
|
+
'accordion', 'alert', 'alert-dialog', 'aspect-ratio', 'avatar', 'badge',
|
|
6176
|
+
'breadcrumb', 'button', 'calendar', 'card', 'carousel', 'chart', 'checkbox',
|
|
6177
|
+
'collapsible', 'command', 'context-menu', 'dialog', 'drawer', 'dropdown-menu',
|
|
6178
|
+
'form', 'hover-card', 'input', 'input-otp', 'label', 'menubar', 'navigation-menu',
|
|
6179
|
+
'pagination', 'popover', 'progress', 'radio-group', 'resizable', 'scroll-area',
|
|
6180
|
+
'select', 'separator', 'sheet', 'sidebar', 'skeleton', 'slider', 'sonner',
|
|
6181
|
+
'switch', 'table', 'tabs', 'textarea', 'toast', 'toggle', 'toggle-group', 'tooltip',
|
|
6182
|
+
]
|
|
6183
|
+
|
|
6184
|
+
function slugToTitle(slug: string): string {
|
|
6185
|
+
return slug
|
|
6186
|
+
.split('-')
|
|
6187
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
6188
|
+
.join(' ')
|
|
6189
|
+
}
|
|
6190
|
+
|
|
6191
|
+
export default async function ComponentPage({
|
|
6192
|
+
params,
|
|
6193
|
+
}: {
|
|
6194
|
+
params: Promise<{ slug: string }>
|
|
6195
|
+
}) {
|
|
6196
|
+
const { slug } = await params
|
|
6197
|
+
|
|
6198
|
+
if (!components.includes(slug)) {
|
|
6199
|
+
notFound()
|
|
6200
|
+
}
|
|
6201
|
+
|
|
6202
|
+
const title = slugToTitle(slug)
|
|
6203
|
+
|
|
6204
|
+
return (
|
|
6205
|
+
<div className="p-8 max-w-5xl">
|
|
6206
|
+
<header className="mb-12">
|
|
6207
|
+
<h1 className="text-display-01 text-foreground mb-4">{title}</h1>
|
|
6208
|
+
<p className="text-body-lg text-muted-foreground max-w-2xl">
|
|
6209
|
+
Documentation and examples for the {title} component.
|
|
6210
|
+
</p>
|
|
6211
|
+
</header>
|
|
6212
|
+
|
|
6213
|
+
<section className="mb-12">
|
|
6214
|
+
<h2 className="text-h2 text-foreground mb-6">Installation</h2>
|
|
6215
|
+
<div className="bg-muted rounded-lg p-4 overflow-x-auto">
|
|
6216
|
+
<pre className="text-sm text-foreground">
|
|
6217
|
+
{\`npx shadcn@latest add \${slug}\`}
|
|
6218
|
+
</pre>
|
|
6219
|
+
</div>
|
|
6220
|
+
</section>
|
|
6221
|
+
|
|
6222
|
+
<section className="mb-12">
|
|
6223
|
+
<h2 className="text-h2 text-foreground mb-6">Usage</h2>
|
|
6224
|
+
<div className="bg-muted rounded-lg p-4 overflow-x-auto">
|
|
6225
|
+
<pre className="text-sm text-foreground">
|
|
6226
|
+
{\`import { \${title.replace(/\\s+/g, '')} } from '@repo/ui/\${slug}'
|
|
6227
|
+
|
|
6228
|
+
export default function Example() {
|
|
6229
|
+
return <\${title.replace(/\\s+/g, '')} />
|
|
6230
|
+
}\`}
|
|
6231
|
+
</pre>
|
|
6232
|
+
</div>
|
|
6233
|
+
</section>
|
|
6234
|
+
|
|
6235
|
+
<section className="mb-12">
|
|
6236
|
+
<h2 className="text-h2 text-foreground mb-6">Preview</h2>
|
|
6237
|
+
<div className="rounded-xl border border-border p-8 bg-card">
|
|
6238
|
+
<p className="text-muted-foreground text-center">
|
|
6239
|
+
Component preview coming soon. Add your own examples here.
|
|
6240
|
+
</p>
|
|
6241
|
+
</div>
|
|
6242
|
+
</section>
|
|
6243
|
+
|
|
6244
|
+
<section>
|
|
6245
|
+
<h2 className="text-h2 text-foreground mb-6">API Reference</h2>
|
|
6246
|
+
<div className="rounded-lg border border-border overflow-hidden">
|
|
6247
|
+
<table className="w-full text-sm">
|
|
6248
|
+
<thead className="bg-muted">
|
|
6249
|
+
<tr>
|
|
6250
|
+
<th className="text-left p-3 font-medium text-foreground">Prop</th>
|
|
6251
|
+
<th className="text-left p-3 font-medium text-foreground">Type</th>
|
|
6252
|
+
<th className="text-left p-3 font-medium text-foreground">Default</th>
|
|
6253
|
+
</tr>
|
|
6254
|
+
</thead>
|
|
6255
|
+
<tbody>
|
|
6256
|
+
<tr className="border-t border-border">
|
|
6257
|
+
<td className="p-3 text-muted-foreground" colSpan={3}>
|
|
6258
|
+
See shadcn/ui documentation for full API reference.
|
|
6259
|
+
</td>
|
|
6260
|
+
</tr>
|
|
6261
|
+
</tbody>
|
|
6262
|
+
</table>
|
|
6263
|
+
</div>
|
|
6264
|
+
</section>
|
|
6265
|
+
</div>
|
|
6266
|
+
)
|
|
6267
|
+
}
|
|
6268
|
+
|
|
6269
|
+
export function generateStaticParams() {
|
|
6270
|
+
return components.map((slug) => ({ slug }))
|
|
6271
|
+
}
|
|
6272
|
+
`;
|
|
6273
|
+
await writeFile(path17.join(appDir, "src/app/components/[slug]/page.tsx"), content);
|
|
6274
|
+
}
|
|
6173
6275
|
async function generateUtils(appDir) {
|
|
6174
6276
|
const content = `import { clsx, type ClassValue } from 'clsx'
|
|
6175
6277
|
import { twMerge } from 'tailwind-merge'
|
|
@@ -6261,15 +6363,40 @@ async function setupConvex(config, envValues) {
|
|
|
6261
6363
|
}
|
|
6262
6364
|
if (convexChoice === "new") {
|
|
6263
6365
|
p6.log.info(`
|
|
6264
|
-
${pc2.bold("
|
|
6265
|
-
|
|
6266
|
-
1. Run ${pc2.cyan("pnpm convex dev")} in your project directory
|
|
6267
|
-
2. It will open your browser to create a new project
|
|
6268
|
-
3. Follow the prompts to set up your Convex project
|
|
6269
|
-
4. The CLI will automatically add the deployment URL to .env.local
|
|
6366
|
+
${pc2.bold("Creating a new Convex project...")}
|
|
6270
6367
|
|
|
6368
|
+
This will open your browser to create a new project on Convex.
|
|
6271
6369
|
${pc2.dim("Note: Make sure you have a Convex account at https://convex.dev")}
|
|
6272
6370
|
`);
|
|
6371
|
+
try {
|
|
6372
|
+
const convexDir = config.structure === "monorepo" ? path18.join(config.targetDir, "packages/backend") : config.targetDir;
|
|
6373
|
+
p6.log.info(`Running ${pc2.cyan("npx convex dev --once")} in ${pc2.dim(convexDir)}...`);
|
|
6374
|
+
const { spawn } = await import("child_process");
|
|
6375
|
+
await new Promise((resolve) => {
|
|
6376
|
+
const child = spawn("npx", ["convex", "dev", "--once"], {
|
|
6377
|
+
cwd: convexDir,
|
|
6378
|
+
stdio: "inherit",
|
|
6379
|
+
shell: true
|
|
6380
|
+
});
|
|
6381
|
+
child.on("close", (code) => {
|
|
6382
|
+
if (code === 0) {
|
|
6383
|
+
p6.log.success("Convex project created successfully!");
|
|
6384
|
+
resolve();
|
|
6385
|
+
} else {
|
|
6386
|
+
p6.log.warn(`Convex setup exited with code ${code}. You can run 'pnpm convex dev' manually later.`);
|
|
6387
|
+
resolve();
|
|
6388
|
+
}
|
|
6389
|
+
});
|
|
6390
|
+
child.on("error", (error) => {
|
|
6391
|
+
p6.log.warn(`Could not run Convex setup: ${error.message}`);
|
|
6392
|
+
p6.log.info(`Run ${pc2.cyan("pnpm convex dev")} manually in your project directory.`);
|
|
6393
|
+
resolve();
|
|
6394
|
+
});
|
|
6395
|
+
});
|
|
6396
|
+
} catch (error) {
|
|
6397
|
+
p6.log.warn("Could not run Convex setup automatically.");
|
|
6398
|
+
p6.log.info(`Run ${pc2.cyan("pnpm convex dev")} manually in your project directory.`);
|
|
6399
|
+
}
|
|
6273
6400
|
} else if (convexChoice === "existing") {
|
|
6274
6401
|
const deploymentName = await p6.text({
|
|
6275
6402
|
message: "Enter your Convex deployment name (e.g., my-app-123):",
|