sandcms 0.5.2
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/LICENSE +57 -0
- package/README.md +84 -0
- package/dist/Image.svelte +53 -0
- package/dist/Image.svelte.d.ts +10 -0
- package/dist/Seo.svelte +29 -0
- package/dist/Seo.svelte.d.ts +10 -0
- package/dist/admin/Access.svelte +129 -0
- package/dist/admin/Access.svelte.d.ts +7 -0
- package/dist/admin/Account.svelte +190 -0
- package/dist/admin/Account.svelte.d.ts +7 -0
- package/dist/admin/Admin.svelte +42 -0
- package/dist/admin/Admin.svelte.d.ts +8 -0
- package/dist/admin/AssetAttachment.svelte +77 -0
- package/dist/admin/AssetAttachment.svelte.d.ts +15 -0
- package/dist/admin/Collection.svelte +52 -0
- package/dist/admin/Collection.svelte.d.ts +7 -0
- package/dist/admin/Dashboard.svelte +105 -0
- package/dist/admin/Dashboard.svelte.d.ts +7 -0
- package/dist/admin/Editor.svelte +192 -0
- package/dist/admin/Editor.svelte.d.ts +7 -0
- package/dist/admin/Fields.svelte +221 -0
- package/dist/admin/Fields.svelte.d.ts +17 -0
- package/dist/admin/Gallery.svelte +130 -0
- package/dist/admin/Gallery.svelte.d.ts +16 -0
- package/dist/admin/Inbox.svelte +154 -0
- package/dist/admin/Inbox.svelte.d.ts +8 -0
- package/dist/admin/Login.svelte +104 -0
- package/dist/admin/Login.svelte.d.ts +7 -0
- package/dist/admin/MediaLibrary.svelte +231 -0
- package/dist/admin/MediaLibrary.svelte.d.ts +7 -0
- package/dist/admin/MediaPicker.svelte +273 -0
- package/dist/admin/MediaPicker.svelte.d.ts +16 -0
- package/dist/admin/Notice.svelte +13 -0
- package/dist/admin/Notice.svelte.d.ts +8 -0
- package/dist/admin/NotificationSettings.svelte +153 -0
- package/dist/admin/NotificationSettings.svelte.d.ts +7 -0
- package/dist/admin/RichText.svelte +103 -0
- package/dist/admin/RichText.svelte.d.ts +9 -0
- package/dist/admin/RichTextLink.svelte +71 -0
- package/dist/admin/RichTextLink.svelte.d.ts +7 -0
- package/dist/admin/SelectField.svelte +39 -0
- package/dist/admin/SelectField.svelte.d.ts +15 -0
- package/dist/admin/Shell.svelte +106 -0
- package/dist/admin/Shell.svelte.d.ts +9 -0
- package/dist/admin/SortableList.svelte +104 -0
- package/dist/admin/SortableList.svelte.d.ts +30 -0
- package/dist/admin/UnsavedChanges.svelte +54 -0
- package/dist/admin/UnsavedChanges.svelte.d.ts +6 -0
- package/dist/admin/UploadButton.svelte +42 -0
- package/dist/admin/UploadButton.svelte.d.ts +10 -0
- package/dist/admin/UploadQueue.svelte +40 -0
- package/dist/admin/UploadQueue.svelte.d.ts +7 -0
- package/dist/admin/Users.svelte +185 -0
- package/dist/admin/Users.svelte.d.ts +7 -0
- package/dist/admin/client.d.ts +720 -0
- package/dist/admin/client.js +29 -0
- package/dist/admin/components/ui/alert/alert-action.svelte +20 -0
- package/dist/admin/components/ui/alert/alert-action.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert/alert-description.svelte +23 -0
- package/dist/admin/components/ui/alert/alert-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert/alert-title.svelte +23 -0
- package/dist/admin/components/ui/alert/alert-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert/alert.svelte +44 -0
- package/dist/admin/components/ui/alert/alert.svelte.d.ts +26 -0
- package/dist/admin/components/ui/alert/index.d.ts +6 -0
- package/dist/admin/components/ui/alert/index.js +8 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-action.svelte +27 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-action.svelte.d.ts +9 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-cancel.svelte +27 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-cancel.svelte.d.ts +9 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-content.svelte +32 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-content.svelte.d.ts +11 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-description.svelte +20 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-description.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-footer.svelte +23 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-footer.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-header.svelte +23 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-media.svelte +23 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-media.svelte.d.ts +5 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-overlay.svelte +20 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-overlay.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-portal.svelte +7 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-title.svelte +20 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-title.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog.svelte +7 -0
- package/dist/admin/components/ui/alert-dialog/alert-dialog.svelte.d.ts +3 -0
- package/dist/admin/components/ui/alert-dialog/index.d.ts +13 -0
- package/dist/admin/components/ui/alert-dialog/index.js +15 -0
- package/dist/admin/components/ui/attachment/attachment-action.svelte +21 -0
- package/dist/admin/components/ui/attachment/attachment-action.svelte.d.ts +4 -0
- package/dist/admin/components/ui/attachment/attachment-actions.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-actions.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-content.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-content.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-description.svelte +24 -0
- package/dist/admin/components/ui/attachment/attachment-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-group.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-group.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-media.svelte +44 -0
- package/dist/admin/components/ui/attachment/attachment-media.svelte.d.ts +26 -0
- package/dist/admin/components/ui/attachment/attachment-title.svelte +23 -0
- package/dist/admin/components/ui/attachment/attachment-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/attachment/attachment-trigger.svelte +29 -0
- package/dist/admin/components/ui/attachment/attachment-trigger.svelte.d.ts +11 -0
- package/dist/admin/components/ui/attachment/attachment.svelte +54 -0
- package/dist/admin/components/ui/attachment/attachment.svelte.d.ts +45 -0
- package/dist/admin/components/ui/attachment/index.d.ts +10 -0
- package/dist/admin/components/ui/attachment/index.js +12 -0
- package/dist/admin/components/ui/avatar/avatar-badge.svelte +26 -0
- package/dist/admin/components/ui/avatar/avatar-badge.svelte.d.ts +5 -0
- package/dist/admin/components/ui/avatar/avatar-fallback.svelte +20 -0
- package/dist/admin/components/ui/avatar/avatar-fallback.svelte.d.ts +4 -0
- package/dist/admin/components/ui/avatar/avatar-group-count.svelte +23 -0
- package/dist/admin/components/ui/avatar/avatar-group-count.svelte.d.ts +5 -0
- package/dist/admin/components/ui/avatar/avatar-group.svelte +23 -0
- package/dist/admin/components/ui/avatar/avatar-group.svelte.d.ts +5 -0
- package/dist/admin/components/ui/avatar/avatar-image.svelte +17 -0
- package/dist/admin/components/ui/avatar/avatar-image.svelte.d.ts +4 -0
- package/dist/admin/components/ui/avatar/avatar.svelte +26 -0
- package/dist/admin/components/ui/avatar/avatar.svelte.d.ts +7 -0
- package/dist/admin/components/ui/avatar/index.d.ts +7 -0
- package/dist/admin/components/ui/avatar/index.js +9 -0
- package/dist/admin/components/ui/badge/badge.svelte +50 -0
- package/dist/admin/components/ui/badge/badge.svelte.d.ts +38 -0
- package/dist/admin/components/ui/badge/index.d.ts +2 -0
- package/dist/admin/components/ui/badge/index.js +2 -0
- package/dist/admin/components/ui/button/button.svelte +87 -0
- package/dist/admin/components/ui/button/button.svelte.d.ts +70 -0
- package/dist/admin/components/ui/button/index.d.ts +2 -0
- package/dist/admin/components/ui/button/index.js +4 -0
- package/dist/admin/components/ui/card/card-action.svelte +20 -0
- package/dist/admin/components/ui/card/card-action.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-content.svelte +20 -0
- package/dist/admin/components/ui/card/card-content.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-description.svelte +20 -0
- package/dist/admin/components/ui/card/card-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-footer.svelte +20 -0
- package/dist/admin/components/ui/card/card-footer.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-header.svelte +23 -0
- package/dist/admin/components/ui/card/card-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card-title.svelte +20 -0
- package/dist/admin/components/ui/card/card-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/card/card.svelte +25 -0
- package/dist/admin/components/ui/card/card.svelte.d.ts +8 -0
- package/dist/admin/components/ui/card/index.d.ts +8 -0
- package/dist/admin/components/ui/card/index.js +10 -0
- package/dist/admin/components/ui/checkbox/checkbox.svelte +39 -0
- package/dist/admin/components/ui/checkbox/checkbox.svelte.d.ts +4 -0
- package/dist/admin/components/ui/checkbox/index.d.ts +2 -0
- package/dist/admin/components/ui/checkbox/index.js +4 -0
- package/dist/admin/components/ui/dialog/dialog-close.svelte +11 -0
- package/dist/admin/components/ui/dialog/dialog-close.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-content.svelte +48 -0
- package/dist/admin/components/ui/dialog/dialog-content.svelte.d.ts +13 -0
- package/dist/admin/components/ui/dialog/dialog-description.svelte +20 -0
- package/dist/admin/components/ui/dialog/dialog-description.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-footer.svelte +32 -0
- package/dist/admin/components/ui/dialog/dialog-footer.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dialog/dialog-header.svelte +20 -0
- package/dist/admin/components/ui/dialog/dialog-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/dialog/dialog-overlay.svelte +20 -0
- package/dist/admin/components/ui/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-portal.svelte +7 -0
- package/dist/admin/components/ui/dialog/dialog-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dialog/dialog-title.svelte +17 -0
- package/dist/admin/components/ui/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog-trigger.svelte +11 -0
- package/dist/admin/components/ui/dialog/dialog-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dialog/dialog.svelte +7 -0
- package/dist/admin/components/ui/dialog/dialog.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dialog/index.d.ts +11 -0
- package/dist/admin/components/ui/dialog/index.js +13 -0
- package/dist/admin/components/ui/input/index.d.ts +2 -0
- package/dist/admin/components/ui/input/index.js +4 -0
- package/dist/admin/components/ui/input/input.svelte +48 -0
- package/dist/admin/components/ui/input/input.svelte.d.ts +13 -0
- package/dist/admin/components/ui/label/index.d.ts +2 -0
- package/dist/admin/components/ui/label/index.js +4 -0
- package/dist/admin/components/ui/label/label.svelte +20 -0
- package/dist/admin/components/ui/label/label.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/index.d.ts +13 -0
- package/dist/admin/components/ui/select/index.js +15 -0
- package/dist/admin/components/ui/select/select-content.svelte +45 -0
- package/dist/admin/components/ui/select/select-content.svelte.d.ts +11 -0
- package/dist/admin/components/ui/select/select-group-heading.svelte +21 -0
- package/dist/admin/components/ui/select/select-group-heading.svelte.d.ts +10 -0
- package/dist/admin/components/ui/select/select-group.svelte +17 -0
- package/dist/admin/components/ui/select/select-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-item.svelte +42 -0
- package/dist/admin/components/ui/select/select-item.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-label.svelte +20 -0
- package/dist/admin/components/ui/select/select-label.svelte.d.ts +6 -0
- package/dist/admin/components/ui/select/select-portal.svelte +7 -0
- package/dist/admin/components/ui/select/select-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/select/select-scroll-down-button.svelte +23 -0
- package/dist/admin/components/ui/select/select-scroll-down-button.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-scroll-up-button.svelte +23 -0
- package/dist/admin/components/ui/select/select-scroll-up-button.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-separator.svelte +18 -0
- package/dist/admin/components/ui/select/select-separator.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select-trigger.svelte +29 -0
- package/dist/admin/components/ui/select/select-trigger.svelte.d.ts +8 -0
- package/dist/admin/components/ui/select/select-value.svelte +7 -0
- package/dist/admin/components/ui/select/select-value.svelte.d.ts +4 -0
- package/dist/admin/components/ui/select/select.svelte +11 -0
- package/dist/admin/components/ui/select/select.svelte.d.ts +3 -0
- package/dist/admin/components/ui/separator/index.d.ts +2 -0
- package/dist/admin/components/ui/separator/index.js +4 -0
- package/dist/admin/components/ui/separator/separator.svelte +21 -0
- package/dist/admin/components/ui/separator/separator.svelte.d.ts +4 -0
- package/dist/admin/components/ui/switch/index.d.ts +2 -0
- package/dist/admin/components/ui/switch/index.js +4 -0
- package/dist/admin/components/ui/switch/switch.svelte +34 -0
- package/dist/admin/components/ui/switch/switch.svelte.d.ts +8 -0
- package/dist/admin/components/ui/table/index.d.ts +9 -0
- package/dist/admin/components/ui/table/index.js +11 -0
- package/dist/admin/components/ui/table/table-body.svelte +20 -0
- package/dist/admin/components/ui/table/table-body.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-caption.svelte +20 -0
- package/dist/admin/components/ui/table/table-caption.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-cell.svelte +20 -0
- package/dist/admin/components/ui/table/table-cell.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-footer.svelte +20 -0
- package/dist/admin/components/ui/table/table-footer.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-head.svelte +23 -0
- package/dist/admin/components/ui/table/table-head.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-header.svelte +20 -0
- package/dist/admin/components/ui/table/table-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table-row.svelte +23 -0
- package/dist/admin/components/ui/table/table-row.svelte.d.ts +5 -0
- package/dist/admin/components/ui/table/table.svelte +22 -0
- package/dist/admin/components/ui/table/table.svelte.d.ts +5 -0
- package/dist/admin/components/ui/textarea/index.d.ts +2 -0
- package/dist/admin/components/ui/textarea/index.js +4 -0
- package/dist/admin/components/ui/textarea/textarea.svelte +22 -0
- package/dist/admin/components/ui/textarea/textarea.svelte.d.ts +5 -0
- package/dist/admin/components/ui/toggle/index.d.ts +3 -0
- package/dist/admin/components/ui/toggle/index.js +5 -0
- package/dist/admin/components/ui/toggle/toggle.svelte +52 -0
- package/dist/admin/components/ui/toggle/toggle.svelte.d.ts +43 -0
- package/dist/admin/generated/FONT-LICENSE +93 -0
- package/dist/admin/generated/Geist-LICENSE.txt +93 -0
- package/dist/admin/generated/admin.css +3276 -0
- package/dist/admin/generated/fonts/geist-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-cyrillic-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-ext-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-vietnamese-wght-italic.woff2 +0 -0
- package/dist/admin/generated/fonts/geist-vietnamese-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-latin-wght-normal.woff2 +0 -0
- package/dist/admin/generated/geist-vietnamese-wght-normal.woff2 +0 -0
- package/dist/admin/generated/styles.css +2772 -0
- package/dist/admin/index.d.ts +2 -0
- package/dist/admin/index.js +1 -0
- package/dist/admin/types.d.ts +63 -0
- package/dist/admin/types.js +1 -0
- package/dist/admin/uploads.d.ts +12 -0
- package/dist/admin/uploads.js +23 -0
- package/dist/admin/utils.d.ts +11 -0
- package/dist/admin/utils.js +1 -0
- package/dist/blueprints/files.d.ts +7 -0
- package/dist/blueprints/files.js +112 -0
- package/dist/blueprints/gallery.d.ts +3 -0
- package/dist/blueprints/gallery.js +14 -0
- package/dist/blueprints/load.d.ts +6 -0
- package/dist/blueprints/load.js +186 -0
- package/dist/blueprints/merge.d.ts +2 -0
- package/dist/blueprints/merge.js +18 -0
- package/dist/blueprints/types.d.ts +58 -0
- package/dist/blueprints/types.js +1 -0
- package/dist/blueprints/validate.d.ts +8 -0
- package/dist/blueprints/validate.js +133 -0
- package/dist/cli/backup.d.ts +6 -0
- package/dist/cli/backup.js +85 -0
- package/dist/cli/cloudflare.d.ts +8 -0
- package/dist/cli/cloudflare.js +123 -0
- package/dist/cli/doctor.d.ts +1 -0
- package/dist/cli/doctor.js +56 -0
- package/dist/cli/files.d.ts +30 -0
- package/dist/cli/files.js +114 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +182 -0
- package/dist/cli/prompts.d.ts +5 -0
- package/dist/cli/prompts.js +41 -0
- package/dist/cli/scaffold.d.ts +2 -0
- package/dist/cli/scaffold.js +58 -0
- package/dist/cli/setup.d.ts +11 -0
- package/dist/cli/setup.js +116 -0
- package/dist/cli/upgrade.d.ts +1 -0
- package/dist/cli/upgrade.js +47 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/media.d.ts +26 -0
- package/dist/media.js +27 -0
- package/dist/notification-fields.d.ts +8 -0
- package/dist/notification-fields.js +26 -0
- package/dist/richtext.d.ts +14 -0
- package/dist/richtext.js +73 -0
- package/dist/server/access.d.ts +16 -0
- package/dist/server/access.js +216 -0
- package/dist/server/admin-load.d.ts +342 -0
- package/dist/server/admin-load.js +135 -0
- package/dist/server/api.d.ts +3 -0
- package/dist/server/api.js +144 -0
- package/dist/server/auth.d.ts +744 -0
- package/dist/server/auth.js +142 -0
- package/dist/server/blueprint-icons.d.ts +4 -0
- package/dist/server/blueprint-icons.js +14 -0
- package/dist/server/cms.d.ts +1054 -0
- package/dist/server/cms.js +58 -0
- package/dist/server/content.d.ts +101 -0
- package/dist/server/content.js +285 -0
- package/dist/server/db/migration-data.d.ts +4 -0
- package/dist/server/db/migration-data.js +7 -0
- package/dist/server/db/migrations/0000_foundation.sql +180 -0
- package/dist/server/db/migrations/meta/0000_snapshot.json +1188 -0
- package/dist/server/db/migrations/meta/_journal.json +13 -0
- package/dist/server/db/schema.d.ts +2212 -0
- package/dist/server/db/schema.js +171 -0
- package/dist/server/db/store.d.ts +33 -0
- package/dist/server/db/store.js +131 -0
- package/dist/server/email/index.d.ts +50 -0
- package/dist/server/email/index.js +175 -0
- package/dist/server/email/template.d.ts +8 -0
- package/dist/server/email/template.js +53 -0
- package/dist/server/forms.d.ts +40 -0
- package/dist/server/forms.js +84 -0
- package/dist/server/hooks.d.ts +3 -0
- package/dist/server/hooks.js +85 -0
- package/dist/server/http.d.ts +3 -0
- package/dist/server/http.js +3 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +7 -0
- package/dist/server/media/delivery.d.ts +3 -0
- package/dist/server/media/delivery.js +42 -0
- package/dist/server/media/presets.d.ts +2 -0
- package/dist/server/media/presets.js +8 -0
- package/dist/server/media/runner.d.ts +2 -0
- package/dist/server/media/runner.js +128 -0
- package/dist/server/media/service.d.ts +144 -0
- package/dist/server/media/service.js +280 -0
- package/dist/server/notifications.d.ts +9 -0
- package/dist/server/notifications.js +161 -0
- package/dist/server/request.d.ts +2 -0
- package/dist/server/request.js +39 -0
- package/dist/server/seo.d.ts +12 -0
- package/dist/server/seo.js +62 -0
- package/dist/worker/index.d.ts +10 -0
- package/dist/worker/index.js +266 -0
- package/dist/worker/source.d.ts +2 -0
- package/dist/worker/source.js +31 -0
- package/dist/worker/svg.d.ts +5 -0
- package/dist/worker/svg.js +142 -0
- package/docs/acceptance.md +58 -0
- package/docs/cloudflare.md +146 -0
- package/docs/content.md +188 -0
- package/docs/deployment.md +89 -0
- package/docs/email.md +124 -0
- package/docs/forms.md +18 -0
- package/docs/media.md +105 -0
- package/docs/package.md +84 -0
- package/docs/releases.md +29 -0
- package/docs/upgrades.md +62 -0
- package/package.json +124 -0
- package/templates/dockerignore +15 -0
- package/templates/hooks.server.ts +4 -0
- package/templates/integration.ts +20 -0
- package/templates/railpack.json +7 -0
- package/templates/routes/admin/+page.server.ts +3 -0
- package/templates/routes/admin/+page.svelte +6 -0
- package/templates/routes/api/+server.ts +4 -0
- package/templates/sandcms/blueprints/collections/photographers.yaml +6 -0
- package/templates/sandcms/blueprints/collections/projects.yaml +26 -0
- package/templates/sandcms/blueprints/files/image.yaml +6 -0
- package/templates/sandcms/blueprints/forms/registration.yaml +15 -0
- package/templates/sandcms/blueprints/pages/home.yaml +9 -0
- package/templates/sandcms/blueprints/site.yaml +13 -0
- package/templates/sandcms/config.yaml +12 -0
- package/templates/sandcms/worker/index.ts +1 -0
- package/templates/sandcms/worker/wrangler.jsonc +7 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { config as loadEnv } from 'dotenv';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { resolve, join } from 'node:path';
|
|
5
|
+
import { setup } from './setup.js';
|
|
6
|
+
import { upgrade } from './upgrade.js';
|
|
7
|
+
import { backup, restore } from './backup.js';
|
|
8
|
+
import { openStore, applyMigrations, pendingMigrations, inspectMigrations } from '../server/db/store.js';
|
|
9
|
+
import { createCMS } from '../server/cms.js';
|
|
10
|
+
import { createUser, recoverUser } from '../server/auth.js';
|
|
11
|
+
import { user } from '../server/db/schema.js';
|
|
12
|
+
import { loadDefinition } from '../blueprints/load.js';
|
|
13
|
+
import { text, password, confirm } from './prompts.js';
|
|
14
|
+
import { updateWorker } from './cloudflare.js';
|
|
15
|
+
import { doctor } from './doctor.js';
|
|
16
|
+
const { values, positionals } = parseArgs({
|
|
17
|
+
args: process.argv.slice(2),
|
|
18
|
+
allowPositionals: true,
|
|
19
|
+
options: {
|
|
20
|
+
cwd: { type: 'string' },
|
|
21
|
+
name: { type: 'string' },
|
|
22
|
+
email: { type: 'string' },
|
|
23
|
+
role: { type: 'string' },
|
|
24
|
+
database: { type: 'string' },
|
|
25
|
+
output: { type: 'string' },
|
|
26
|
+
from: { type: 'string' },
|
|
27
|
+
package: { type: 'string' },
|
|
28
|
+
check: { type: 'boolean' },
|
|
29
|
+
'dry-run': { type: 'boolean' },
|
|
30
|
+
'skip-install': { type: 'boolean' },
|
|
31
|
+
'password-stdin': { type: 'boolean' },
|
|
32
|
+
yes: { type: 'boolean' },
|
|
33
|
+
help: { type: 'boolean' }
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const root = resolve(values.cwd ?? '.');
|
|
37
|
+
loadEnv({ path: [join(root, '.env.local'), join(root, '.env')], override: false, quiet: true });
|
|
38
|
+
const database = resolve(root, values.database ?? process.env.SANDCMS_DATABASE ?? './data/sandcms.sqlite');
|
|
39
|
+
async function suppliedPassword() {
|
|
40
|
+
return values['password-stdin']
|
|
41
|
+
? (await Bun.stdin.text()).replace(/\r?\n$/, '')
|
|
42
|
+
: await password();
|
|
43
|
+
}
|
|
44
|
+
async function main() {
|
|
45
|
+
const [command, subcommand] = positionals;
|
|
46
|
+
if (values.help) {
|
|
47
|
+
console.log('sandcms setup | validate | doctor | upgrade [--check] | migrate [--check] | worker update | media rebuild | backup --output PATH | restore --from PATH | user bootstrap/add/reset-password/reset-2fa\nUse --database PATH to select the target database. Secrets are never accepted as arguments.');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (!command) {
|
|
51
|
+
if (!process.stdin.isTTY)
|
|
52
|
+
throw new Error('Choose a command; use --help');
|
|
53
|
+
return setup({ root });
|
|
54
|
+
}
|
|
55
|
+
console.log(`Project: ${root}\nDatabase: ${database}\nRuntime: Bun ${Bun.version}`);
|
|
56
|
+
if (command === 'validate') {
|
|
57
|
+
const definition = loadDefinition(join(root, 'sandcms'));
|
|
58
|
+
console.log(`Validated ${definition.blueprints.length} blueprints and media presets.`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (command === 'migrate' && values.check) {
|
|
62
|
+
console.log(inspectMigrations(database).map((m) => m.name));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (command === 'setup')
|
|
66
|
+
return setup({
|
|
67
|
+
root,
|
|
68
|
+
name: values.name,
|
|
69
|
+
dryRun: values['dry-run'],
|
|
70
|
+
yes: values.yes,
|
|
71
|
+
skipInstall: values['skip-install'],
|
|
72
|
+
package: values.package,
|
|
73
|
+
email: values.email,
|
|
74
|
+
database: values.database
|
|
75
|
+
});
|
|
76
|
+
if (command === 'upgrade')
|
|
77
|
+
return upgrade(root, values.check, database);
|
|
78
|
+
if (command === 'worker' && subcommand === 'update')
|
|
79
|
+
return updateWorker(root);
|
|
80
|
+
if (command === 'backup') {
|
|
81
|
+
if (!values.output)
|
|
82
|
+
throw new Error('Use --output PATH');
|
|
83
|
+
console.log('Verified snapshot: ' + backup(database, values.output));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (command === 'restore') {
|
|
87
|
+
if (!values.from)
|
|
88
|
+
throw new Error('Use --from PATH');
|
|
89
|
+
const approved = values.yes ||
|
|
90
|
+
(await confirm(`Restore ${values.from} over ${database}? Stop all website processes first. A safety copy will be retained.`));
|
|
91
|
+
console.log(restore(database, values.from, approved));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (command === 'doctor')
|
|
95
|
+
return doctor(root, database);
|
|
96
|
+
if (command === 'media' && subcommand === 'rebuild') {
|
|
97
|
+
const cms = createCMS({
|
|
98
|
+
database,
|
|
99
|
+
root: join(root, 'sandcms'),
|
|
100
|
+
origin: process.env.SANDCMS_ORIGIN ?? 'http://localhost:5410',
|
|
101
|
+
secret: process.env.SANDCMS_SECRET ?? '',
|
|
102
|
+
workerToken: process.env.SANDCMS_WORKER_TOKEN,
|
|
103
|
+
workerUrl: process.env.SANDCMS_WORKER_URL
|
|
104
|
+
});
|
|
105
|
+
try {
|
|
106
|
+
cms.media.rebuild();
|
|
107
|
+
while (cms.media.list().some((a) => a.status === 'processing')) {
|
|
108
|
+
await cms.media.tick();
|
|
109
|
+
await Bun.sleep(1000);
|
|
110
|
+
console.log(cms.media
|
|
111
|
+
.list()
|
|
112
|
+
.map((a) => `${a.filename}: ${a.status}`)
|
|
113
|
+
.join('\n'));
|
|
114
|
+
}
|
|
115
|
+
if (cms.media.list().some((a) => a.status === 'failed'))
|
|
116
|
+
throw new Error('Some images failed; retry with media rebuild');
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
cms.close();
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const store = openStore(database);
|
|
124
|
+
try {
|
|
125
|
+
if (command === 'migrate') {
|
|
126
|
+
if (values.check)
|
|
127
|
+
console.log(pendingMigrations(store).map((m) => m.name));
|
|
128
|
+
else
|
|
129
|
+
console.log('Applied:', applyMigrations(store));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (command === 'user') {
|
|
133
|
+
if (pendingMigrations(store).length)
|
|
134
|
+
throw new Error('Run sandcms migrate first');
|
|
135
|
+
const email = values.email ?? (await text('Email address'));
|
|
136
|
+
if (subcommand === 'bootstrap') {
|
|
137
|
+
if (store.db.select().from(user).limit(1).get())
|
|
138
|
+
throw new Error('Bootstrap is only available on an empty user database');
|
|
139
|
+
const generated = crypto.randomUUID() + 'A!';
|
|
140
|
+
await createUser(store, {
|
|
141
|
+
email,
|
|
142
|
+
name: values.name ?? 'Administrator',
|
|
143
|
+
role: 'admin',
|
|
144
|
+
password: generated
|
|
145
|
+
});
|
|
146
|
+
console.log(`One-time bootstrap password: ${generated}\nChange it at first sign-in. This account exists only in ${database}.`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (subcommand === 'add') {
|
|
150
|
+
const role = values.role ?? 'editor';
|
|
151
|
+
if (role !== 'admin' && role !== 'editor')
|
|
152
|
+
throw new Error('Role must be admin or editor');
|
|
153
|
+
await createUser(store, {
|
|
154
|
+
email,
|
|
155
|
+
name: values.name ?? (await text('Display name')),
|
|
156
|
+
role,
|
|
157
|
+
password: await suppliedPassword()
|
|
158
|
+
});
|
|
159
|
+
console.log('User created; deliver the supplied password privately.');
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (subcommand === 'reset-password') {
|
|
163
|
+
await recoverUser(store, email, 'password', await suppliedPassword());
|
|
164
|
+
console.log('Password reset; sessions invalidated; recovery audited.');
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (subcommand === 'reset-2fa') {
|
|
168
|
+
await recoverUser(store, email, '2fa');
|
|
169
|
+
console.log('Two-factor reset; sessions invalidated; recovery audited.');
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
throw new Error('Unknown command. Run sandcms --help');
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
store.close();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
main().catch((e) => {
|
|
180
|
+
console.error(e instanceof Error ? e.message : e);
|
|
181
|
+
process.exitCode = 1;
|
|
182
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function answer<T>(value: T): Exclude<T, symbol>;
|
|
2
|
+
export declare function text(message: string, initialValue?: string): Promise<string>;
|
|
3
|
+
export declare function confirm(message: string, initialValue?: boolean): Promise<boolean>;
|
|
4
|
+
export declare function password(): Promise<string>;
|
|
5
|
+
export declare function run(args: string[], cwd?: string, input?: string): Promise<void>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
export function answer(value) {
|
|
3
|
+
if (p.isCancel(value))
|
|
4
|
+
throw new Error('Cancelled; existing files have been preserved');
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
export async function text(message, initialValue) {
|
|
8
|
+
return answer(await p.text({
|
|
9
|
+
message,
|
|
10
|
+
initialValue,
|
|
11
|
+
validate: (v) => (v?.trim() ? undefined : 'This value is required')
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
export async function confirm(message, initialValue = false) {
|
|
15
|
+
return answer(await p.confirm({ message, initialValue }));
|
|
16
|
+
}
|
|
17
|
+
export async function password() {
|
|
18
|
+
const value = answer(await p.password({
|
|
19
|
+
message: 'Temporary password (12–128 characters)',
|
|
20
|
+
validate: (v) => v && v.length >= 12 && v.length <= 128 ? undefined : 'Use 12–128 characters'
|
|
21
|
+
}));
|
|
22
|
+
const again = answer(await p.password({ message: 'Confirm temporary password' }));
|
|
23
|
+
if (value !== again)
|
|
24
|
+
throw new Error('Passwords do not match');
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
export async function run(args, cwd = process.cwd(), input) {
|
|
28
|
+
const child = Bun.spawn(args, {
|
|
29
|
+
cwd,
|
|
30
|
+
stdin: input === undefined ? 'inherit' : 'pipe',
|
|
31
|
+
stdout: 'inherit',
|
|
32
|
+
stderr: 'inherit'
|
|
33
|
+
});
|
|
34
|
+
if (input !== undefined && typeof child.stdin !== 'number' && child.stdin) {
|
|
35
|
+
child.stdin.write(input);
|
|
36
|
+
child.stdin.end();
|
|
37
|
+
}
|
|
38
|
+
const code = await child.exited;
|
|
39
|
+
if (code)
|
|
40
|
+
throw new Error(`${args.slice(0, 3).join(' ')} failed (${code})`);
|
|
41
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { write, PACKAGE_NAME, PACKAGE_VERSION } from './files.js';
|
|
4
|
+
export function assertFreshDirectory(root) {
|
|
5
|
+
const conflicts = [
|
|
6
|
+
'svelte.config.js',
|
|
7
|
+
'svelte.config.ts',
|
|
8
|
+
'vite.config.ts',
|
|
9
|
+
'vite.config.js',
|
|
10
|
+
'tsconfig.json',
|
|
11
|
+
'jsconfig.json',
|
|
12
|
+
'src/app.html'
|
|
13
|
+
].filter((file) => existsSync(join(root, file)));
|
|
14
|
+
if (conflicts.length)
|
|
15
|
+
throw new Error(`Directory contains application files but no package.json: ${conflicts.join(', ')}. Restore the project's package.json or choose an empty directory; no files were changed.`);
|
|
16
|
+
}
|
|
17
|
+
export function scaffold(root, name, packageSource) {
|
|
18
|
+
assertFreshDirectory(root);
|
|
19
|
+
write(join(root, 'package.json'), JSON.stringify({
|
|
20
|
+
name: name.toLowerCase().replace(/[^a-z0-9-]/g, '-'),
|
|
21
|
+
version: '0.0.1',
|
|
22
|
+
private: true,
|
|
23
|
+
type: 'module',
|
|
24
|
+
packageManager: 'bun@1.4.0',
|
|
25
|
+
scripts: {
|
|
26
|
+
dev: 'bun --bun vite dev --host 0.0.0.0 --port 5410 --strictPort',
|
|
27
|
+
build: 'bun x --no-install sandcms validate && bun --bun vite build',
|
|
28
|
+
start: 'bun build/index.js',
|
|
29
|
+
check: 'svelte-kit sync && svelte-check'
|
|
30
|
+
},
|
|
31
|
+
dependencies: { [PACKAGE_NAME]: packageSource ?? PACKAGE_VERSION },
|
|
32
|
+
devDependencies: {
|
|
33
|
+
'@sveltejs/kit': '2.70.3',
|
|
34
|
+
'@sveltejs/vite-plugin-svelte': '7.3.1',
|
|
35
|
+
svelte: '5.57.1',
|
|
36
|
+
vite: '8.3.1',
|
|
37
|
+
typescript: '6.0.3',
|
|
38
|
+
'svelte-adapter-bun': '1.0.1',
|
|
39
|
+
'svelte-check': '4.7.6',
|
|
40
|
+
'@types/bun': '1.4.2'
|
|
41
|
+
}
|
|
42
|
+
}, null, 2) + '\n');
|
|
43
|
+
write(join(root, 'svelte.config.js'), "import adapter from 'svelte-adapter-bun';\nimport { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\nexport default { preprocess: vitePreprocess(), kit: { adapter: adapter() } };\n");
|
|
44
|
+
write(join(root, 'vite.config.ts'), "import { sveltekit } from '@sveltejs/kit/vite';\nimport { defineConfig } from 'vite';\n// Keep Better Auth on native async storage when the Bun adapter bundles the server.\nexport default defineConfig({plugins:[sveltekit()],ssr:{external:['bun:sqlite'],noExternal:['@better-auth/core']}});\n");
|
|
45
|
+
write(join(root, 'tsconfig.json'), JSON.stringify({
|
|
46
|
+
extends: './.svelte-kit/tsconfig.json',
|
|
47
|
+
compilerOptions: {
|
|
48
|
+
strict: true,
|
|
49
|
+
skipLibCheck: true,
|
|
50
|
+
types: ['bun'],
|
|
51
|
+
moduleResolution: 'bundler',
|
|
52
|
+
module: 'esnext'
|
|
53
|
+
}
|
|
54
|
+
}, null, 2));
|
|
55
|
+
write(join(root, 'src/app.html'), '<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/>%sveltekit.head%</head><body style="margin:0"><div style="display:contents">%sveltekit.body%</div></body></html>');
|
|
56
|
+
if (!existsSync(join(root, 'src/routes/+page.svelte')))
|
|
57
|
+
write(join(root, 'src/routes/+page.svelte'), '<h1>Your website is ready.</h1>\n<a href="/admin">Open SandCMS</a>\n');
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SetupOptions {
|
|
2
|
+
root: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
yes?: boolean;
|
|
6
|
+
package?: string;
|
|
7
|
+
skipInstall?: boolean;
|
|
8
|
+
email?: string;
|
|
9
|
+
database?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function setup(options: SetupOptions): Promise<void>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { existsSync, readFileSync, appendFileSync, chmodSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import * as p from '@clack/prompts';
|
|
4
|
+
import { parse as parseEnv } from 'dotenv';
|
|
5
|
+
import { planFiles, applyPlan, migrationReport, routeConflicts, write, PACKAGE_NAME, PACKAGE_VERSION } from './files.js';
|
|
6
|
+
import { answer, confirm, text, run } from './prompts.js';
|
|
7
|
+
import { configureWorker } from './cloudflare.js';
|
|
8
|
+
import { scaffold, assertFreshDirectory } from './scaffold.js';
|
|
9
|
+
import { openStore, pendingMigrations } from '../server/db/store.js';
|
|
10
|
+
import { createUser } from '../server/auth.js';
|
|
11
|
+
import { user } from '../server/db/schema.js';
|
|
12
|
+
export async function setup(options) {
|
|
13
|
+
const root = options.root, name = options.name ?? (options.yes ? 'My website' : await text('Project name'));
|
|
14
|
+
if (existsSync(join(root, 'package.json'))) {
|
|
15
|
+
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
|
|
16
|
+
if (!pkg.dependencies?.['@sveltejs/kit'] && !pkg.devDependencies?.['@sveltejs/kit'])
|
|
17
|
+
throw new Error('Existing project must be a compatible SvelteKit application');
|
|
18
|
+
}
|
|
19
|
+
const conflicts = routeConflicts(root);
|
|
20
|
+
if (conflicts.length)
|
|
21
|
+
throw new Error('Reserved CMS routes already exist:\n' +
|
|
22
|
+
conflicts.join('\n') +
|
|
23
|
+
'\nMove these routes before setup; no files were changed.');
|
|
24
|
+
const plan = planFiles(root, name), fresh = !existsSync(join(root, 'package.json'));
|
|
25
|
+
if (fresh)
|
|
26
|
+
assertFreshDirectory(root);
|
|
27
|
+
const notes = [
|
|
28
|
+
'Public website routes remain developer-owned.',
|
|
29
|
+
'Run sandcms user bootstrap against the production database after deployment.',
|
|
30
|
+
'Existing adapters are preserved. Configure svelte-adapter-bun as shown in docs/deployment.md.',
|
|
31
|
+
'Existing Vite configuration is preserved. Include @better-auth/core in ssr.noExternal to retain native async request storage in Bun production builds. See docs/deployment.md#server-build-configuration.',
|
|
32
|
+
'If .dockerignore is customized, merge the template exclusions before building: environment files, credentials, data/, and local Worker state must stay outside the image.'
|
|
33
|
+
];
|
|
34
|
+
const report = migrationReport(plan, notes);
|
|
35
|
+
console.log(report);
|
|
36
|
+
if (options.dryRun)
|
|
37
|
+
return;
|
|
38
|
+
if (fresh)
|
|
39
|
+
scaffold(root, name, options.package);
|
|
40
|
+
applyPlan(root, plan);
|
|
41
|
+
write(join(root, 'sandcms/setup-report.md'), report);
|
|
42
|
+
const ignore = join(root, '.gitignore');
|
|
43
|
+
const existingIgnore = existsSync(ignore) ? readFileSync(ignore, 'utf8') : '';
|
|
44
|
+
appendFileSync(ignore, '\n' +
|
|
45
|
+
[
|
|
46
|
+
'node_modules/',
|
|
47
|
+
'.svelte-kit/',
|
|
48
|
+
'build/',
|
|
49
|
+
'.env',
|
|
50
|
+
'.env.*',
|
|
51
|
+
'!.env.example',
|
|
52
|
+
'data/',
|
|
53
|
+
'.wrangler/',
|
|
54
|
+
'.dev.vars',
|
|
55
|
+
'.dev.vars.*'
|
|
56
|
+
]
|
|
57
|
+
.filter((s) => !existingIgnore.split('\n').includes(s))
|
|
58
|
+
.join('\n') +
|
|
59
|
+
'\n');
|
|
60
|
+
const env = join(root, '.env.local'), previous = existsSync(env) ? readFileSync(env, 'utf8') : '';
|
|
61
|
+
const previousSettings = parseEnv(previous);
|
|
62
|
+
const settings = {
|
|
63
|
+
BODY_SIZE_LIMIT: '101M',
|
|
64
|
+
SANDCMS_DATABASE: options.database ?? './data/sandcms.sqlite',
|
|
65
|
+
SANDCMS_ORIGIN: 'http://localhost:5410',
|
|
66
|
+
SANDCMS_SECRET: crypto.randomUUID() + crypto.randomUUID()
|
|
67
|
+
};
|
|
68
|
+
const additions = Object.entries(settings)
|
|
69
|
+
.filter(([key]) => !previousSettings[key])
|
|
70
|
+
.map(([key, v]) => `${key}=${v}`);
|
|
71
|
+
appendFileSync(env, '\n' + additions.join('\n') + '\n', { mode: 0o600 });
|
|
72
|
+
chmodSync(env, 0o600);
|
|
73
|
+
if (!options.skipInstall) {
|
|
74
|
+
if (fresh)
|
|
75
|
+
await run(['bun', 'install'], root);
|
|
76
|
+
else
|
|
77
|
+
await run(['bun', 'add', options.package ?? `${PACKAGE_NAME}@${PACKAGE_VERSION}`], root);
|
|
78
|
+
}
|
|
79
|
+
if (!options.yes) {
|
|
80
|
+
const addons = answer(await p.multiselect({
|
|
81
|
+
message: 'Optional website tools (admin does not require these)',
|
|
82
|
+
required: false,
|
|
83
|
+
options: ['tailwindcss', 'eslint', 'prettier', 'vitest', 'playwright'].map((value) => ({
|
|
84
|
+
value,
|
|
85
|
+
label: value
|
|
86
|
+
}))
|
|
87
|
+
}));
|
|
88
|
+
if (addons.length)
|
|
89
|
+
await run(['bun', 'x', 'sv@0.17.1', 'add', ...addons], root);
|
|
90
|
+
}
|
|
91
|
+
const dbPath = options.database ?? previousSettings.SANDCMS_DATABASE ?? settings.SANDCMS_DATABASE;
|
|
92
|
+
const target = resolve(root, dbPath);
|
|
93
|
+
console.log(`Local database target: ${target}`);
|
|
94
|
+
const store = openStore(target, { migrate: !existsSync(target) });
|
|
95
|
+
try {
|
|
96
|
+
if (pendingMigrations(store).length)
|
|
97
|
+
console.log('Database has pending migrations. Back it up, then run sandcms migrate before creating accounts.');
|
|
98
|
+
else if (!store.db.select().from(user).limit(1).get()) {
|
|
99
|
+
const email = options.email ??
|
|
100
|
+
(!options.yes
|
|
101
|
+
? answer(await p.text({ message: 'Initial local admin email (optional)' }))
|
|
102
|
+
: '');
|
|
103
|
+
if (email) {
|
|
104
|
+
const password = crypto.randomUUID() + 'A!';
|
|
105
|
+
await createUser(store, { email, name: 'Administrator', role: 'admin', password });
|
|
106
|
+
console.log(`Local bootstrap password (displayed once): ${password}\nThis does not create a production user.`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
store.close();
|
|
112
|
+
}
|
|
113
|
+
if (!options.yes && (await confirm('Configure and deploy Cloudflare media now?')))
|
|
114
|
+
await configureWorker(root, name);
|
|
115
|
+
console.log('Setup complete. Review sandcms/setup-report.md. Run bun run dev. In production: sandcms migrate, then sandcms user bootstrap against the mounted database.');
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function upgrade(root: string, check?: boolean, database?: string): Promise<string>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
3
|
+
import { createTwoFilesPatch } from 'diff';
|
|
4
|
+
import { planFiles, applyPlan, migrationReport, write, readManifest, routeConflicts } from './files.js';
|
|
5
|
+
import { confirm } from './prompts.js';
|
|
6
|
+
import { loadDefinition } from '../blueprints/load.js';
|
|
7
|
+
import { inspectMigrations } from '../server/db/store.js';
|
|
8
|
+
export async function upgrade(root, check = false, database) {
|
|
9
|
+
const definition = loadDefinition(join(root, 'sandcms')), manifest = readManifest(root), plan = planFiles(root, definition.config.name);
|
|
10
|
+
if (routeConflicts(root).length)
|
|
11
|
+
throw new Error('Unowned routes conflict with /admin or /api/cms. Move them before upgrading.');
|
|
12
|
+
const notes = [
|
|
13
|
+
`Installed integration: ${manifest.version}. Blueprints are valid.`,
|
|
14
|
+
'Include @better-auth/core in ssr.noExternal in your Vite configuration, then rebuild and restart the website to fix concurrent image preview failures. Developer-owned configuration is preserved. See docs/deployment.md#server-build-configuration.',
|
|
15
|
+
'From 0.5.0, database changes use incremental migrations. Back up with the installed package before updating, then run sandcms migrate. Changed pre-0.5.0 baselines still require a fresh database. See docs/upgrades.md.',
|
|
16
|
+
'Worker compatibility range: protocol 3. Deploy with sandcms worker update before upgrading website processes; expect temporary media downtime. Set media.uploadLimit to 100000000 and BODY_SIZE_LIMIT=101M to enable larger uploads; keep IMAGES for metadata inspection and verify remote transformations in staging. Purge old /media/* caches and keep R2 public access disabled. See docs/media.md.'
|
|
17
|
+
];
|
|
18
|
+
if (database)
|
|
19
|
+
notes.push('Pending DB migrations: ' +
|
|
20
|
+
(inspectMigrations(database)
|
|
21
|
+
.map((m) => m.name)
|
|
22
|
+
.join(', ') || 'none'));
|
|
23
|
+
const conflicts = plan.filter((p) => p.status === 'conflict'), accepted = new Set();
|
|
24
|
+
const diffs = conflicts.map((item) => createTwoFilesPatch(item.path, item.path + ' (proposed)', readFileSync(join(root, item.path), 'utf8'), item.content));
|
|
25
|
+
let cancelled;
|
|
26
|
+
if (!check)
|
|
27
|
+
try {
|
|
28
|
+
for (const [index, item] of conflicts.entries()) {
|
|
29
|
+
console.log(diffs[index]);
|
|
30
|
+
if (process.stdin.isTTY && (await confirm(`Replace customized ${item.path}?`)))
|
|
31
|
+
accepted.add(item.path);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
cancelled = e;
|
|
36
|
+
notes.push('Upgrade cancelled. No integration files were changed.');
|
|
37
|
+
}
|
|
38
|
+
const report = migrationReport(plan, notes.concat([...accepted].map((f) => 'Explicitly accepted replacement: ' + f))) + diffs.map((d) => '\n```diff\n' + d + '\n```\n').join('');
|
|
39
|
+
console.log(report);
|
|
40
|
+
if (check)
|
|
41
|
+
return report;
|
|
42
|
+
write(join(root, `sandcms-upgrade-${Date.now()}.md`), report);
|
|
43
|
+
if (cancelled)
|
|
44
|
+
throw cancelled;
|
|
45
|
+
applyPlan(root, plan, accepted);
|
|
46
|
+
return report;
|
|
47
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { Blueprint, FileBlueprint, Field, Json, Payload, SiteConfig, SiteDefinition } from './blueprints/types.js';
|
|
2
|
+
export { renderRichText } from './richtext.js';
|
|
3
|
+
export { imageSources, type PublicMedia, type PublicMediaVariant } from './media.js';
|
|
4
|
+
export { default as Image, type ImageProps } from './Image.svelte';
|
|
5
|
+
export { default as Seo, type SeoProps } from './Seo.svelte';
|
package/dist/index.js
ADDED
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Payload } from './blueprints/types.js';
|
|
2
|
+
import type { Variant } from './server/db/schema.js';
|
|
3
|
+
export interface PublicMediaVariant extends Variant {
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PublicMedia {
|
|
7
|
+
id: string;
|
|
8
|
+
blueprint?: string;
|
|
9
|
+
metadata?: Payload;
|
|
10
|
+
alt: string;
|
|
11
|
+
variants: PublicMediaVariant[];
|
|
12
|
+
photographer?: {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
} | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function imageSources(asset: PublicMedia | null | undefined, preset?: string): {
|
|
18
|
+
src: string;
|
|
19
|
+
alt: string;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
sources: {
|
|
23
|
+
type: string;
|
|
24
|
+
srcset: string;
|
|
25
|
+
}[];
|
|
26
|
+
} | null;
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function imageSources(asset, preset = 'card') {
|
|
2
|
+
if (!asset)
|
|
3
|
+
return null;
|
|
4
|
+
const variants = asset.variants
|
|
5
|
+
.filter((v) => v.format === 'svg' || v.preset === preset)
|
|
6
|
+
.sort((a, b) => a.width - b.width);
|
|
7
|
+
// Prefer modern encodings regardless of the order jobs completed in.
|
|
8
|
+
const formats = ['avif', 'webp', 'jpeg', 'svg'].filter((format) => variants.some((v) => v.format === format));
|
|
9
|
+
const sources = formats.map((format) => ({
|
|
10
|
+
type: format === 'svg' ? 'image/svg+xml' : `image/${format}`,
|
|
11
|
+
srcset: variants
|
|
12
|
+
.filter((v, i, all) => v.format === format &&
|
|
13
|
+
!all.slice(0, i).some((p) => p.format === format && p.width === v.width))
|
|
14
|
+
.map((v) => `${v.url} ${v.width}w`)
|
|
15
|
+
.join(', ')
|
|
16
|
+
}));
|
|
17
|
+
const fallback = variants.filter((v) => v.format === 'webp' || v.format === 'svg').at(-1) ?? variants.at(-1);
|
|
18
|
+
return fallback
|
|
19
|
+
? {
|
|
20
|
+
src: fallback.url,
|
|
21
|
+
alt: asset.alt,
|
|
22
|
+
width: fallback.width,
|
|
23
|
+
height: fallback.height,
|
|
24
|
+
sources
|
|
25
|
+
}
|
|
26
|
+
: null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Field, Payload, Json } from './blueprints/types.js';
|
|
2
|
+
/** Groups are expanded so selecting one field never includes unrelated nested answers. */
|
|
3
|
+
export declare function notificationFields(fields: Record<string, Field>, prefix?: string, label?: string): {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type: string;
|
|
7
|
+
}[];
|
|
8
|
+
export declare function notificationValue(data: Payload, path: string): Json | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Groups are expanded so selecting one field never includes unrelated nested answers. */
|
|
2
|
+
export function notificationFields(fields, prefix = '', label = '') {
|
|
3
|
+
return Object.entries(fields).flatMap(([key, field]) => {
|
|
4
|
+
const value = prefix + key, title = label + (field.label ?? key);
|
|
5
|
+
if (field.type === 'group')
|
|
6
|
+
return notificationFields(field.fields ?? {}, value + '.', title + ' / ');
|
|
7
|
+
// Repeated groups and rich content can contain additional unselected data.
|
|
8
|
+
if (['repeatable', 'richtext', 'gallery', 'media', 'media-list'].includes(field.type))
|
|
9
|
+
return [];
|
|
10
|
+
return [{ value, label: title, type: field.type }];
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function notificationValue(data, path) {
|
|
14
|
+
let value = data;
|
|
15
|
+
for (const key of path.split('.')) {
|
|
16
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || !Object.hasOwn(value, key))
|
|
17
|
+
return;
|
|
18
|
+
value = value[key];
|
|
19
|
+
}
|
|
20
|
+
// Never serialize an unexpected object from a formerly scalar field.
|
|
21
|
+
return value !== null && typeof value === 'object'
|
|
22
|
+
? Array.isArray(value) && value.every((v) => typeof v === 'string')
|
|
23
|
+
? value
|
|
24
|
+
: undefined
|
|
25
|
+
: value;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Json } from './blueprints/types.js';
|
|
2
|
+
export interface RichNode {
|
|
3
|
+
type: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
content?: RichNode[];
|
|
6
|
+
attrs?: Record<string, unknown>;
|
|
7
|
+
marks?: {
|
|
8
|
+
type: string;
|
|
9
|
+
attrs?: Record<string, unknown>;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export declare function safeHref(href: unknown): href is string;
|
|
13
|
+
export declare function validateRichText(value: Json): RichNode;
|
|
14
|
+
export declare function renderRichText(value: Json): string;
|