@nextsparkjs/core 0.1.0-beta.189 → 0.1.0-beta.190
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/components/api/keys/CreateApiKeyDialog.d.ts.map +1 -1
- package/dist/components/api/keys/CreateApiKeyDialog.js +2 -1
- package/dist/components/app/layouts/PublicFooter.d.ts.map +1 -1
- package/dist/components/app/layouts/PublicFooter.js +2 -23
- package/dist/components/app/misc/ThemeToggle.d.ts.map +1 -1
- package/dist/components/app/misc/ThemeToggle.js +2 -1
- package/dist/components/auth/forms/LoginForm.js +1 -1
- package/dist/components/auth/forms/SignupForm.d.ts.map +1 -1
- package/dist/components/auth/forms/SignupForm.js +2 -1
- package/dist/components/auth/pages/AuthErrorPage.d.ts.map +1 -1
- package/dist/components/auth/pages/AuthErrorPage.js +2 -1
- package/dist/components/billing/ManageBillingButton.d.ts.map +1 -1
- package/dist/components/billing/ManageBillingButton.js +2 -1
- package/dist/components/dashboard/block-editor/array-field.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/array-field.js +2 -1
- package/dist/components/dashboard/block-editor/block-picker.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/block-picker.js +2 -1
- package/dist/components/dashboard/block-editor/builder-editor-view.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/builder-editor-view.js +3 -2
- package/dist/components/dashboard/block-editor/config-panel.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/config-panel.js +3 -2
- package/dist/components/dashboard/block-editor/dynamic-form.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/dynamic-form.js +2 -1
- package/dist/components/dashboard/block-editor/entity-fields-sidebar.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/entity-fields-sidebar.js +3 -2
- package/dist/components/dashboard/block-editor/pattern-reference-preview.d.ts.map +1 -1
- package/dist/components/dashboard/block-editor/pattern-reference-preview.js +2 -1
- package/dist/components/dashboard/layouts/TopNavbar.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/TopNavbar.js +4 -3
- package/dist/components/dashboard/misc/SearchDropdown.d.ts.map +1 -1
- package/dist/components/dashboard/misc/SearchDropdown.js +2 -1
- package/dist/components/dashboard/mobile/MobileTopBar.d.ts.map +1 -1
- package/dist/components/dashboard/mobile/MobileTopBar.js +2 -1
- package/dist/components/devtools/BlockDetailViewer.d.ts.map +1 -1
- package/dist/components/devtools/BlockDetailViewer.js +2 -1
- package/dist/components/devtools/BlocksViewer.d.ts.map +1 -1
- package/dist/components/devtools/BlocksViewer.js +2 -1
- package/dist/components/devtools/ConfigViewer.d.ts.map +1 -1
- package/dist/components/devtools/ConfigViewer.js +3 -2
- package/dist/components/devtools/TestCasesViewer.d.ts.map +1 -1
- package/dist/components/devtools/TestCasesViewer.js +3 -2
- package/dist/components/devtools/TestCoverageDashboard.d.ts.map +1 -1
- package/dist/components/devtools/TestCoverageDashboard.js +2 -1
- package/dist/components/devtools/api-explorer/ApiDocsModal.d.ts.map +1 -1
- package/dist/components/devtools/api-explorer/ApiDocsModal.js +0 -0
- package/dist/components/devtools/api-explorer/ApiExplorer.d.ts.map +1 -1
- package/dist/components/devtools/api-explorer/ApiExplorer.js +2 -1
- package/dist/components/devtools/scheduled-actions/actions-table.d.ts.map +1 -1
- package/dist/components/devtools/scheduled-actions/actions-table.js +3 -2
- package/dist/components/docs/docs-sidebar.d.ts.map +1 -1
- package/dist/components/docs/docs-sidebar.js +3 -2
- package/dist/components/entities/EntityFieldRenderer.d.ts.map +1 -1
- package/dist/components/entities/EntityFieldRenderer.js +2 -1
- package/dist/components/entities/EntityList.d.ts.map +1 -1
- package/dist/components/entities/EntityList.js +2 -1
- package/dist/components/entities/EntityTable.d.ts.map +1 -1
- package/dist/components/entities/EntityTable.js +3 -2
- package/dist/components/entities/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/entities/ErrorBoundary.js +2 -1
- package/dist/components/entities/wrappers/EntityDetailWrapper.d.ts.map +1 -1
- package/dist/components/entities/wrappers/EntityDetailWrapper.js +3 -2
- package/dist/components/media/MediaCard.d.ts.map +1 -1
- package/dist/components/media/MediaCard.js +2 -1
- package/dist/components/media/MediaDetailPanel.d.ts.map +1 -1
- package/dist/components/media/MediaDetailPanel.js +2 -1
- package/dist/components/media/MediaList.d.ts.map +1 -1
- package/dist/components/media/MediaList.js +2 -1
- package/dist/components/media/MediaSelector.d.ts.map +1 -1
- package/dist/components/media/MediaSelector.js +2 -1
- package/dist/components/media/MediaUploadZone.d.ts.map +1 -1
- package/dist/components/media/MediaUploadZone.js +2 -1
- package/dist/components/public/entities/PublicEntityDetail.d.ts.map +1 -1
- package/dist/components/public/entities/PublicEntityDetail.js +2 -1
- package/dist/components/teams/TeamPendingInvitations.d.ts.map +1 -1
- package/dist/components/teams/TeamPendingInvitations.js +3 -2
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/audio-upload.d.ts.map +1 -1
- package/dist/components/ui/audio-upload.js +2 -1
- package/dist/components/ui/avatar.d.ts +17 -1
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar.js +29 -2
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/breadcrumb.d.ts +13 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +23 -10
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/file-upload.d.ts.map +1 -1
- package/dist/components/ui/file-upload.js +2 -1
- package/dist/components/ui/image-upload.d.ts.map +1 -1
- package/dist/components/ui/image-upload.js +4 -3
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/optimized-image.d.ts.map +1 -1
- package/dist/components/ui/optimized-image.js +5 -0
- package/dist/components/ui/pagination.d.ts +1 -1
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +3 -0
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/relation-display.d.ts.map +1 -1
- package/dist/components/ui/relation-display.js +3 -2
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/simple-relation-select.d.ts.map +1 -1
- package/dist/components/ui/simple-relation-select.js +7 -6
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/user-display.d.ts.map +1 -1
- package/dist/components/ui/user-display.js +2 -1
- package/dist/components/ui/user-select.d.ts.map +1 -1
- package/dist/components/ui/user-select.js +2 -1
- package/dist/components/ui/video-upload.d.ts.map +1 -1
- package/dist/components/ui/video-upload.js +3 -2
- package/dist/components/users/tables/UsersTable.d.ts.map +1 -1
- package/dist/components/users/tables/UsersTable.js +3 -2
- package/dist/contexts/SubscriptionContext.d.ts.map +1 -1
- package/dist/contexts/SubscriptionContext.js +4 -3
- package/dist/contexts/TeamContext.d.ts.map +1 -1
- package/dist/contexts/TeamContext.js +3 -2
- package/dist/hooks/useAccountPreferencesSync.d.ts.map +1 -1
- package/dist/hooks/useAccountPreferencesSync.js +2 -1
- package/dist/hooks/useApiExplorerNavigation.d.ts.map +1 -1
- package/dist/hooks/useApiExplorerNavigation.js +2 -1
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +3 -2
- package/dist/hooks/useEnsureUserMetadata.d.ts.map +1 -1
- package/dist/hooks/useEnsureUserMetadata.js +3 -2
- package/dist/hooks/useEntityWithMeta.d.ts.map +1 -1
- package/dist/hooks/useEntityWithMeta.js +3 -2
- package/dist/hooks/useInvoice.d.ts.map +1 -1
- package/dist/hooks/useInvoice.js +2 -1
- package/dist/hooks/useInvoices.d.ts.map +1 -1
- package/dist/hooks/useInvoices.js +2 -1
- package/dist/hooks/useMedia.d.ts.map +1 -1
- package/dist/hooks/useMedia.js +10 -9
- package/dist/hooks/useMediaUpload.d.ts.map +1 -1
- package/dist/hooks/useMediaUpload.js +2 -1
- package/dist/hooks/useMembership.d.ts.map +1 -1
- package/dist/hooks/useMembership.js +3 -2
- package/dist/hooks/usePatternUsages.d.ts.map +1 -1
- package/dist/hooks/usePatternUsages.js +3 -2
- package/dist/hooks/usePrefetch.d.ts.map +1 -1
- package/dist/hooks/usePrefetch.js +3 -2
- package/dist/hooks/useQuota.d.ts.map +1 -1
- package/dist/hooks/useQuota.js +2 -1
- package/dist/hooks/useTeamInvitations.d.ts.map +1 -1
- package/dist/hooks/useTeamInvitations.js +4 -3
- package/dist/hooks/useTeamMembers.d.ts.map +1 -1
- package/dist/hooks/useTeamMembers.js +5 -4
- package/dist/hooks/useTeamUpdate.d.ts.map +1 -1
- package/dist/hooks/useTeamUpdate.js +2 -1
- package/dist/hooks/useUserProfile.d.ts.map +1 -1
- package/dist/hooks/useUserProfile.js +3 -2
- package/dist/hooks/useUserSettings.d.ts.map +1 -1
- package/dist/hooks/useUserSettings.js +3 -2
- package/dist/lib/actions/entity.actions.d.ts.map +1 -1
- package/dist/lib/actions/entity.actions.js +2 -1
- package/dist/lib/api/entities.d.ts.map +1 -1
- package/dist/lib/api/entities.js +4 -3
- package/dist/lib/auth/verify-email-link.d.ts +10 -0
- package/dist/lib/auth/verify-email-link.d.ts.map +1 -0
- package/dist/lib/auth/verify-email-link.js +14 -0
- package/dist/lib/auth-client.d.ts +2 -0
- package/dist/lib/auth-client.d.ts.map +1 -1
- package/dist/lib/auth-client.js +4 -0
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +10 -2
- package/dist/lib/base-path.d.ts +85 -0
- package/dist/lib/base-path.d.ts.map +1 -0
- package/dist/lib/base-path.js +79 -0
- package/dist/lib/billing/schema.d.ts +1 -1
- package/dist/lib/billing/schema.d.ts.map +1 -1
- package/dist/lib/billing/schema.js +1 -1
- package/dist/lib/blocks/sanitize-html.d.ts.map +1 -1
- package/dist/lib/blocks/sanitize-html.js +18 -2
- package/dist/lib/cache/revalidate-tag.d.ts +14 -0
- package/dist/lib/cache/revalidate-tag.d.ts.map +1 -0
- package/dist/lib/cache/revalidate-tag.js +8 -0
- package/dist/lib/config/dashboard-schema.d.ts +1 -1
- package/dist/lib/config/dashboard-schema.d.ts.map +1 -1
- package/dist/lib/config/dashboard-schema.js +1 -1
- package/dist/lib/config/types.d.ts +36 -16
- package/dist/lib/config/types.d.ts.map +1 -1
- package/dist/lib/docs/access.d.ts +28 -0
- package/dist/lib/docs/access.d.ts.map +1 -0
- package/dist/lib/docs/access.js +16 -0
- package/dist/lib/docs/parser.d.ts.map +1 -1
- package/dist/lib/docs/parser.js +2 -1
- package/dist/lib/docs/remark-doc-links.d.ts +14 -0
- package/dist/lib/docs/remark-doc-links.d.ts.map +1 -0
- package/dist/lib/docs/remark-doc-links.js +38 -0
- package/dist/lib/entities/api-generator.d.ts +1 -1
- package/dist/lib/entities/api-generator.d.ts.map +1 -1
- package/dist/lib/entities/api-generator.js +1 -1
- package/dist/lib/entities/schema-generator.d.ts +1 -1
- package/dist/lib/entities/schema-generator.d.ts.map +1 -1
- package/dist/lib/entities/schema-generator.js +1 -1
- package/dist/lib/mcp/engine.js +1 -1
- package/dist/lib/mcp/schema-builder.d.ts +1 -1
- package/dist/lib/mcp/schema-builder.d.ts.map +1 -1
- package/dist/lib/mcp/schema-builder.js +1 -1
- package/dist/lib/mcp/tool-generator.js +1 -1
- package/dist/lib/mcp/types.d.ts +1 -1
- package/dist/lib/mcp/types.d.ts.map +1 -1
- package/dist/lib/media/schemas.d.ts +1 -1
- package/dist/lib/media/schemas.d.ts.map +1 -1
- package/dist/lib/media/schemas.js +1 -1
- package/dist/lib/middleware/index.d.ts +5 -1
- package/dist/lib/middleware/index.d.ts.map +1 -1
- package/dist/lib/middleware/index.js +3 -2
- package/dist/lib/services/meta.service.d.ts +60 -0
- package/dist/lib/services/meta.service.d.ts.map +1 -1
- package/dist/lib/services/meta.service.js +132 -12
- package/dist/lib/services/middleware.service.d.ts.map +1 -1
- package/dist/lib/services/middleware.service.js +3 -2
- package/dist/lib/teams/schema.d.ts +1 -1
- package/dist/lib/teams/schema.d.ts.map +1 -1
- package/dist/lib/teams/schema.js +1 -1
- package/dist/lib/teams/teams.api.d.ts.map +1 -1
- package/dist/lib/teams/teams.api.js +4 -3
- package/dist/lib/user-data-client.d.ts.map +1 -1
- package/dist/lib/user-data-client.js +3 -2
- package/dist/lib/validation/invoices.d.ts +1 -1
- package/dist/lib/validation/invoices.d.ts.map +1 -1
- package/dist/lib/validation/invoices.js +1 -1
- package/dist/lib/validation-schemas.d.ts +1 -1
- package/dist/lib/validation-schemas.d.ts.map +1 -1
- package/dist/lib/validation-schemas.js +1 -1
- package/dist/lib/validation.d.ts +1 -1
- package/dist/lib/validation.d.ts.map +1 -1
- package/dist/lib/validation.js +1 -1
- package/dist/messages/de/footer.json +0 -1
- package/dist/messages/de/index.d.ts +0 -1
- package/dist/messages/de/index.d.ts.map +1 -1
- package/dist/messages/en/footer.json +0 -1
- package/dist/messages/en/index.d.ts +0 -1
- package/dist/messages/en/index.d.ts.map +1 -1
- package/dist/messages/es/footer.json +0 -1
- package/dist/messages/es/index.d.ts +0 -1
- package/dist/messages/es/index.d.ts.map +1 -1
- package/dist/messages/fr/footer.json +0 -1
- package/dist/messages/fr/index.d.ts +0 -1
- package/dist/messages/fr/index.d.ts.map +1 -1
- package/dist/messages/it/footer.json +0 -1
- package/dist/messages/it/index.d.ts +0 -1
- package/dist/messages/it/index.d.ts.map +1 -1
- package/dist/messages/pt/footer.json +0 -1
- package/dist/messages/pt/index.d.ts +0 -1
- package/dist/messages/pt/index.d.ts.map +1 -1
- package/dist/templates/app/(auth)/accept-invite/[token]/page.tsx +4 -3
- package/dist/templates/app/(auth)/verify-email/page.tsx +4 -3
- package/dist/templates/app/(public)/docs/[section]/[page]/page.tsx +11 -0
- package/dist/templates/app/api/auth/[...all]/route.ts +15 -14
- package/dist/templates/app/api/internal/user-metadata/route.ts +6 -8
- package/dist/templates/app/api/user/plan-flags/route.ts +1 -1
- package/dist/templates/app/api/user/profile/route.ts +12 -17
- package/dist/templates/app/api/v1/api-keys/route.ts +1 -1
- package/dist/templates/app/api/v1/auth/signup-with-invite/route.ts +2 -1
- package/dist/templates/app/api/v1/billing/cancel/route.ts +1 -1
- package/dist/templates/app/api/v1/billing/change-plan/route.ts +1 -1
- package/dist/templates/app/api/v1/billing/check-action/route.ts +1 -1
- package/dist/templates/app/api/v1/billing/checkout/route.ts +1 -1
- package/dist/templates/app/api/v1/blocks/validate/route.ts +1 -1
- package/dist/templates/app/api/v1/media/[id]/tags/route.ts +1 -1
- package/dist/templates/app/api/v1/post-categories/[id]/route.ts +1 -1
- package/dist/templates/app/api/v1/post-categories/route.ts +1 -1
- package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +2 -1
- package/dist/templates/app/api/v1/teams/[teamId]/subscription/route.ts +3 -5
- package/dist/templates/app/api/v1/teams/docs.md +4 -9
- package/dist/templates/app/api/v1/teams/switch/route.ts +1 -1
- package/dist/templates/app/api/v1/users/[id]/meta/[key]/route.ts +1 -1
- package/dist/templates/app/api/v1/users/[id]/route.ts +1 -1
- package/dist/templates/app/api/v1/users/route.ts +1 -1
- package/dist/templates/app/dashboard/(main)/media/page.tsx +3 -1
- package/dist/templates/app/dashboard/settings/api-keys/page.tsx +5 -4
- package/dist/templates/app/dashboard/settings/profile/page.tsx +3 -2
- package/dist/templates/app/devtools/scheduled-actions/page.tsx +2 -1
- package/dist/templates/app/superadmin/docs/[section]/[page]/page.tsx +16 -0
- package/dist/templates/app/superadmin/subscriptions/page.tsx +3 -2
- package/dist/templates/app/superadmin/teams/[teamId]/page.tsx +5 -4
- package/dist/templates/app/superadmin/users/[userId]/page.tsx +2 -1
- package/dist/templates/app/superadmin/users/page.tsx +2 -1
- package/dist/templates/blocks/cta-section/component.tsx +3 -2
- package/dist/templates/blocks/cta-section/schema.ts +1 -1
- package/dist/templates/blocks/features-grid/component.tsx +2 -1
- package/dist/templates/blocks/features-grid/schema.ts +1 -1
- package/dist/templates/blocks/hero/component.tsx +3 -2
- package/dist/templates/blocks/hero/schema.ts +1 -1
- package/dist/templates/blocks/testimonials/component.tsx +2 -1
- package/dist/templates/blocks/testimonials/schema.ts +1 -1
- package/dist/templates/blocks/text-content/component.tsx +2 -1
- package/dist/templates/blocks/text-content/schema.ts +1 -1
- package/dist/templates/ci-workflows/README.md +1 -1
- package/dist/templates/ci-workflows/github/cypress-regression.yml +1 -1
- package/dist/templates/ci-workflows/github/cypress-smoke.yml +1 -1
- package/dist/templates/contents/plugins/starter/plugin/api/example/route.ts.template +1 -1
- package/dist/templates/contents/themes/starter/blocks/cta-section/component.tsx +3 -2
- package/dist/templates/contents/themes/starter/blocks/cta-section/schema.ts +1 -1
- package/dist/templates/contents/themes/starter/blocks/features-grid/component.tsx +2 -1
- package/dist/templates/contents/themes/starter/blocks/features-grid/schema.ts +1 -1
- package/dist/templates/contents/themes/starter/blocks/hero/component.tsx +3 -2
- package/dist/templates/contents/themes/starter/blocks/hero/schema.ts +1 -1
- package/dist/templates/contents/themes/starter/blocks/testimonials/component.tsx +3 -2
- package/dist/templates/contents/themes/starter/blocks/testimonials/schema.ts +1 -1
- package/dist/templates/contents/themes/starter/blocks/text-content/component.tsx +2 -1
- package/dist/templates/contents/themes/starter/blocks/text-content/schema.ts +1 -1
- package/dist/templates/contents/themes/starter/entities/posts/components/post-header.tsx +2 -1
- package/dist/templates/contents/themes/starter/lib/hooks/useAnalyticsData.ts +2 -1
- package/dist/templates/contents/themes/starter/lib/hooks/useTaskStats.ts +2 -1
- package/dist/templates/eslint.config.mjs +133 -9
- package/dist/templates/features/blog/blocks/post-content/component.tsx +2 -1
- package/dist/templates/features/blog/blocks/post-content/schema.ts +1 -1
- package/dist/templates/features/blog/entities/posts/components/post-header.tsx +2 -1
- package/dist/templates/features/pages/blocks/hero/component.tsx +3 -2
- package/dist/templates/features/pages/blocks/hero/schema.ts +1 -1
- package/dist/templates/next.config.mjs +50 -29
- package/dist/templates/proxy.ts +100 -21
- package/dist/templates/public/sw.js +2 -2
- package/dist/templates/scripts/cy-run-prod.cjs +5 -5
- package/dist/types/blocks.d.ts +1 -1
- package/dist/types/blocks.d.ts.map +1 -1
- package/dist/types/blocks.js +1 -1
- package/package.json +9 -5
- package/scripts/build/docs-registry.mjs +7 -7
- package/scripts/build/registry/__tests__/billing-registry.test.mjs +43 -0
- package/scripts/build/registry/__tests__/build-output.test.mjs +209 -0
- package/scripts/build/registry/__tests__/copy-race-child.mjs +14 -0
- package/scripts/build/registry/__tests__/direct-fs-writes.mjs +203 -0
- package/scripts/build/registry/__tests__/globals-css-tag.test.mjs +66 -0
- package/scripts/build/registry/__tests__/icons-discovery.test.mjs +530 -29
- package/scripts/build/registry/__tests__/page-generator.test.mjs +211 -37
- package/scripts/build/registry/__tests__/published-signatures.test.mjs +239 -0
- package/scripts/build/registry/__tests__/route-file-rule.test.mjs +170 -0
- package/scripts/build/registry/__tests__/safe-fs.test.mjs +333 -0
- package/scripts/build/registry/__tests__/template-analysis.test.mjs +142 -0
- package/scripts/build/registry/__tests__/template-registry.test.mjs +279 -9
- package/scripts/build/registry/__tests__/templates-plan.test.mjs +128 -0
- package/scripts/build/registry/__tests__/templates-tree.test.mjs +367 -0
- package/scripts/build/registry/__tests__/write-places.test.mjs +425 -0
- package/scripts/build/registry/config.mjs +6 -65
- package/scripts/build/registry/discovery/icons.mjs +498 -43
- package/scripts/build/registry/discovery/templates.mjs +1 -1
- package/scripts/build/registry/generators/billing-registry.mjs +1 -1
- package/scripts/build/registry/generators/docs-registry.mjs +3 -4
- package/scripts/build/registry/generators/feature-registry.mjs +1 -1
- package/scripts/build/registry/generators/permissions-registry.mjs +2 -2
- package/scripts/build/registry/generators/template-registry.mjs +65 -49
- package/scripts/build/registry/index.mjs +1 -2
- package/scripts/build/registry/post-build/index.mjs +1 -1
- package/scripts/build/registry/post-build/own-gitignores.mjs +220 -0
- package/scripts/build/registry/post-build/page-generator.mjs +512 -268
- package/scripts/build/registry/post-build/route-cleanup.mjs +16 -13
- package/scripts/build/registry/post-build/test-fixtures.mjs +26 -8
- package/scripts/build/registry/project-mode.mjs +76 -0
- package/scripts/build/registry/shared/typescript-compiler.mjs +77 -0
- package/scripts/build/registry/validate-env.test.mjs +12 -8
- package/scripts/build/registry/watch.mjs +3 -53
- package/scripts/build/registry/write-places.mjs +228 -0
- package/scripts/build/registry.mjs +53 -30
- package/scripts/build/safe-fs.mjs +279 -0
- package/scripts/build/templates-plan.mjs +44 -0
- package/scripts/build/theme.mjs +46 -42
- package/scripts/build/update-tsconfig.mjs +16 -15
- package/scripts/db/cluster-changes.mjs +205 -0
- package/scripts/db/connection-time-limits.mjs +53 -0
- package/scripts/db/inspect-server.mjs +108 -0
- package/scripts/db/migration-time-limit.mjs +695 -0
- package/scripts/db/run-migrations.mjs +46 -41
- package/scripts/db/ssl-config.mjs +194 -0
- package/scripts/db/theme-location.mjs +69 -0
- package/scripts/db/verify-tables.mjs +3 -8
- package/scripts/db/verify-teams.mjs +2 -6
- package/scripts/db/verify-theme-migrations.mjs +169 -0
- package/scripts/maintenance/core-updater.mjs +1003 -0
- package/scripts/maintenance/step-guard.mjs +74 -0
- package/scripts/maintenance/update-core.mjs +14 -831
- package/scripts/utils/console-guard.mjs +13 -0
- package/scripts/utils/generated-tag.mjs +66 -0
- package/scripts/utils/index.mjs +9 -1
- package/scripts/utils/logging.mjs +140 -0
- package/templates/app/(auth)/accept-invite/[token]/page.tsx +4 -3
- package/templates/app/(auth)/verify-email/page.tsx +4 -3
- package/templates/app/(public)/docs/[section]/[page]/page.tsx +11 -0
- package/templates/app/api/auth/[...all]/route.ts +15 -14
- package/templates/app/api/internal/user-metadata/route.ts +6 -8
- package/templates/app/api/user/plan-flags/route.ts +1 -1
- package/templates/app/api/user/profile/route.ts +12 -17
- package/templates/app/api/v1/api-keys/route.ts +1 -1
- package/templates/app/api/v1/auth/signup-with-invite/route.ts +2 -1
- package/templates/app/api/v1/billing/cancel/route.ts +1 -1
- package/templates/app/api/v1/billing/change-plan/route.ts +1 -1
- package/templates/app/api/v1/billing/check-action/route.ts +1 -1
- package/templates/app/api/v1/billing/checkout/route.ts +1 -1
- package/templates/app/api/v1/blocks/validate/route.ts +1 -1
- package/templates/app/api/v1/media/[id]/tags/route.ts +1 -1
- package/templates/app/api/v1/post-categories/[id]/route.ts +1 -1
- package/templates/app/api/v1/post-categories/route.ts +1 -1
- package/templates/app/api/v1/teams/[teamId]/members/route.ts +2 -1
- package/templates/app/api/v1/teams/[teamId]/subscription/route.ts +3 -5
- package/templates/app/api/v1/teams/docs.md +4 -9
- package/templates/app/api/v1/teams/switch/route.ts +1 -1
- package/templates/app/api/v1/users/[id]/meta/[key]/route.ts +1 -1
- package/templates/app/api/v1/users/[id]/route.ts +1 -1
- package/templates/app/api/v1/users/route.ts +1 -1
- package/templates/app/dashboard/(main)/media/page.tsx +3 -1
- package/templates/app/dashboard/settings/api-keys/page.tsx +5 -4
- package/templates/app/dashboard/settings/profile/page.tsx +3 -2
- package/templates/app/devtools/scheduled-actions/page.tsx +2 -1
- package/templates/app/superadmin/docs/[section]/[page]/page.tsx +16 -0
- package/templates/app/superadmin/subscriptions/page.tsx +3 -2
- package/templates/app/superadmin/teams/[teamId]/page.tsx +5 -4
- package/templates/app/superadmin/users/[userId]/page.tsx +2 -1
- package/templates/app/superadmin/users/page.tsx +2 -1
- package/templates/blocks/cta-section/component.tsx +3 -2
- package/templates/blocks/cta-section/schema.ts +1 -1
- package/templates/blocks/features-grid/component.tsx +2 -1
- package/templates/blocks/features-grid/schema.ts +1 -1
- package/templates/blocks/hero/component.tsx +3 -2
- package/templates/blocks/hero/schema.ts +1 -1
- package/templates/blocks/testimonials/component.tsx +2 -1
- package/templates/blocks/testimonials/schema.ts +1 -1
- package/templates/blocks/text-content/component.tsx +2 -1
- package/templates/blocks/text-content/schema.ts +1 -1
- package/templates/ci-workflows/README.md +1 -1
- package/templates/ci-workflows/github/cypress-regression.yml +1 -1
- package/templates/ci-workflows/github/cypress-smoke.yml +1 -1
- package/templates/contents/plugins/starter/plugin/api/example/route.ts.template +1 -1
- package/templates/contents/themes/starter/blocks/cta-section/component.tsx +3 -2
- package/templates/contents/themes/starter/blocks/cta-section/schema.ts +1 -1
- package/templates/contents/themes/starter/blocks/features-grid/component.tsx +2 -1
- package/templates/contents/themes/starter/blocks/features-grid/schema.ts +1 -1
- package/templates/contents/themes/starter/blocks/hero/component.tsx +3 -2
- package/templates/contents/themes/starter/blocks/hero/schema.ts +1 -1
- package/templates/contents/themes/starter/blocks/testimonials/component.tsx +3 -2
- package/templates/contents/themes/starter/blocks/testimonials/schema.ts +1 -1
- package/templates/contents/themes/starter/blocks/text-content/component.tsx +2 -1
- package/templates/contents/themes/starter/blocks/text-content/schema.ts +1 -1
- package/templates/contents/themes/starter/entities/posts/components/post-header.tsx +2 -1
- package/templates/contents/themes/starter/lib/hooks/useAnalyticsData.ts +2 -1
- package/templates/contents/themes/starter/lib/hooks/useTaskStats.ts +2 -1
- package/templates/eslint.config.mjs +133 -9
- package/templates/features/blog/blocks/post-content/component.tsx +2 -1
- package/templates/features/blog/blocks/post-content/schema.ts +1 -1
- package/templates/features/blog/entities/posts/components/post-header.tsx +2 -1
- package/templates/features/pages/blocks/hero/component.tsx +3 -2
- package/templates/features/pages/blocks/hero/schema.ts +1 -1
- package/templates/next.config.mjs +50 -29
- package/templates/proxy.ts +100 -21
- package/templates/public/sw.js +2 -2
- package/templates/scripts/cy-run-prod.cjs +5 -5
- package/tests/jest/__mocks__/@nextsparkjs/registries/template-registry.client.ts +11 -0
- package/tests/jest/__mocks__/next-server.js +10 -0
- package/scripts/build/docs.mjs +0 -392
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the registry build writes in a project, and whether it can write there
|
|
3
|
+
* safely: the check the build runs before it writes anything, so a run that
|
|
4
|
+
* can't finish stops before its first write rather than halfway. The commands
|
|
5
|
+
* of `nextspark` that write before the build runs, or start something alongside
|
|
6
|
+
* it, run this same check from the core installed in the project before their
|
|
7
|
+
* first step: sync:app writes app/, its state and the .gitignore first, and dev
|
|
8
|
+
* and registry:watch start what runs the build.
|
|
9
|
+
*
|
|
10
|
+
* This check names what is in the way ahead of time; what keeps each write,
|
|
11
|
+
* removal and rename inside the project, whether this check saw the place or
|
|
12
|
+
* not, is safe-fs, which every one of them goes through.
|
|
13
|
+
*
|
|
14
|
+
* @module core/scripts/build/registry/write-places
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { accessSync, constants, existsSync, lstatSync, readdirSync } from 'fs'
|
|
18
|
+
import { join } from 'path'
|
|
19
|
+
import { BACKUPS_GITIGNORE, OWN_GITIGNORE_PROBLEMS, REGISTRIES_GITIGNORE, ownGitignoreState } from './post-build/own-gitignores.mjs'
|
|
20
|
+
import { detectMonorepoRoot, isInstalledAsPackage } from './project-mode.mjs'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* What the registry build writes under or writes, from the project root: app/,
|
|
24
|
+
* app/(templates), which it regenerates, app/globals.css, which it points at the
|
|
25
|
+
* active theme's styles, .nextspark/registries, and .nextspark/backups, where it
|
|
26
|
+
* backs up what it replaces or removes in app/(templates).
|
|
27
|
+
*/
|
|
28
|
+
const PLACES = [
|
|
29
|
+
{ path: 'app', kind: 'directory' },
|
|
30
|
+
{ path: 'app/(templates)', kind: 'directory' },
|
|
31
|
+
{ path: 'app/globals.css', kind: 'file' },
|
|
32
|
+
{ path: '.nextspark', kind: 'directory' },
|
|
33
|
+
{ path: '.nextspark/backups', kind: 'directory' },
|
|
34
|
+
{ path: '.nextspark/registries', kind: 'directory' },
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The directories the registry build removes old plugin route directories
|
|
39
|
+
* under, from the project root, when app/api/v1/plugin is there: a symlink
|
|
40
|
+
* among them takes the removal wherever it points.
|
|
41
|
+
*/
|
|
42
|
+
const PLUGIN_ROUTES = ['app/api', 'app/api/v1', 'app/api/v1/plugin']
|
|
43
|
+
|
|
44
|
+
/** The fixtures the registry build writes for the active theme's Cypress tests, from the theme's directory. */
|
|
45
|
+
const TEST_FIXTURES = ['tests/cypress/fixtures/entities.json', 'tests/cypress/fixtures/blocks.json']
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The active theme's Cypress fixtures the registry build writes in this project,
|
|
49
|
+
* from the project root: none when no theme is active, when the theme has no
|
|
50
|
+
* fixtures directory - the build writes them only into one that exists - or when
|
|
51
|
+
* core is a package of the monorepo, whose themes are outside the project.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} projectRoot - The project root
|
|
54
|
+
* @param {string | undefined} activeTheme - NEXT_PUBLIC_ACTIVE_THEME
|
|
55
|
+
* @returns {string[]}
|
|
56
|
+
*/
|
|
57
|
+
export function testFixturesWritten(projectRoot, activeTheme) {
|
|
58
|
+
const theme = activeTheme?.replace(/'/g, '')
|
|
59
|
+
if (!theme) return []
|
|
60
|
+
if (!isInstalledAsPackage(projectRoot) && detectMonorepoRoot(projectRoot) !== null) return []
|
|
61
|
+
const themeDir = `contents/themes/${theme}`
|
|
62
|
+
if (!existsSync(join(projectRoot, themeDir, 'tests', 'cypress', 'fixtures'))) return []
|
|
63
|
+
return TEST_FIXTURES.map(path => `${themeDir}/${path}`)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A path's lstat from the project root; null when nothing is there, 'unreadable' when it can't be told. */
|
|
67
|
+
function lstatIn(projectRoot, path) {
|
|
68
|
+
try {
|
|
69
|
+
return lstatSync(join(projectRoot, path))
|
|
70
|
+
} catch (error) {
|
|
71
|
+
return error.code === 'ENOENT' || error.code === 'ENOTDIR' ? null : 'unreadable'
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Whether a directory, from the project root, can be listed and looked into; one that doesn't exist can. */
|
|
76
|
+
function readable(projectRoot, dir) {
|
|
77
|
+
try {
|
|
78
|
+
accessSync(join(projectRoot, dir), constants.R_OK | constants.X_OK)
|
|
79
|
+
return true
|
|
80
|
+
} catch (error) {
|
|
81
|
+
return error.code === 'ENOENT' || error.code === 'ENOTDIR'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Report what is in the way under `dir`, from the project root, without going
|
|
87
|
+
* through a symlink: each symlink, anything that is neither a file, a directory
|
|
88
|
+
* nor a symlink, a directory that can't be read, and, with `filesOnly`, a
|
|
89
|
+
* directory right under `dir`.
|
|
90
|
+
*/
|
|
91
|
+
function reportEntriesUnder(projectRoot, dir, filesOnly, report) {
|
|
92
|
+
let entries
|
|
93
|
+
try {
|
|
94
|
+
entries = readdirSync(join(projectRoot, dir), { withFileTypes: true })
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') report(dir, "can't be read")
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
for (const entry of entries) {
|
|
100
|
+
const path = `${dir}/${entry.name}`
|
|
101
|
+
if (entry.isSymbolicLink()) {
|
|
102
|
+
report(path, 'is a symlink')
|
|
103
|
+
} else if (entry.isDirectory()) {
|
|
104
|
+
if (filesOnly) report(path, 'is not a file')
|
|
105
|
+
else reportEntriesUnder(projectRoot, path, false, report)
|
|
106
|
+
} else if (!entry.isFile()) {
|
|
107
|
+
report(path, 'is neither a file nor a directory')
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The places the registry build, and a caller about to write `written` - paths
|
|
114
|
+
* from the project root - can't write under safely, each with what is wrong
|
|
115
|
+
* with it, from the project root. None means nothing stands in the way.
|
|
116
|
+
*
|
|
117
|
+
* A symlink: app, app/(templates) or anything in it, app/globals.css,
|
|
118
|
+
* .nextspark, its backups, its registries or anything right in them; app/api,
|
|
119
|
+
* app/api/v1 or app/api/v1/plugin when the build looks for old plugin routes to
|
|
120
|
+
* remove there; each of the active theme's Cypress fixtures the build writes or
|
|
121
|
+
* a directory above one; and each of `written` or a directory above one. What goes through one lands wherever
|
|
122
|
+
* it points, outside the project maybe, and blind: the build's listing of
|
|
123
|
+
* app/(templates) skips a symlink, so what is behind one is written over. Nor
|
|
124
|
+
* can git vouch for it: a symlink is no directory for a line like
|
|
125
|
+
* `app/(templates)/`, and git won't say whether a path beyond one is ignored.
|
|
126
|
+
*
|
|
127
|
+
* Something other than what goes there, which stops a run halfway, once it has
|
|
128
|
+
* written part of what it writes: a file where one of those directories goes,
|
|
129
|
+
* or a directory above a path of `written`; a directory where app/globals.css,
|
|
130
|
+
* a registry - the build writes only files right in .nextspark/registries - or
|
|
131
|
+
* a path of `written` goes; and, in app/(templates), anything that is neither a
|
|
132
|
+
* file, a directory nor a symlink. A file in app/(templates) where the build
|
|
133
|
+
* needs a directory, or a directory where it needs a file, is not in the way:
|
|
134
|
+
* the build backs up what is there and removes it before it writes.
|
|
135
|
+
*
|
|
136
|
+
* What can't be read where the build needs to look: one of those places, a
|
|
137
|
+
* directory in app/(templates), or the backups or registries directory. And a .gitignore of
|
|
138
|
+
* .nextspark/backups or .nextspark/registries that would not keep what is
|
|
139
|
+
* beside it out of git: a symlink, not a file, unreadable, or with patterns
|
|
140
|
+
* other than `*`.
|
|
141
|
+
*
|
|
142
|
+
* @param {string} projectRoot - The project root
|
|
143
|
+
* @param {readonly string[]} [written] - Paths the caller writes or removes, from the project root
|
|
144
|
+
* @param {{ activeTheme?: string }} [options] - The active theme, whose fixtures the build writes; NEXT_PUBLIC_ACTIVE_THEME
|
|
145
|
+
* when not given
|
|
146
|
+
* @returns {{ path: string, problem: string }[]}
|
|
147
|
+
*/
|
|
148
|
+
export function unsafeWritePlaces(projectRoot, written = [], { activeTheme = process.env.NEXT_PUBLIC_ACTIVE_THEME } = {}) {
|
|
149
|
+
const unsafe = []
|
|
150
|
+
const report = (path, problem) => {
|
|
151
|
+
if (!unsafe.some(place => place.path === path)) unsafe.push({ path, problem })
|
|
152
|
+
}
|
|
153
|
+
const reported = path => unsafe.some(place => place.path === path)
|
|
154
|
+
|
|
155
|
+
for (const { path, kind } of PLACES) {
|
|
156
|
+
const stat = lstatIn(projectRoot, path)
|
|
157
|
+
if (stat === null) continue
|
|
158
|
+
if (stat === 'unreadable') report(path, "can't be read")
|
|
159
|
+
else if (stat.isSymbolicLink()) report(path, 'is a symlink')
|
|
160
|
+
else if (kind === 'directory' ? !stat.isDirectory() : !stat.isFile()) report(path, `is not a ${kind}`)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
for (const [directory, gitignore] of [['.nextspark/backups', BACKUPS_GITIGNORE], ['.nextspark/registries', REGISTRIES_GITIGNORE]]) {
|
|
164
|
+
if (reported('.nextspark') || reported(directory)) continue
|
|
165
|
+
if (!readable(projectRoot, directory)) {
|
|
166
|
+
report(directory, "can't be read")
|
|
167
|
+
continue
|
|
168
|
+
}
|
|
169
|
+
const problem = OWN_GITIGNORE_PROBLEMS[ownGitignoreState(projectRoot, gitignore)]
|
|
170
|
+
if (problem) report(gitignore, problem)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (existsSync(join(projectRoot, 'app', 'api', 'v1', 'plugin'))) {
|
|
174
|
+
for (const path of PLUGIN_ROUTES) {
|
|
175
|
+
const stat = lstatIn(projectRoot, path)
|
|
176
|
+
if (stat === 'unreadable') report(path, "can't be read")
|
|
177
|
+
else if (stat?.isSymbolicLink()) {
|
|
178
|
+
report(path, 'is a symlink')
|
|
179
|
+
break
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// The first thing in the way of each path written, from the project root
|
|
185
|
+
for (const path of [...testFixturesWritten(projectRoot, activeTheme), ...written]) {
|
|
186
|
+
const parts = path.split('/')
|
|
187
|
+
for (let depth = 1; depth <= parts.length; depth++) {
|
|
188
|
+
const along = parts.slice(0, depth).join('/')
|
|
189
|
+
const stat = lstatIn(projectRoot, along)
|
|
190
|
+
if (stat === null) break
|
|
191
|
+
const problem = stat === 'unreadable'
|
|
192
|
+
? "can't be read"
|
|
193
|
+
: stat.isSymbolicLink()
|
|
194
|
+
? 'is a symlink'
|
|
195
|
+
: depth < parts.length
|
|
196
|
+
? (stat.isDirectory() ? null : 'is not a directory')
|
|
197
|
+
: (stat.isFile() ? null : 'is not a file')
|
|
198
|
+
if (!problem) continue
|
|
199
|
+
report(along, problem)
|
|
200
|
+
break
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// A tree that is somewhere else already, past a symlink, or that is no directory, is not walked
|
|
205
|
+
if (!reported('app') && !reported('app/(templates)')) {
|
|
206
|
+
reportEntriesUnder(projectRoot, 'app/(templates)', false, report)
|
|
207
|
+
}
|
|
208
|
+
if (!reported('.nextspark') && !reported('.nextspark/registries')) {
|
|
209
|
+
reportEntriesUnder(projectRoot, '.nextspark/registries', true, report)
|
|
210
|
+
}
|
|
211
|
+
return unsafe
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The lines that say what `unsafeWritePlaces` found and what to do about it,
|
|
216
|
+
* one place per line and the advice after them, for a command to print under a
|
|
217
|
+
* line of its own saying it stopped before writing.
|
|
218
|
+
*
|
|
219
|
+
* @param {{ path: string, problem: string }[]} unsafe - What `unsafeWritePlaces` found
|
|
220
|
+
* @returns {string[]}
|
|
221
|
+
*/
|
|
222
|
+
export function unsafeWritePlacesLines(unsafe) {
|
|
223
|
+
return [
|
|
224
|
+
...unsafe.map(({ path, problem }) => `${path} ${problem}`),
|
|
225
|
+
'Through a symlink, what is written, replaced or removed lands wherever it points, and git can\'t tell whether it is ignored; something of another kind, or that can\'t be read, stops a run halfway.',
|
|
226
|
+
'Make each one a directory or file of its own, of the kind that goes there, and run the command again.',
|
|
227
|
+
]
|
|
228
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// First, so what any module prints as it loads is escaped too
|
|
4
|
+
import '../utils/console-guard.mjs'
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
7
|
* Unified Build-Time Registry Generator
|
|
5
8
|
*
|
|
@@ -15,7 +18,6 @@
|
|
|
15
18
|
* - Dynamic project root support (NPM mode)
|
|
16
19
|
*/
|
|
17
20
|
|
|
18
|
-
import { writeFile, mkdir } from 'fs/promises'
|
|
19
21
|
import { join, dirname, resolve } from 'path'
|
|
20
22
|
import { fileURLToPath } from 'url'
|
|
21
23
|
import { existsSync } from 'fs'
|
|
@@ -37,11 +39,14 @@ const rootDir = join(__dirname, '../../../..')
|
|
|
37
39
|
// Validation functions moved to ./registry/validation/entity-validator.mjs
|
|
38
40
|
|
|
39
41
|
// Import shared utilities
|
|
40
|
-
import { log, verbose, setVerboseMode } from '../utils/index.mjs'
|
|
42
|
+
import { log, logFailure, verbose, setVerboseMode } from '../utils/index.mjs'
|
|
41
43
|
import { getBasename } from '../utils/paths.mjs'
|
|
42
44
|
|
|
43
45
|
// Import configuration
|
|
44
46
|
import { getConfig, validateEnvironment } from './registry/config.mjs'
|
|
47
|
+
import { unsafeWritePlaces, unsafeWritePlacesLines } from './registry/write-places.mjs'
|
|
48
|
+
import { projectFiles } from './safe-fs.mjs'
|
|
49
|
+
import { ensureRegistriesGitignore, trackedFilesUnder, trackedRegistriesLines } from './registry/post-build/own-gitignores.mjs'
|
|
45
50
|
|
|
46
51
|
// Import discovery modules (migrated from this file)
|
|
47
52
|
import { discoverParentChildRelations } from './registry/discovery/parent-child.mjs'
|
|
@@ -81,33 +86,46 @@ import { generateDocsRegistry } from './registry/generators/docs-registry.mjs'
|
|
|
81
86
|
import { generateApiPresetsRegistry, generateApiDocsRegistry } from './registry/generators/api-presets-registry.mjs'
|
|
82
87
|
import { generateMcpRegistry } from './registry/generators/mcp-registry.mjs'
|
|
83
88
|
import {
|
|
89
|
+
analyzeTemplates,
|
|
84
90
|
generateMissingPages,
|
|
85
91
|
displayTreeStructure,
|
|
86
92
|
generateTestEntitiesJson,
|
|
87
93
|
generateTestBlocksJson,
|
|
88
|
-
cleanupOldRouteFiles
|
|
89
|
-
cleanupOrphanedTemplates
|
|
94
|
+
cleanupOldRouteFiles
|
|
90
95
|
} from './registry/post-build/index.mjs'
|
|
91
96
|
import { watchContents } from './registry/watch.mjs'
|
|
92
97
|
import { syncAppGlobalsCss } from './theme.mjs'
|
|
93
98
|
|
|
94
99
|
// ==================== Registry File Generation ====================
|
|
95
100
|
|
|
96
|
-
async function generateRegistryFiles(CONFIG, plugins, entities, themes, templates, middlewares, blocks, permissionsConfig, coreRoutes, apiPresetsData, emails, mcpOverridesData) {
|
|
101
|
+
async function generateRegistryFiles(CONFIG, plugins, entities, themes, templates, templateAnalysis, middlewares, blocks, permissionsConfig, coreRoutes, apiPresetsData, emails, mcpOverridesData) {
|
|
97
102
|
log('Generating registry files...', 'build')
|
|
98
103
|
|
|
99
104
|
try {
|
|
105
|
+
const files = projectFiles(CONFIG.projectRoot)
|
|
106
|
+
|
|
100
107
|
// Ensure output directory exists
|
|
101
|
-
await mkdir(CONFIG.outputDir, { recursive: true })
|
|
108
|
+
await files.mkdir(CONFIG.outputDir, { recursive: true })
|
|
109
|
+
|
|
110
|
+
// The registries git doesn't track yet are kept out of git by a .gitignore
|
|
111
|
+
// of their own, in place before the first one is written, whatever the
|
|
112
|
+
// project's rules say; the ones it tracks stay tracked, and that is said
|
|
113
|
+
if (await ensureRegistriesGitignore(CONFIG.projectRoot)) {
|
|
114
|
+
log('.gitignore', 'success')
|
|
115
|
+
}
|
|
116
|
+
const trackedRegistries = trackedFilesUnder(CONFIG.projectRoot, '.nextspark/registries')
|
|
117
|
+
if (trackedRegistries.length > 0) {
|
|
118
|
+
for (const line of trackedRegistriesLines(trackedRegistries.length)) log(line, 'warning')
|
|
119
|
+
}
|
|
102
120
|
|
|
103
121
|
// Generate client template registry (async - needs to check for server exports)
|
|
104
|
-
const templateRegistryClientContent = await generateTemplateRegistryClient(templates, CONFIG)
|
|
122
|
+
const templateRegistryClientContent = await generateTemplateRegistryClient(templates, CONFIG, templateAnalysis)
|
|
105
123
|
|
|
106
124
|
// Collect the icon names configs can ask for by string (async - reads configs)
|
|
107
125
|
const iconNames = await discoverIcons(blocks, CONFIG)
|
|
108
126
|
|
|
109
127
|
// Generate individual registries (pass CONFIG to all generators)
|
|
110
|
-
const
|
|
128
|
+
const registries = [
|
|
111
129
|
{ name: 'plugin-registry.ts', content: generatePluginRegistry(plugins, CONFIG) },
|
|
112
130
|
{ name: 'plugin-registry.client.ts', content: generatePluginRegistryClient(plugins, CONFIG) },
|
|
113
131
|
{ name: 'entity-registry.ts', content: generateEntityRegistry(entities, CONFIG) },
|
|
@@ -116,7 +134,7 @@ async function generateRegistryFiles(CONFIG, plugins, entities, themes, template
|
|
|
116
134
|
{ name: 'theme-registry.ts', content: generateThemeRegistry(themes, CONFIG) },
|
|
117
135
|
{ name: 'route-handlers.ts', content: generateRouteHandlersRegistry(plugins, themes, coreRoutes, entities, CONFIG) },
|
|
118
136
|
{ name: 'translation-registry.ts', content: generateTranslationRegistry(themes, CONFIG) },
|
|
119
|
-
{ name: 'template-registry.ts', content: generateTemplateRegistry(templates, CONFIG) },
|
|
137
|
+
{ name: 'template-registry.ts', content: await generateTemplateRegistry(templates, CONFIG, templateAnalysis) },
|
|
120
138
|
{ name: 'template-registry.client.ts', content: templateRegistryClientContent },
|
|
121
139
|
{ name: 'email-registry.ts', content: generateEmailRegistry(emails, CONFIG) },
|
|
122
140
|
{ name: 'block-registry.ts', content: generateBlockRegistry(blocks, CONFIG) },
|
|
@@ -136,14 +154,14 @@ async function generateRegistryFiles(CONFIG, plugins, entities, themes, template
|
|
|
136
154
|
{ name: 'index.ts', content: generateUnifiedRegistry(plugins, entities, themes, templates, middlewares, CONFIG) }
|
|
137
155
|
]
|
|
138
156
|
|
|
139
|
-
for (const file of
|
|
157
|
+
for (const file of registries) {
|
|
140
158
|
const filePath = join(CONFIG.outputDir, file.name)
|
|
141
|
-
await writeFile(filePath, file.content, 'utf8')
|
|
159
|
+
await files.writeFile(filePath, file.content, 'utf8')
|
|
142
160
|
log(`${file.name}`, 'success')
|
|
143
161
|
}
|
|
144
162
|
|
|
145
163
|
} catch (error) {
|
|
146
|
-
|
|
164
|
+
logFailure('Error writing registry files', error)
|
|
147
165
|
process.exit(1)
|
|
148
166
|
}
|
|
149
167
|
}
|
|
@@ -174,7 +192,7 @@ export async function buildRegistries(projectRoot = null) {
|
|
|
174
192
|
console.error('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
|
|
175
193
|
console.error('')
|
|
176
194
|
for (const error of validation.errors) {
|
|
177
|
-
console.error(` ${
|
|
195
|
+
error.split('\n').forEach((line, index) => console.error(index === 0 ? ` ${line}` : line))
|
|
178
196
|
console.error('')
|
|
179
197
|
}
|
|
180
198
|
console.error('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
|
|
@@ -182,6 +200,15 @@ export async function buildRegistries(projectRoot = null) {
|
|
|
182
200
|
process.exit(1)
|
|
183
201
|
}
|
|
184
202
|
|
|
203
|
+
// Nothing is written, in the project or through it, while a place the build
|
|
204
|
+
// writes under can't take it safely
|
|
205
|
+
const unsafe = unsafeWritePlaces(CONFIG.projectRoot)
|
|
206
|
+
if (unsafe.length > 0) {
|
|
207
|
+
log("Build failed before writing anything: the registry build can't write safely under these paths", 'error')
|
|
208
|
+
for (const line of unsafeWritePlacesLines(unsafe)) console.log(` ${line}`)
|
|
209
|
+
process.exit(1)
|
|
210
|
+
}
|
|
211
|
+
|
|
185
212
|
log('Building Unified Registry System', 'build')
|
|
186
213
|
if (CONFIG.isNpmMode) {
|
|
187
214
|
log(`NPM Mode: Outputting to ${CONFIG.outputDir}`, 'info')
|
|
@@ -264,22 +291,25 @@ export async function buildRegistries(projectRoot = null) {
|
|
|
264
291
|
// Display beautiful tree structure
|
|
265
292
|
displayTreeStructure(plugins, themes, coreEntities)
|
|
266
293
|
|
|
294
|
+
// Parse every theme template once, before anything is written. Both template
|
|
295
|
+
// registries and the page generator take what they need to know about a
|
|
296
|
+
// template from this, so a template saved while a build runs (watch mode)
|
|
297
|
+
// can't look one way to one of them and another way to the next.
|
|
298
|
+
const templateAnalysis = await analyzeTemplates(templates, CONFIG)
|
|
299
|
+
|
|
267
300
|
// Clean up old generated route files first
|
|
268
301
|
await cleanupOldRouteFiles(CONFIG)
|
|
269
302
|
|
|
270
|
-
// Clean up orphaned template files from previous theme builds
|
|
271
|
-
await cleanupOrphanedTemplates(templates, CONFIG)
|
|
272
|
-
|
|
273
303
|
// Hoist plugin dependencies to root workspace for proper resolution
|
|
274
304
|
// Generate all registry files (use aggregated entities for entity registry + blocks)
|
|
275
|
-
await generateRegistryFiles(CONFIG, plugins, allEntities, themes, templates, middlewares, blocks, permissionsConfig, coreRoutes, apiPresetsData, emails, mcpOverridesData)
|
|
305
|
+
await generateRegistryFiles(CONFIG, plugins, allEntities, themes, templates, templateAnalysis, middlewares, blocks, permissionsConfig, coreRoutes, apiPresetsData, emails, mcpOverridesData)
|
|
276
306
|
|
|
277
307
|
// Generate missing pages for templates that don't have core app pages
|
|
278
|
-
await generateMissingPages(templates, CONFIG)
|
|
308
|
+
await generateMissingPages(templates, CONFIG, templateAnalysis)
|
|
279
309
|
|
|
280
310
|
// Generate test fixtures for the active theme
|
|
281
|
-
await generateTestEntitiesJson(allEntities, themes)
|
|
282
|
-
await generateTestBlocksJson(blocks)
|
|
311
|
+
await generateTestEntitiesJson(allEntities, themes, CONFIG)
|
|
312
|
+
await generateTestBlocksJson(blocks, CONFIG)
|
|
283
313
|
|
|
284
314
|
// Generate feature registry (features, flows, tags)
|
|
285
315
|
if (CONFIG.activeTheme) {
|
|
@@ -292,7 +322,7 @@ export async function buildRegistries(projectRoot = null) {
|
|
|
292
322
|
)
|
|
293
323
|
|
|
294
324
|
// Write testing-registry.ts
|
|
295
|
-
await writeFile(featureResult.registryPath, featureResult.registryContent, 'utf8')
|
|
325
|
+
await projectFiles(CONFIG.projectRoot).writeFile(featureResult.registryPath, featureResult.registryContent, 'utf8')
|
|
296
326
|
log('testing-registry.ts', 'success')
|
|
297
327
|
|
|
298
328
|
// Report validation results
|
|
@@ -354,10 +384,7 @@ export async function buildRegistries(projectRoot = null) {
|
|
|
354
384
|
}
|
|
355
385
|
|
|
356
386
|
} catch (error) {
|
|
357
|
-
|
|
358
|
-
if (CONFIG.verbose) {
|
|
359
|
-
console.error(error.stack)
|
|
360
|
-
}
|
|
387
|
+
logFailure('Build failed', error, CONFIG.verbose)
|
|
361
388
|
process.exit(1)
|
|
362
389
|
}
|
|
363
390
|
}
|
|
@@ -398,11 +425,7 @@ process.on('SIGINT', () => {
|
|
|
398
425
|
const isMainScript = process.argv[1] && import.meta.url.endsWith(getBasename(process.argv[1]))
|
|
399
426
|
if (isMainScript) {
|
|
400
427
|
main().catch(error => {
|
|
401
|
-
|
|
402
|
-
const config = getConfig()
|
|
403
|
-
if (config.verbose) {
|
|
404
|
-
console.error(error.stack)
|
|
405
|
-
}
|
|
428
|
+
logFailure('Fatal error', error, getConfig().verbose)
|
|
406
429
|
process.exit(1)
|
|
407
430
|
})
|
|
408
431
|
}
|