@actuate-media/cli 0.4.2 → 0.6.0

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 (39) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +64 -18
  3. package/CHANGELOG.md +46 -0
  4. package/dist/__tests__/db-init.test.d.ts +2 -0
  5. package/dist/__tests__/db-init.test.d.ts.map +1 -0
  6. package/dist/__tests__/db-init.test.js +127 -0
  7. package/dist/__tests__/db-init.test.js.map +1 -0
  8. package/dist/__tests__/db-sync.test.d.ts +2 -0
  9. package/dist/__tests__/db-sync.test.d.ts.map +1 -0
  10. package/dist/__tests__/db-sync.test.js +136 -0
  11. package/dist/__tests__/db-sync.test.js.map +1 -0
  12. package/dist/__tests__/seed.test.js +20 -1
  13. package/dist/__tests__/seed.test.js.map +1 -1
  14. package/dist/commands/db-init.d.ts +17 -0
  15. package/dist/commands/db-init.d.ts.map +1 -1
  16. package/dist/commands/db-init.js +100 -278
  17. package/dist/commands/db-init.js.map +1 -1
  18. package/dist/commands/db-sync.d.ts +31 -0
  19. package/dist/commands/db-sync.d.ts.map +1 -0
  20. package/dist/commands/db-sync.js +195 -0
  21. package/dist/commands/db-sync.js.map +1 -0
  22. package/dist/commands/seed.d.ts +10 -0
  23. package/dist/commands/seed.d.ts.map +1 -1
  24. package/dist/commands/seed.js +38 -4
  25. package/dist/commands/seed.js.map +1 -1
  26. package/dist/commands/upgrade.d.ts.map +1 -1
  27. package/dist/commands/upgrade.js +5 -0
  28. package/dist/commands/upgrade.js.map +1 -1
  29. package/dist/index.js +2 -0
  30. package/dist/index.js.map +1 -1
  31. package/package.json +2 -2
  32. package/src/__tests__/db-init.test.ts +155 -0
  33. package/src/__tests__/db-sync.test.ts +167 -0
  34. package/src/__tests__/seed.test.ts +27 -1
  35. package/src/commands/db-init.ts +93 -266
  36. package/src/commands/db-sync.ts +227 -0
  37. package/src/commands/seed.ts +40 -4
  38. package/src/commands/upgrade.ts +8 -0
  39. package/src/index.ts +2 -0
@@ -154,6 +154,31 @@ const DEMO_FORMS = [
154
154
  },
155
155
  ]
156
156
 
157
+ // Demo navigation menus. Items reference the demo pages by their public URL so
158
+ // the scaffold header/footer render real links out of the box. `location` is
159
+ // admin metadata; the public site looks menus up by `slug` (`main`/`footer`).
160
+ export const DEMO_NAVIGATIONS = [
161
+ {
162
+ name: 'Main Menu',
163
+ slug: 'main',
164
+ location: 'header',
165
+ items: [
166
+ { id: 'nav-home', label: 'Home', url: '/' },
167
+ { id: 'nav-about', label: 'About', url: '/about' },
168
+ { id: 'nav-contact', label: 'Contact', url: '/contact' },
169
+ ],
170
+ },
171
+ {
172
+ name: 'Footer Menu',
173
+ slug: 'footer',
174
+ location: 'footer',
175
+ items: [
176
+ { id: 'nav-privacy', label: 'Privacy Policy', url: '/privacy-policy' },
177
+ { id: 'nav-terms', label: 'Terms of Service', url: '/terms' },
178
+ ],
179
+ },
180
+ ]
181
+
157
182
  const DEMO_USERS = [
158
183
  { email: 'editor@example.com', name: 'Demo Editor', role: 'EDITOR' as const },
159
184
  { email: 'author@example.com', name: 'Demo Author', role: 'AUTHOR' as const },
@@ -479,6 +504,16 @@ async function seedDemoData(db: any): Promise<void> {
479
504
  formsCreated++
480
505
  }
481
506
 
507
+ let navigationsCreated = 0
508
+ for (const navigation of DEMO_NAVIGATIONS) {
509
+ await createSeedDocument(db, userId, {
510
+ collection: 'navigations',
511
+ data: navigation,
512
+ status: 'PUBLISHED',
513
+ })
514
+ navigationsCreated++
515
+ }
516
+
482
517
  let usersCreated = 0
483
518
  for (const user of DEMO_USERS) {
484
519
  const exists = await db.user.findFirst({ where: { email: user.email } })
@@ -498,10 +533,11 @@ async function seedDemoData(db: any): Promise<void> {
498
533
  }
499
534
 
500
535
  spinner.succeed('Demo data seeded successfully.')
501
- logger.info(` Pages: ${pagesCreated}`)
502
- logger.info(` Posts: ${postsCreated}`)
503
- logger.info(` Forms: ${formsCreated}`)
504
- logger.info(` Users: ${usersCreated} (+ existing admin)`)
536
+ logger.info(` Pages: ${pagesCreated}`)
537
+ logger.info(` Posts: ${postsCreated}`)
538
+ logger.info(` Forms: ${formsCreated}`)
539
+ logger.info(` Navigations: ${navigationsCreated}`)
540
+ logger.info(` Users: ${usersCreated} (+ existing admin)`)
505
541
  }
506
542
 
507
543
  async function seedFromFile(db: any, filePath: string): Promise<void> {
@@ -167,6 +167,14 @@ async function runUpgrade(options: UpgradeOptions): Promise<void> {
167
167
 
168
168
  logger.success(`Updated ${upgrades.length} package(s) in package.json.`)
169
169
  logger.info('Run "pnpm install" to apply the upgrade.')
170
+
171
+ // A cms-core bump can introduce new models/migrations. Bumping the version
172
+ // alone leaves the consumer's Prisma schema stale, so point them at db:sync.
173
+ if (upgrades.some((u) => u.name === '@actuate-media/cms-core')) {
174
+ logger.info(
175
+ 'cms-core changed — after installing, run "actuate db:sync" then "npx prisma migrate deploy" to update your Prisma schema.',
176
+ )
177
+ }
170
178
  }
171
179
 
172
180
  export function registerUpgradeCommand(program: Command): void {
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ import { registerExportCommand } from './commands/export.js'
8
8
  import { registerUpgradeCommand } from './commands/upgrade.js'
9
9
  import { registerUpdateCheckCommand } from './commands/update-check.js'
10
10
  import { registerDbInitCommand } from './commands/db-init.js'
11
+ import { registerDbSyncCommand } from './commands/db-sync.js'
11
12
  import { registerDbStatusCommand } from './commands/db-status.js'
12
13
  import { registerInitCommand } from './commands/init.js'
13
14
  import {
@@ -31,6 +32,7 @@ registerExportCommand(program)
31
32
  registerUpgradeCommand(program)
32
33
  registerUpdateCheckCommand(program)
33
34
  registerDbInitCommand(program)
35
+ registerDbSyncCommand(program)
34
36
  registerDbStatusCommand(program)
35
37
  registerInitCommand(program)
36
38
  registerDoctorCommand(program)