kofi-stack-template-generator 2.1.27 → 2.1.36
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/.turbo/turbo-build.log +6 -6
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/index.js +1359 -13
- package/package.json +8 -8
- package/src/generator.ts +57 -0
- package/src/templates.generated.ts +108 -15
- package/templates/admin/next.config.ts.hbs +7 -0
- package/templates/admin/package.json.hbs +38 -0
- package/templates/admin/postcss.config.mjs.hbs +7 -0
- package/templates/admin/src/app/analytics/page.tsx.hbs +39 -0
- package/templates/admin/src/app/globals.css.hbs +2 -0
- package/templates/admin/src/app/layout.tsx.hbs +33 -0
- package/templates/admin/src/app/page.tsx.hbs +47 -0
- package/templates/admin/src/app/settings/page.tsx.hbs +74 -0
- package/templates/admin/src/app/users/page.tsx.hbs +16 -0
- package/templates/admin/src/components/admin-sidebar.tsx.hbs +51 -0
- package/templates/admin/src/components/stats-cards.tsx.hbs +28 -0
- package/templates/admin/src/components/user-table.tsx.hbs +65 -0
- package/templates/admin/tsconfig.json.hbs +15 -0
- package/templates/design-system/next.config.ts.hbs +7 -0
- package/templates/design-system/package.json.hbs +35 -0
- package/templates/design-system/postcss.config.mjs.hbs +7 -0
- package/templates/design-system/src/app/blocks/page.tsx.hbs +140 -0
- package/templates/design-system/src/app/colors/page.tsx.hbs +34 -0
- package/templates/design-system/src/app/components/page.tsx.hbs +110 -0
- package/templates/design-system/src/app/globals.css.hbs +2 -0
- package/templates/design-system/src/app/layout.tsx.hbs +46 -0
- package/templates/design-system/src/app/page.tsx.hbs +65 -0
- package/templates/design-system/src/app/typography/page.tsx.hbs +112 -0
- package/templates/design-system/src/components/color-palette.tsx.hbs +117 -0
- package/templates/design-system/tsconfig.json.hbs +13 -0
- package/templates/marketing/nextjs/package.json.hbs +1 -1
- package/templates/marketing/payload/package.json.hbs +1 -1
- package/templates/marketing/payload/src/Footer/config.ts.hbs +178 -0
- package/templates/marketing/payload/src/Footer/hooks/revalidateFooter.ts.hbs +13 -0
- package/templates/marketing/payload/src/Footer/index.ts.hbs +1 -0
- package/templates/marketing/payload/src/Header/RowLabel.tsx.hbs +21 -0
- package/templates/marketing/payload/src/Header/config.ts.hbs +208 -0
- package/templates/marketing/payload/src/Header/hooks/revalidateHeader.ts.hbs +13 -0
- package/templates/marketing/payload/src/Header/index.ts.hbs +1 -0
- package/templates/marketing/payload/src/access/anyone.ts.hbs +3 -0
- package/templates/marketing/payload/src/access/authenticated.ts.hbs +9 -0
- package/templates/marketing/payload/src/access/authenticatedOrPublished.ts.hbs +13 -0
- package/templates/marketing/payload/src/access/index.ts.hbs +3 -0
- package/templates/marketing/payload/src/app/(frontend)/next/seed/route.ts.hbs +31 -0
- package/templates/marketing/payload/src/collections/Categories/index.ts.hbs +28 -0
- package/templates/marketing/payload/src/collections/FAQs/index.ts.hbs +100 -0
- package/templates/marketing/payload/src/collections/Media.ts.hbs +148 -28
- package/templates/marketing/payload/src/collections/Pages/hooks/revalidatePage.ts.hbs +43 -0
- package/templates/marketing/payload/src/collections/Pages/index.ts.hbs +142 -0
- package/templates/marketing/payload/src/collections/Posts/hooks/populateAuthors.ts.hbs +41 -0
- package/templates/marketing/payload/src/collections/Posts/hooks/revalidatePost.ts.hbs +44 -0
- package/templates/marketing/payload/src/collections/Posts/index.ts.hbs +244 -0
- package/templates/marketing/payload/src/collections/Users/index.ts.hbs +26 -0
- package/templates/marketing/payload/src/collections/index.ts.hbs +6 -4
- package/templates/marketing/payload/src/components/BeforeDashboard/SeedButton/index.scss.hbs +12 -0
- package/templates/marketing/payload/src/components/BeforeDashboard/SeedButton/index.tsx.hbs +89 -0
- package/templates/marketing/payload/src/components/BeforeDashboard/index.scss.hbs +24 -0
- package/templates/marketing/payload/src/components/BeforeDashboard/index.tsx.hbs +69 -0
- package/templates/marketing/payload/src/components/BeforeLogin/index.tsx.hbs +14 -0
- package/templates/marketing/payload/src/components/Link/index.tsx.hbs +79 -0
- package/templates/marketing/payload/src/components/Media/index.tsx.hbs +67 -0
- package/templates/marketing/payload/src/components/RichText/index.tsx.hbs +44 -0
- package/templates/marketing/payload/src/endpoints/seed/home.ts.hbs +76 -0
- package/templates/marketing/payload/src/endpoints/seed/image-1.ts.hbs +5 -0
- package/templates/marketing/payload/src/endpoints/seed/image-2.ts.hbs +5 -0
- package/templates/marketing/payload/src/endpoints/seed/image-hero.ts.hbs +5 -0
- package/templates/marketing/payload/src/endpoints/seed/index.ts.hbs +235 -0
- package/templates/marketing/payload/src/endpoints/seed/post-1.ts.hbs +252 -0
- package/templates/marketing/payload/src/fields/defaultLexical.ts.hbs +73 -0
- package/templates/marketing/payload/src/fields/index.ts.hbs +3 -0
- package/templates/marketing/payload/src/fields/link.ts.hbs +139 -0
- package/templates/marketing/payload/src/fields/linkGroup.ts.hbs +28 -0
- package/templates/marketing/payload/src/globals/index.ts.hbs +2 -2
- package/templates/marketing/payload/src/heros/HighImpact/index.tsx.hbs +53 -0
- package/templates/marketing/payload/src/heros/LowImpact/index.tsx.hbs +48 -0
- package/templates/marketing/payload/src/heros/MediumImpact/index.tsx.hbs +46 -0
- package/templates/marketing/payload/src/heros/PostHero/index.tsx.hbs +68 -0
- package/templates/marketing/payload/src/heros/ProductShowcase/index.tsx.hbs +88 -0
- package/templates/marketing/payload/src/heros/RenderHero.tsx.hbs +27 -0
- package/templates/marketing/payload/src/heros/config.ts.hbs +112 -0
- package/templates/marketing/payload/src/heros/index.ts.hbs +7 -0
- package/templates/marketing/payload/src/hooks/index.ts.hbs +2 -0
- package/templates/marketing/payload/src/hooks/populatePublishedAt.ts.hbs +15 -0
- package/templates/marketing/payload/src/hooks/revalidateRedirects.ts.hbs +11 -0
- package/templates/marketing/payload/src/payload.config.ts.hbs +32 -8
- package/templates/marketing/payload/src/providers/HeaderTheme/index.tsx.hbs +34 -0
- package/templates/marketing/payload/src/providers/Theme/InitTheme/index.tsx.hbs +44 -0
- package/templates/marketing/payload/src/providers/Theme/index.tsx.hbs +60 -0
- package/templates/marketing/payload/src/providers/Theme/shared.ts.hbs +17 -0
- package/templates/marketing/payload/src/providers/Theme/types.ts.hbs +10 -0
- package/templates/marketing/payload/src/providers/index.tsx.hbs +18 -0
- package/templates/marketing/payload/src/utilities/canUseDOM.ts.hbs +1 -0
- package/templates/marketing/payload/src/utilities/deepMerge.ts.hbs +35 -0
- package/templates/marketing/payload/src/utilities/formatAuthors.ts.hbs +24 -0
- package/templates/marketing/payload/src/utilities/formatDateTime.ts.hbs +13 -0
- package/templates/marketing/payload/src/utilities/generateMeta.ts.hbs +87 -0
- package/templates/marketing/payload/src/utilities/generatePreviewPath.ts.hbs +33 -0
- package/templates/marketing/payload/src/utilities/getURL.ts.hbs +26 -0
- package/templates/marketing/payload/src/utilities/index.ts.hbs +8 -0
- package/templates/marketing/payload/src/utilities/mergeOpenGraph.ts.hbs +26 -0
- package/templates/mobile/app.json.hbs +39 -0
- package/templates/mobile/babel.config.js.hbs +6 -0
- package/templates/mobile/package.json.hbs +30 -0
- package/templates/mobile/src/app/(tabs)/_layout.tsx.hbs +27 -0
- package/templates/mobile/src/app/(tabs)/index.tsx.hbs +28 -0
- package/templates/mobile/src/app/(tabs)/profile.tsx.hbs +44 -0
- package/templates/mobile/src/app/_layout.tsx.hbs +13 -0
- package/templates/mobile/src/app/index.tsx.hbs +5 -0
- package/templates/mobile/tsconfig.json.hbs +10 -0
- package/templates/monorepo/package.json.hbs +4 -1
- package/templates/web/package.json.hbs +1 -1
- package/templates/marketing/payload/src/collections/Pages.ts.hbs +0 -66
- package/templates/marketing/payload/src/collections/Posts.ts.hbs +0 -65
- package/templates/marketing/payload/src/collections/Users.ts.hbs +0 -25
- package/templates/marketing/payload/src/globals/Navigation.ts.hbs +0 -51
- package/templates/marketing/payload/src/globals/SiteSettings.ts.hbs +0 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kofi-stack-template-generator",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.36",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "pnpm run prebuild && tsup src/index.ts --format esm --dts",
|
|
15
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
16
|
+
"prebuild": "node scripts/generate-templates.js",
|
|
17
|
+
"typecheck": "tsc --noEmit"
|
|
18
|
+
},
|
|
13
19
|
"dependencies": {
|
|
14
20
|
"kofi-stack-types": "^2.2.0",
|
|
15
21
|
"handlebars": "^4.7.8",
|
|
@@ -19,11 +25,5 @@
|
|
|
19
25
|
"@types/node": "^20.0.0",
|
|
20
26
|
"tsup": "^8.0.0",
|
|
21
27
|
"typescript": "^5.0.0"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "pnpm run prebuild && tsup src/index.ts --format esm --dts",
|
|
25
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
26
|
-
"prebuild": "node scripts/generate-templates.js",
|
|
27
|
-
"typecheck": "tsc --noEmit"
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
package/src/generator.ts
CHANGED
|
@@ -37,6 +37,17 @@ export async function generateVirtualProject(
|
|
|
37
37
|
} else if (config.marketingSite === 'nextjs') {
|
|
38
38
|
await processMarketingTemplates(vfs, config)
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
// Optional apps (monorepo only)
|
|
42
|
+
if (config.optionalApps?.includes('design-system')) {
|
|
43
|
+
await processDesignSystemTemplates(vfs, config)
|
|
44
|
+
}
|
|
45
|
+
if (config.optionalApps?.includes('mobile')) {
|
|
46
|
+
await processMobileTemplates(vfs, config)
|
|
47
|
+
}
|
|
48
|
+
if (config.optionalApps?.includes('admin')) {
|
|
49
|
+
await processAdminTemplates(vfs, config)
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
await processIntegrationTemplates(vfs, config)
|
|
@@ -154,6 +165,27 @@ async function processMarketingTemplates(
|
|
|
154
165
|
processTemplatesFromPrefix(vfs, 'marketing/nextjs/', '/apps/marketing', config)
|
|
155
166
|
}
|
|
156
167
|
|
|
168
|
+
async function processDesignSystemTemplates(
|
|
169
|
+
vfs: VirtualFileSystem,
|
|
170
|
+
config: ProjectConfig
|
|
171
|
+
): Promise<void> {
|
|
172
|
+
processTemplatesFromPrefix(vfs, 'design-system/', '/apps/design-system', config)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async function processMobileTemplates(
|
|
176
|
+
vfs: VirtualFileSystem,
|
|
177
|
+
config: ProjectConfig
|
|
178
|
+
): Promise<void> {
|
|
179
|
+
processTemplatesFromPrefix(vfs, 'mobile/', '/apps/mobile', config)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function processAdminTemplates(
|
|
183
|
+
vfs: VirtualFileSystem,
|
|
184
|
+
config: ProjectConfig
|
|
185
|
+
): Promise<void> {
|
|
186
|
+
processTemplatesFromPrefix(vfs, 'admin/', '/apps/admin', config)
|
|
187
|
+
}
|
|
188
|
+
|
|
157
189
|
async function processIntegrationTemplates(
|
|
158
190
|
vfs: VirtualFileSystem,
|
|
159
191
|
config: ProjectConfig
|
|
@@ -210,6 +242,11 @@ function generateDevScript(
|
|
|
210
242
|
const webAppDir = isMonorepo ? 'apps/web' : '.'
|
|
211
243
|
const backendDir = isMonorepo ? 'packages/backend' : '.'
|
|
212
244
|
|
|
245
|
+
// Build dynamic ports array based on config
|
|
246
|
+
const ports = [3000, 3001] // marketing, web
|
|
247
|
+
if (config.optionalApps?.includes('design-system')) ports.push(3002)
|
|
248
|
+
if (config.optionalApps?.includes('admin')) ports.push(3003)
|
|
249
|
+
|
|
213
250
|
const devScript = `#!/usr/bin/env node
|
|
214
251
|
/**
|
|
215
252
|
* Dev Script - Starts Next.js and Convex dev servers
|
|
@@ -225,6 +262,26 @@ const rootDir = resolve(__dirname, '..')
|
|
|
225
262
|
const webAppDir = resolve(rootDir, '${webAppDir}')
|
|
226
263
|
const backendDir = resolve(rootDir, '${backendDir}')
|
|
227
264
|
|
|
265
|
+
// Kill process on a given port
|
|
266
|
+
function killPort(port) {
|
|
267
|
+
try {
|
|
268
|
+
const platform = process.platform
|
|
269
|
+
if (platform === 'darwin' || platform === 'linux') {
|
|
270
|
+
execSync(\`lsof -ti:\${port} | xargs kill -9 2>/dev/null || true\`, { stdio: 'ignore' })
|
|
271
|
+
} else if (platform === 'win32') {
|
|
272
|
+
execSync(\`for /f "tokens=5" %a in ('netstat -ano ^| findstr :\${port} ^| findstr LISTENING') do taskkill /F /PID %a 2>nul\`, { stdio: 'ignore', shell: 'cmd' })
|
|
273
|
+
}
|
|
274
|
+
} catch (e) {
|
|
275
|
+
// Port not in use or already free
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Free up app ports before starting
|
|
280
|
+
const APP_PORTS = [${ports.join(', ')}]
|
|
281
|
+
console.log('Freeing ports...')
|
|
282
|
+
APP_PORTS.forEach(killPort)
|
|
283
|
+
console.log('')
|
|
284
|
+
|
|
228
285
|
function loadEnvFile(dir) {
|
|
229
286
|
const envPath = resolve(dir, '.env.local')
|
|
230
287
|
if (!existsSync(envPath)) return {}
|