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.
Files changed (117) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/.turbo/turbo-typecheck.log +1 -1
  3. package/dist/index.js +1359 -13
  4. package/package.json +8 -8
  5. package/src/generator.ts +57 -0
  6. package/src/templates.generated.ts +108 -15
  7. package/templates/admin/next.config.ts.hbs +7 -0
  8. package/templates/admin/package.json.hbs +38 -0
  9. package/templates/admin/postcss.config.mjs.hbs +7 -0
  10. package/templates/admin/src/app/analytics/page.tsx.hbs +39 -0
  11. package/templates/admin/src/app/globals.css.hbs +2 -0
  12. package/templates/admin/src/app/layout.tsx.hbs +33 -0
  13. package/templates/admin/src/app/page.tsx.hbs +47 -0
  14. package/templates/admin/src/app/settings/page.tsx.hbs +74 -0
  15. package/templates/admin/src/app/users/page.tsx.hbs +16 -0
  16. package/templates/admin/src/components/admin-sidebar.tsx.hbs +51 -0
  17. package/templates/admin/src/components/stats-cards.tsx.hbs +28 -0
  18. package/templates/admin/src/components/user-table.tsx.hbs +65 -0
  19. package/templates/admin/tsconfig.json.hbs +15 -0
  20. package/templates/design-system/next.config.ts.hbs +7 -0
  21. package/templates/design-system/package.json.hbs +35 -0
  22. package/templates/design-system/postcss.config.mjs.hbs +7 -0
  23. package/templates/design-system/src/app/blocks/page.tsx.hbs +140 -0
  24. package/templates/design-system/src/app/colors/page.tsx.hbs +34 -0
  25. package/templates/design-system/src/app/components/page.tsx.hbs +110 -0
  26. package/templates/design-system/src/app/globals.css.hbs +2 -0
  27. package/templates/design-system/src/app/layout.tsx.hbs +46 -0
  28. package/templates/design-system/src/app/page.tsx.hbs +65 -0
  29. package/templates/design-system/src/app/typography/page.tsx.hbs +112 -0
  30. package/templates/design-system/src/components/color-palette.tsx.hbs +117 -0
  31. package/templates/design-system/tsconfig.json.hbs +13 -0
  32. package/templates/marketing/nextjs/package.json.hbs +1 -1
  33. package/templates/marketing/payload/package.json.hbs +1 -1
  34. package/templates/marketing/payload/src/Footer/config.ts.hbs +178 -0
  35. package/templates/marketing/payload/src/Footer/hooks/revalidateFooter.ts.hbs +13 -0
  36. package/templates/marketing/payload/src/Footer/index.ts.hbs +1 -0
  37. package/templates/marketing/payload/src/Header/RowLabel.tsx.hbs +21 -0
  38. package/templates/marketing/payload/src/Header/config.ts.hbs +208 -0
  39. package/templates/marketing/payload/src/Header/hooks/revalidateHeader.ts.hbs +13 -0
  40. package/templates/marketing/payload/src/Header/index.ts.hbs +1 -0
  41. package/templates/marketing/payload/src/access/anyone.ts.hbs +3 -0
  42. package/templates/marketing/payload/src/access/authenticated.ts.hbs +9 -0
  43. package/templates/marketing/payload/src/access/authenticatedOrPublished.ts.hbs +13 -0
  44. package/templates/marketing/payload/src/access/index.ts.hbs +3 -0
  45. package/templates/marketing/payload/src/app/(frontend)/next/seed/route.ts.hbs +31 -0
  46. package/templates/marketing/payload/src/collections/Categories/index.ts.hbs +28 -0
  47. package/templates/marketing/payload/src/collections/FAQs/index.ts.hbs +100 -0
  48. package/templates/marketing/payload/src/collections/Media.ts.hbs +148 -28
  49. package/templates/marketing/payload/src/collections/Pages/hooks/revalidatePage.ts.hbs +43 -0
  50. package/templates/marketing/payload/src/collections/Pages/index.ts.hbs +142 -0
  51. package/templates/marketing/payload/src/collections/Posts/hooks/populateAuthors.ts.hbs +41 -0
  52. package/templates/marketing/payload/src/collections/Posts/hooks/revalidatePost.ts.hbs +44 -0
  53. package/templates/marketing/payload/src/collections/Posts/index.ts.hbs +244 -0
  54. package/templates/marketing/payload/src/collections/Users/index.ts.hbs +26 -0
  55. package/templates/marketing/payload/src/collections/index.ts.hbs +6 -4
  56. package/templates/marketing/payload/src/components/BeforeDashboard/SeedButton/index.scss.hbs +12 -0
  57. package/templates/marketing/payload/src/components/BeforeDashboard/SeedButton/index.tsx.hbs +89 -0
  58. package/templates/marketing/payload/src/components/BeforeDashboard/index.scss.hbs +24 -0
  59. package/templates/marketing/payload/src/components/BeforeDashboard/index.tsx.hbs +69 -0
  60. package/templates/marketing/payload/src/components/BeforeLogin/index.tsx.hbs +14 -0
  61. package/templates/marketing/payload/src/components/Link/index.tsx.hbs +79 -0
  62. package/templates/marketing/payload/src/components/Media/index.tsx.hbs +67 -0
  63. package/templates/marketing/payload/src/components/RichText/index.tsx.hbs +44 -0
  64. package/templates/marketing/payload/src/endpoints/seed/home.ts.hbs +76 -0
  65. package/templates/marketing/payload/src/endpoints/seed/image-1.ts.hbs +5 -0
  66. package/templates/marketing/payload/src/endpoints/seed/image-2.ts.hbs +5 -0
  67. package/templates/marketing/payload/src/endpoints/seed/image-hero.ts.hbs +5 -0
  68. package/templates/marketing/payload/src/endpoints/seed/index.ts.hbs +235 -0
  69. package/templates/marketing/payload/src/endpoints/seed/post-1.ts.hbs +252 -0
  70. package/templates/marketing/payload/src/fields/defaultLexical.ts.hbs +73 -0
  71. package/templates/marketing/payload/src/fields/index.ts.hbs +3 -0
  72. package/templates/marketing/payload/src/fields/link.ts.hbs +139 -0
  73. package/templates/marketing/payload/src/fields/linkGroup.ts.hbs +28 -0
  74. package/templates/marketing/payload/src/globals/index.ts.hbs +2 -2
  75. package/templates/marketing/payload/src/heros/HighImpact/index.tsx.hbs +53 -0
  76. package/templates/marketing/payload/src/heros/LowImpact/index.tsx.hbs +48 -0
  77. package/templates/marketing/payload/src/heros/MediumImpact/index.tsx.hbs +46 -0
  78. package/templates/marketing/payload/src/heros/PostHero/index.tsx.hbs +68 -0
  79. package/templates/marketing/payload/src/heros/ProductShowcase/index.tsx.hbs +88 -0
  80. package/templates/marketing/payload/src/heros/RenderHero.tsx.hbs +27 -0
  81. package/templates/marketing/payload/src/heros/config.ts.hbs +112 -0
  82. package/templates/marketing/payload/src/heros/index.ts.hbs +7 -0
  83. package/templates/marketing/payload/src/hooks/index.ts.hbs +2 -0
  84. package/templates/marketing/payload/src/hooks/populatePublishedAt.ts.hbs +15 -0
  85. package/templates/marketing/payload/src/hooks/revalidateRedirects.ts.hbs +11 -0
  86. package/templates/marketing/payload/src/payload.config.ts.hbs +32 -8
  87. package/templates/marketing/payload/src/providers/HeaderTheme/index.tsx.hbs +34 -0
  88. package/templates/marketing/payload/src/providers/Theme/InitTheme/index.tsx.hbs +44 -0
  89. package/templates/marketing/payload/src/providers/Theme/index.tsx.hbs +60 -0
  90. package/templates/marketing/payload/src/providers/Theme/shared.ts.hbs +17 -0
  91. package/templates/marketing/payload/src/providers/Theme/types.ts.hbs +10 -0
  92. package/templates/marketing/payload/src/providers/index.tsx.hbs +18 -0
  93. package/templates/marketing/payload/src/utilities/canUseDOM.ts.hbs +1 -0
  94. package/templates/marketing/payload/src/utilities/deepMerge.ts.hbs +35 -0
  95. package/templates/marketing/payload/src/utilities/formatAuthors.ts.hbs +24 -0
  96. package/templates/marketing/payload/src/utilities/formatDateTime.ts.hbs +13 -0
  97. package/templates/marketing/payload/src/utilities/generateMeta.ts.hbs +87 -0
  98. package/templates/marketing/payload/src/utilities/generatePreviewPath.ts.hbs +33 -0
  99. package/templates/marketing/payload/src/utilities/getURL.ts.hbs +26 -0
  100. package/templates/marketing/payload/src/utilities/index.ts.hbs +8 -0
  101. package/templates/marketing/payload/src/utilities/mergeOpenGraph.ts.hbs +26 -0
  102. package/templates/mobile/app.json.hbs +39 -0
  103. package/templates/mobile/babel.config.js.hbs +6 -0
  104. package/templates/mobile/package.json.hbs +30 -0
  105. package/templates/mobile/src/app/(tabs)/_layout.tsx.hbs +27 -0
  106. package/templates/mobile/src/app/(tabs)/index.tsx.hbs +28 -0
  107. package/templates/mobile/src/app/(tabs)/profile.tsx.hbs +44 -0
  108. package/templates/mobile/src/app/_layout.tsx.hbs +13 -0
  109. package/templates/mobile/src/app/index.tsx.hbs +5 -0
  110. package/templates/mobile/tsconfig.json.hbs +10 -0
  111. package/templates/monorepo/package.json.hbs +4 -1
  112. package/templates/web/package.json.hbs +1 -1
  113. package/templates/marketing/payload/src/collections/Pages.ts.hbs +0 -66
  114. package/templates/marketing/payload/src/collections/Posts.ts.hbs +0 -65
  115. package/templates/marketing/payload/src/collections/Users.ts.hbs +0 -25
  116. package/templates/marketing/payload/src/globals/Navigation.ts.hbs +0 -51
  117. 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.27",
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 {}