@fecommunity/reactpress 3.7.0 → 4.0.0-beta.1
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/bin/reactpress-cli-shim.js +2 -6
- package/bin/reactpress-theme-client.js +2 -0
- package/bin/reactpress.js +1 -380
- package/out/.source-fingerprint-cli +1 -0
- package/out/bin/reactpress-cli-shim.d.ts +3 -0
- package/out/bin/reactpress-cli-shim.d.ts.map +1 -0
- package/out/bin/reactpress-cli-shim.js +28 -0
- package/out/bin/reactpress-cli-shim.js.map +1 -0
- package/out/bin/reactpress-theme-client.d.ts +3 -0
- package/out/bin/reactpress-theme-client.d.ts.map +1 -0
- package/out/bin/reactpress-theme-client.js +113 -0
- package/out/bin/reactpress-theme-client.js.map +1 -0
- package/out/bin/reactpress.d.ts +3 -0
- package/out/bin/reactpress.d.ts.map +1 -0
- package/out/bin/reactpress.js +566 -0
- package/out/bin/reactpress.js.map +1 -0
- package/out/core/services/config.d.ts +12 -0
- package/out/core/services/config.d.ts.map +1 -0
- package/out/core/services/config.js +137 -0
- package/out/core/services/config.js.map +1 -0
- package/out/core/services/database/index.d.ts +17 -0
- package/out/core/services/database/index.d.ts.map +1 -0
- package/out/core/services/database/index.js +242 -0
- package/out/core/services/database/index.js.map +1 -0
- package/out/core/services/database/mysql.d.ts +14 -0
- package/out/core/services/database/mysql.d.ts.map +1 -0
- package/out/core/services/database/mysql.js +82 -0
- package/out/core/services/database/mysql.js.map +1 -0
- package/out/core/services/database/profile.d.ts +6 -0
- package/out/core/services/database/profile.d.ts.map +1 -0
- package/out/core/services/database/profile.js +60 -0
- package/out/core/services/database/profile.js.map +1 -0
- package/out/core/services/database/sqlite.d.ts +10 -0
- package/out/core/services/database/sqlite.d.ts.map +1 -0
- package/out/core/services/database/sqlite.js +73 -0
- package/out/core/services/database/sqlite.js.map +1 -0
- package/out/core/services/exec.d.ts +21 -0
- package/out/core/services/exec.d.ts.map +1 -0
- package/out/core/services/exec.js +56 -0
- package/out/core/services/exec.js.map +1 -0
- package/out/core/services/init.d.ts +11 -0
- package/out/core/services/init.d.ts.map +1 -0
- package/out/core/services/init.js +60 -0
- package/out/core/services/init.js.map +1 -0
- package/out/core/services/local-site.d.ts +24 -0
- package/out/core/services/local-site.d.ts.map +1 -0
- package/out/core/services/local-site.js +144 -0
- package/out/core/services/local-site.js.map +1 -0
- package/out/core/utils/cli-context.d.ts +3 -0
- package/out/core/utils/cli-context.d.ts.map +1 -0
- package/out/core/utils/cli-context.js +12 -0
- package/out/core/utils/cli-context.js.map +1 -0
- package/out/core/utils/paths.d.ts +20 -0
- package/out/core/utils/paths.d.ts.map +1 -0
- package/out/core/utils/paths.js +34 -0
- package/out/core/utils/paths.js.map +1 -0
- package/out/core/utils/platform.d.ts +7 -0
- package/out/core/utils/platform.d.ts.map +1 -0
- package/out/core/utils/platform.js +28 -0
- package/out/core/utils/platform.js.map +1 -0
- package/out/core/utils/port.d.ts +4 -0
- package/out/core/utils/port.d.ts.map +1 -0
- package/out/core/utils/port.js +32 -0
- package/out/core/utils/port.js.map +1 -0
- package/out/lib/api-dev-runner.d.ts +3 -0
- package/out/lib/api-dev-runner.d.ts.map +1 -0
- package/{lib → out/lib}/api-dev-runner.js +4 -1
- package/out/lib/api-dev-runner.js.map +1 -0
- package/out/lib/api-dev.d.ts +2 -0
- package/out/lib/api-dev.d.ts.map +1 -0
- package/out/lib/api-dev.js +101 -0
- package/out/lib/api-dev.js.map +1 -0
- package/out/lib/bootstrap.d.ts +18 -0
- package/out/lib/bootstrap.d.ts.map +1 -0
- package/out/lib/bootstrap.js +93 -0
- package/out/lib/bootstrap.js.map +1 -0
- package/out/lib/build.d.ts +2 -0
- package/out/lib/build.d.ts.map +1 -0
- package/out/lib/build.js +191 -0
- package/out/lib/build.js.map +1 -0
- package/out/lib/db-backup.d.ts +2 -0
- package/out/lib/db-backup.d.ts.map +1 -0
- package/out/lib/db-backup.js +68 -0
- package/out/lib/db-backup.js.map +1 -0
- package/out/lib/dev-banner.d.ts +2 -0
- package/out/lib/dev-banner.d.ts.map +1 -0
- package/out/lib/dev-banner.js +102 -0
- package/out/lib/dev-banner.js.map +1 -0
- package/out/lib/dev-child-io.d.ts +2 -0
- package/out/lib/dev-child-io.d.ts.map +1 -0
- package/out/lib/dev-child-io.js +80 -0
- package/out/lib/dev-child-io.js.map +1 -0
- package/out/lib/dev-log.d.ts +2 -0
- package/out/lib/dev-log.d.ts.map +1 -0
- package/out/lib/dev-log.js +64 -0
- package/out/lib/dev-log.js.map +1 -0
- package/out/lib/dev-session.d.ts +2 -0
- package/out/lib/dev-session.d.ts.map +1 -0
- package/out/lib/dev-session.js +95 -0
- package/out/lib/dev-session.js.map +1 -0
- package/out/lib/dev.d.ts +2 -0
- package/out/lib/dev.d.ts.map +1 -0
- package/out/lib/dev.js +914 -0
- package/out/lib/dev.js.map +1 -0
- package/out/lib/docker.d.ts +2 -0
- package/out/lib/docker.d.ts.map +1 -0
- package/out/lib/docker.js +398 -0
- package/out/lib/docker.js.map +1 -0
- package/out/lib/doctor.d.ts +2 -0
- package/out/lib/doctor.d.ts.map +1 -0
- package/out/lib/doctor.js +260 -0
- package/out/lib/doctor.js.map +1 -0
- package/out/lib/health-parse.d.ts +5 -0
- package/out/lib/health-parse.d.ts.map +1 -0
- package/out/lib/health-parse.js +36 -0
- package/out/lib/health-parse.js.map +1 -0
- package/out/lib/health-parse.test.d.ts +2 -0
- package/out/lib/health-parse.test.d.ts.map +1 -0
- package/out/lib/health-parse.test.js +19 -0
- package/out/lib/health-parse.test.js.map +1 -0
- package/out/lib/http.d.ts +2 -0
- package/out/lib/http.d.ts.map +1 -0
- package/out/lib/http.js +234 -0
- package/out/lib/http.js.map +1 -0
- package/out/lib/i18n/index.d.ts +2 -0
- package/out/lib/i18n/index.d.ts.map +1 -0
- package/out/lib/i18n/index.js +29 -0
- package/out/lib/i18n/index.js.map +1 -0
- package/out/lib/i18n/strings.d.ts +2 -0
- package/out/lib/i18n/strings.d.ts.map +1 -0
- package/out/lib/i18n/strings.js +1192 -0
- package/out/lib/i18n/strings.js.map +1 -0
- package/out/lib/lifecycle.d.ts +2 -0
- package/out/lib/lifecycle.d.ts.map +1 -0
- package/out/lib/lifecycle.js +169 -0
- package/out/lib/lifecycle.js.map +1 -0
- package/out/lib/nginx.d.ts +2 -0
- package/out/lib/nginx.d.ts.map +1 -0
- package/out/lib/nginx.js +618 -0
- package/out/lib/nginx.js.map +1 -0
- package/out/lib/paths.d.ts +2 -0
- package/out/lib/paths.d.ts.map +1 -0
- package/out/lib/paths.js +106 -0
- package/out/lib/paths.js.map +1 -0
- package/out/lib/plugin-build.d.ts +2 -0
- package/out/lib/plugin-build.d.ts.map +1 -0
- package/out/lib/plugin-build.js +104 -0
- package/out/lib/plugin-build.js.map +1 -0
- package/out/lib/plugin-cli.d.ts +2 -0
- package/out/lib/plugin-cli.d.ts.map +1 -0
- package/out/lib/plugin-cli.js +142 -0
- package/out/lib/plugin-cli.js.map +1 -0
- package/out/lib/pm2.d.ts +2 -0
- package/out/lib/pm2.d.ts.map +1 -0
- package/out/lib/pm2.js +32 -0
- package/out/lib/pm2.js.map +1 -0
- package/out/lib/ports.d.ts +2 -0
- package/out/lib/ports.d.ts.map +1 -0
- package/out/lib/ports.js +394 -0
- package/out/lib/ports.js.map +1 -0
- package/out/lib/process.d.ts +2 -0
- package/out/lib/process.d.ts.map +1 -0
- package/out/lib/process.js +47 -0
- package/out/lib/process.js.map +1 -0
- package/out/lib/prod-memory.d.ts +6 -0
- package/out/lib/prod-memory.d.ts.map +1 -0
- package/out/lib/prod-memory.js +57 -0
- package/out/lib/prod-memory.js.map +1 -0
- package/out/lib/project-type.d.ts +2 -0
- package/out/lib/project-type.d.ts.map +1 -0
- package/out/lib/project-type.js +95 -0
- package/out/lib/project-type.js.map +1 -0
- package/out/lib/publish.d.ts +3 -0
- package/out/lib/publish.d.ts.map +1 -0
- package/out/lib/publish.js +388 -0
- package/out/lib/publish.js.map +1 -0
- package/out/lib/remote-dev.d.ts +2 -0
- package/out/lib/remote-dev.d.ts.map +1 -0
- package/out/lib/remote-dev.js +158 -0
- package/out/lib/remote-dev.js.map +1 -0
- package/out/lib/root.d.ts +2 -0
- package/out/lib/root.d.ts.map +1 -0
- package/out/lib/root.js +85 -0
- package/out/lib/root.js.map +1 -0
- package/out/lib/spawn.d.ts +2 -0
- package/out/lib/spawn.d.ts.map +1 -0
- package/out/lib/spawn.js +96 -0
- package/out/lib/spawn.js.map +1 -0
- package/out/lib/status.d.ts +2 -0
- package/out/lib/status.d.ts.map +1 -0
- package/out/lib/status.js +78 -0
- package/out/lib/status.js.map +1 -0
- package/out/lib/theme-catalog.d.ts +2 -0
- package/out/lib/theme-catalog.d.ts.map +1 -0
- package/out/lib/theme-catalog.js +6 -0
- package/out/lib/theme-catalog.js.map +1 -0
- package/out/lib/theme-cli.d.ts +2 -0
- package/out/lib/theme-cli.d.ts.map +1 -0
- package/out/lib/theme-cli.js +50 -0
- package/out/lib/theme-cli.js.map +1 -0
- package/out/lib/theme-dev.d.ts +2 -0
- package/out/lib/theme-dev.d.ts.map +1 -0
- package/out/lib/theme-dev.js +759 -0
- package/out/lib/theme-dev.js.map +1 -0
- package/out/lib/theme-env.d.ts +2 -0
- package/out/lib/theme-env.d.ts.map +1 -0
- package/out/lib/theme-env.js +101 -0
- package/out/lib/theme-env.js.map +1 -0
- package/out/lib/theme-install.d.ts +2 -0
- package/out/lib/theme-install.d.ts.map +1 -0
- package/out/lib/theme-install.js +363 -0
- package/out/lib/theme-install.js.map +1 -0
- package/out/lib/theme-lock.d.ts +2 -0
- package/out/lib/theme-lock.d.ts.map +1 -0
- package/out/lib/theme-lock.js +70 -0
- package/out/lib/theme-lock.js.map +1 -0
- package/out/lib/theme-paths.d.ts +2 -0
- package/out/lib/theme-paths.d.ts.map +1 -0
- package/out/lib/theme-paths.js +73 -0
- package/out/lib/theme-paths.js.map +1 -0
- package/out/lib/theme-placeholder-cover.d.ts +13 -0
- package/out/lib/theme-placeholder-cover.d.ts.map +1 -0
- package/out/lib/theme-placeholder-cover.js +95 -0
- package/out/lib/theme-placeholder-cover.js.map +1 -0
- package/out/lib/theme-preview-frame.d.ts +2 -0
- package/out/lib/theme-preview-frame.d.ts.map +1 -0
- package/out/lib/theme-preview-frame.js +107 -0
- package/out/lib/theme-preview-frame.js.map +1 -0
- package/out/lib/theme-preview-pool.d.ts +2 -0
- package/out/lib/theme-preview-pool.d.ts.map +1 -0
- package/out/lib/theme-preview-pool.js +484 -0
- package/out/lib/theme-preview-pool.js.map +1 -0
- package/out/lib/theme-preview-proxy.d.ts +2 -0
- package/out/lib/theme-preview-proxy.d.ts.map +1 -0
- package/out/lib/theme-preview-proxy.js +101 -0
- package/out/lib/theme-preview-proxy.js.map +1 -0
- package/out/lib/theme-prod.d.ts +2 -0
- package/out/lib/theme-prod.d.ts.map +1 -0
- package/out/lib/theme-prod.js +400 -0
- package/out/lib/theme-prod.js.map +1 -0
- package/out/lib/theme-registry.d.ts +2 -0
- package/out/lib/theme-registry.d.ts.map +1 -0
- package/out/lib/theme-registry.js +135 -0
- package/out/lib/theme-registry.js.map +1 -0
- package/out/lib/theme-runtime.d.ts +2 -0
- package/out/lib/theme-runtime.d.ts.map +1 -0
- package/out/lib/theme-runtime.js +344 -0
- package/out/lib/theme-runtime.js.map +1 -0
- package/out/lib/theme-sources.d.ts +2 -0
- package/out/lib/theme-sources.d.ts.map +1 -0
- package/out/lib/theme-sources.js +347 -0
- package/out/lib/theme-sources.js.map +1 -0
- package/out/lib/theme-warmup.d.ts +2 -0
- package/out/lib/theme-warmup.d.ts.map +1 -0
- package/out/lib/theme-warmup.js +167 -0
- package/out/lib/theme-warmup.js.map +1 -0
- package/out/lib/toolkit-build.d.ts +2 -0
- package/out/lib/toolkit-build.d.ts.map +1 -0
- package/out/lib/toolkit-build.js +57 -0
- package/out/lib/toolkit-build.js.map +1 -0
- package/out/types/config.d.ts +57 -0
- package/out/types/config.d.ts.map +1 -0
- package/out/types/config.js +3 -0
- package/out/types/config.js.map +1 -0
- package/out/ui/banner.d.ts +2 -0
- package/out/ui/banner.d.ts.map +1 -0
- package/out/ui/banner.js +358 -0
- package/out/ui/banner.js.map +1 -0
- package/out/ui/interactive.d.ts +2 -0
- package/out/ui/interactive.d.ts.map +1 -0
- package/out/ui/interactive.js +378 -0
- package/out/ui/interactive.js.map +1 -0
- package/out/ui/prompts.d.ts +2 -0
- package/out/ui/prompts.d.ts.map +1 -0
- package/out/ui/prompts.js +91 -0
- package/out/ui/prompts.js.map +1 -0
- package/out/ui/theme.d.ts +2 -0
- package/out/ui/theme.d.ts.map +1 -0
- package/out/ui/theme.js +250 -0
- package/out/ui/theme.js.map +1 -0
- package/package.json +13 -7
- package/server/dist/common/api-messages.d.ts +9 -0
- package/server/dist/common/api-messages.js +9 -0
- package/server/dist/common/api-messages.js.map +1 -1
- package/server/dist/database/typeorm-options.d.ts +3 -0
- package/server/dist/database/typeorm-options.js +60 -0
- package/server/dist/database/typeorm-options.js.map +1 -0
- package/server/dist/modules/api-key/api-key.controller.js.map +1 -1
- package/server/dist/modules/api-key/api-key.entity.js.map +1 -1
- package/server/dist/modules/api-key/api-key.guard.js +2 -3
- package/server/dist/modules/api-key/api-key.guard.js.map +1 -1
- package/server/dist/modules/api-key/api-key.module.js.map +1 -1
- package/server/dist/modules/api-key/api-key.service.js +1 -1
- package/server/dist/modules/api-key/api-key.service.js.map +1 -1
- package/server/dist/modules/article/article-revision.entity.js +3 -3
- package/server/dist/modules/article/article-revision.entity.js.map +1 -1
- package/server/dist/modules/article/article-slug.util.d.ts +2 -0
- package/server/dist/modules/article/article-slug.util.js +19 -0
- package/server/dist/modules/article/article-slug.util.js.map +1 -0
- package/server/dist/modules/article/scheduled-publish.service.js.map +1 -1
- package/server/dist/modules/bootstrap/bootstrap.constants.d.ts +20 -0
- package/server/dist/modules/bootstrap/bootstrap.constants.js +171 -0
- package/server/dist/modules/bootstrap/bootstrap.constants.js.map +1 -0
- package/server/dist/modules/bootstrap/bootstrap.service.d.ts +22 -0
- package/server/dist/modules/bootstrap/bootstrap.service.js +183 -0
- package/server/dist/modules/bootstrap/bootstrap.service.js.map +1 -0
- package/server/dist/modules/bootstrap/install-locale.d.ts +2 -0
- package/server/dist/modules/bootstrap/install-locale.js +11 -0
- package/server/dist/modules/bootstrap/install-locale.js.map +1 -0
- package/server/dist/modules/extension/extension.module.d.ts +9 -0
- package/server/dist/modules/extension/extension.module.js +50 -0
- package/server/dist/modules/extension/extension.module.js.map +1 -0
- package/server/dist/modules/extension/plugin-loader.service.d.ts +12 -0
- package/server/dist/modules/extension/plugin-loader.service.js +96 -0
- package/server/dist/modules/extension/plugin-loader.service.js.map +1 -0
- package/server/dist/modules/extension/plugin-registry.bridge.d.ts +3 -0
- package/server/dist/modules/extension/plugin-registry.bridge.js +44 -0
- package/server/dist/modules/extension/plugin-registry.bridge.js.map +1 -0
- package/server/dist/modules/extension/plugin.controller.d.ts +22 -0
- package/server/dist/modules/extension/plugin.controller.js +155 -0
- package/server/dist/modules/extension/plugin.controller.js.map +1 -0
- package/server/dist/modules/extension/plugin.service.d.ts +52 -0
- package/server/dist/modules/extension/plugin.service.js +391 -0
- package/server/dist/modules/extension/plugin.service.js.map +1 -0
- package/server/dist/modules/extension/preview-draft.store.d.ts +13 -0
- package/server/dist/modules/extension/preview-draft.store.js +41 -0
- package/server/dist/modules/extension/preview-draft.store.js.map +1 -0
- package/server/dist/modules/extension/theme-registry.bridge.d.ts +56 -0
- package/server/dist/modules/extension/theme-registry.bridge.js +46 -0
- package/server/dist/modules/extension/theme-registry.bridge.js.map +1 -0
- package/server/dist/modules/extension/theme.controller.d.ts +66 -0
- package/server/dist/modules/extension/theme.controller.js +301 -0
- package/server/dist/modules/extension/theme.controller.js.map +1 -0
- package/server/dist/modules/extension/theme.service.d.ts +140 -0
- package/server/dist/modules/extension/theme.service.js +1039 -0
- package/server/dist/modules/extension/theme.service.js.map +1 -0
- package/server/dist/modules/file/file-optimization.controller.d.ts +12 -0
- package/server/dist/modules/file/file-optimization.controller.js +79 -0
- package/server/dist/modules/file/file-optimization.controller.js.map +1 -0
- package/server/dist/modules/file/file-optimization.service.d.ts +36 -0
- package/server/dist/modules/file/file-optimization.service.js +385 -0
- package/server/dist/modules/file/file-optimization.service.js.map +1 -0
- package/server/dist/modules/file/file-optimization.types.d.ts +66 -0
- package/server/dist/modules/file/file-optimization.types.js +5 -0
- package/server/dist/modules/file/file-optimization.types.js.map +1 -0
- package/server/dist/modules/file/image-optimizer-plugin.guard.d.ts +7 -0
- package/server/dist/modules/file/image-optimizer-plugin.guard.js +33 -0
- package/server/dist/modules/file/image-optimizer-plugin.guard.js.map +1 -0
- package/server/dist/modules/health/health.controller.js +2 -4
- package/server/dist/modules/health/health.controller.js.map +1 -1
- package/server/dist/modules/health/health.module.js.map +1 -1
- package/server/dist/modules/hook/hook.module.d.ts +2 -0
- package/server/dist/modules/hook/hook.module.js +22 -0
- package/server/dist/modules/hook/hook.module.js.map +1 -0
- package/server/dist/modules/hook/hook.service.d.ts +26 -0
- package/server/dist/modules/hook/hook.service.js +105 -0
- package/server/dist/modules/hook/hook.service.js.map +1 -0
- package/server/dist/modules/webhook/webhook.controller.js.map +1 -1
- package/server/dist/modules/webhook/webhook.entity.js.map +1 -1
- package/server/dist/modules/webhook/webhook.module.js.map +1 -1
- package/server/dist/modules/webhook/webhook.service.d.ts +1 -1
- package/server/dist/modules/webhook/webhook.service.js +5 -2
- package/server/dist/modules/webhook/webhook.service.js.map +1 -1
- package/server/dist/node-polyfills.d.ts +18 -0
- package/server/dist/node-polyfills.js +24 -0
- package/server/dist/node-polyfills.js.map +1 -0
- package/server/dist/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
- package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
- package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
- package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
- package/server/dist/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
- package/server/dist/tsconfig.tsbuildinfo +1 -0
- package/server/dist/utils/image-processor.util.d.ts +23 -0
- package/server/dist/utils/image-processor.util.js +88 -0
- package/server/dist/utils/image-processor.util.js.map +1 -0
- package/server/dist/utils/local-api-quiet.util.d.ts +1 -0
- package/server/dist/utils/local-api-quiet.util.js +8 -0
- package/server/dist/utils/local-api-quiet.util.js.map +1 -0
- package/server/dist/utils/project-root.util.d.ts +2 -0
- package/server/dist/utils/project-root.util.js +42 -0
- package/server/dist/utils/project-root.util.js.map +1 -0
- package/server/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
- package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
- package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
- package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
- package/server/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
- package/templates/config.local.json +13 -0
- package/templates/env.local.default +10 -0
- package/templates/theme-catalog.json +27 -0
- package/lib/api-dev.js +0 -89
- package/lib/bootstrap.js +0 -114
- package/lib/build.js +0 -162
- package/lib/db-backup.js +0 -67
- package/lib/dev-banner.js +0 -72
- package/lib/dev.js +0 -141
- package/lib/docker.js +0 -275
- package/lib/doctor.js +0 -266
- package/lib/http.js +0 -182
- package/lib/i18n/index.js +0 -32
- package/lib/i18n/strings.js +0 -846
- package/lib/lifecycle.js +0 -190
- package/lib/nginx.js +0 -342
- package/lib/paths.js +0 -108
- package/lib/pm2.js +0 -32
- package/lib/process.js +0 -45
- package/lib/project-type.js +0 -72
- package/lib/publish.js +0 -968
- package/lib/root.js +0 -88
- package/lib/spawn.js +0 -92
- package/lib/status.js +0 -132
- package/ui/banner.js +0 -441
- package/ui/interactive.js +0 -380
- package/ui/theme.js +0 -265
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export type ImageVariant = 'large' | 'medium' | 'thumb' | 'avatar';
|
|
3
|
+
export type ImageScene = 'default' | 'content' | 'cover' | 'avatar';
|
|
4
|
+
export interface ProcessedImageVariant {
|
|
5
|
+
buffer: Buffer;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
size: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ImageVariantMeta {
|
|
11
|
+
url: string;
|
|
12
|
+
filename: string;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
size: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function isProcessableImage(mimetype: string): boolean;
|
|
18
|
+
export declare function variantsForScene(scene: ImageScene): ImageVariant[];
|
|
19
|
+
export declare function primaryVariantForScene(scene: ImageScene): ImageVariant;
|
|
20
|
+
export declare function buildVariantFilename(baseFilename: string, variant: ImageVariant): string;
|
|
21
|
+
export declare function listVariantFilenames(baseFilename: string): string[];
|
|
22
|
+
export declare function processImageBuffer(buffer: Buffer, variant: ImageVariant): Promise<ProcessedImageVariant>;
|
|
23
|
+
export declare function processImageVariants(buffer: Buffer, variants: ImageVariant[]): Promise<Map<ImageVariant, ProcessedImageVariant>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processImageVariants = exports.processImageBuffer = exports.listVariantFilenames = exports.buildVariantFilename = exports.primaryVariantForScene = exports.variantsForScene = exports.isProcessableImage = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const sharp = require("sharp");
|
|
6
|
+
const PROCESSABLE_MIMETYPES = new Set(['image/jpeg', 'image/jpg', 'image/png', 'image/webp', 'image/gif']);
|
|
7
|
+
const IMAGE_VARIANT_CONFIG = {
|
|
8
|
+
large: { maxWidth: 1920, quality: 82, fit: 'inside' },
|
|
9
|
+
medium: { maxWidth: 1200, quality: 80, fit: 'inside' },
|
|
10
|
+
thumb: { maxWidth: 400, quality: 75, fit: 'inside' },
|
|
11
|
+
avatar: { maxWidth: 256, maxHeight: 256, quality: 80, fit: 'cover' },
|
|
12
|
+
};
|
|
13
|
+
function isProcessableImage(mimetype) {
|
|
14
|
+
return PROCESSABLE_MIMETYPES.has(String(mimetype || '').toLowerCase());
|
|
15
|
+
}
|
|
16
|
+
exports.isProcessableImage = isProcessableImage;
|
|
17
|
+
function variantsForScene(scene) {
|
|
18
|
+
switch (scene) {
|
|
19
|
+
case 'avatar':
|
|
20
|
+
return ['avatar'];
|
|
21
|
+
case 'content':
|
|
22
|
+
return ['large', 'medium', 'thumb'];
|
|
23
|
+
case 'cover':
|
|
24
|
+
return ['large', 'medium', 'thumb'];
|
|
25
|
+
default:
|
|
26
|
+
return ['large', 'medium', 'thumb'];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.variantsForScene = variantsForScene;
|
|
30
|
+
function primaryVariantForScene(scene) {
|
|
31
|
+
switch (scene) {
|
|
32
|
+
case 'avatar':
|
|
33
|
+
return 'avatar';
|
|
34
|
+
case 'content':
|
|
35
|
+
return 'medium';
|
|
36
|
+
case 'cover':
|
|
37
|
+
return 'large';
|
|
38
|
+
default:
|
|
39
|
+
return 'large';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.primaryVariantForScene = primaryVariantForScene;
|
|
43
|
+
function buildVariantFilename(baseFilename, variant) {
|
|
44
|
+
const parsed = path.parse(baseFilename);
|
|
45
|
+
const baseName = parsed.name.replace(/_(medium|thumb|avatar)$/i, '');
|
|
46
|
+
if (variant === 'large') {
|
|
47
|
+
return path.join(parsed.dir, `${baseName}.webp`);
|
|
48
|
+
}
|
|
49
|
+
return path.join(parsed.dir, `${baseName}_${variant}.webp`);
|
|
50
|
+
}
|
|
51
|
+
exports.buildVariantFilename = buildVariantFilename;
|
|
52
|
+
function listVariantFilenames(baseFilename) {
|
|
53
|
+
return ['large', 'medium', 'thumb', 'avatar'].map((variant) => buildVariantFilename(baseFilename, variant));
|
|
54
|
+
}
|
|
55
|
+
exports.listVariantFilenames = listVariantFilenames;
|
|
56
|
+
async function processImageBuffer(buffer, variant) {
|
|
57
|
+
const config = IMAGE_VARIANT_CONFIG[variant];
|
|
58
|
+
let pipeline = sharp(buffer, { animated: false }).rotate();
|
|
59
|
+
if (config.fit === 'cover' && config.maxHeight) {
|
|
60
|
+
pipeline = pipeline.resize(config.maxWidth, config.maxHeight, {
|
|
61
|
+
fit: 'cover',
|
|
62
|
+
position: 'centre',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
pipeline = pipeline.resize(config.maxWidth, undefined, {
|
|
67
|
+
fit: 'inside',
|
|
68
|
+
withoutEnlargement: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const output = await pipeline.webp({ quality: config.quality, effort: 4 }).toBuffer({ resolveWithObject: true });
|
|
72
|
+
return {
|
|
73
|
+
buffer: output.data,
|
|
74
|
+
width: output.info.width,
|
|
75
|
+
height: output.info.height,
|
|
76
|
+
size: output.info.size,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
exports.processImageBuffer = processImageBuffer;
|
|
80
|
+
async function processImageVariants(buffer, variants) {
|
|
81
|
+
const results = new Map();
|
|
82
|
+
for (const variant of variants) {
|
|
83
|
+
results.set(variant, await processImageBuffer(buffer, variant));
|
|
84
|
+
}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
exports.processImageVariants = processImageVariants;
|
|
88
|
+
//# sourceMappingURL=image-processor.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-processor.util.js","sourceRoot":"","sources":["../../src/utils/image-processor.util.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isLocalApiQuiet(): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLocalApiQuiet = void 0;
|
|
4
|
+
function isLocalApiQuiet() {
|
|
5
|
+
return process.env.REACTPRESS_LOCAL_API_QUIET === '1';
|
|
6
|
+
}
|
|
7
|
+
exports.isLocalApiQuiet = isLocalApiQuiet;
|
|
8
|
+
//# sourceMappingURL=local-api-quiet.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-api-quiet.util.js","sourceRoot":"","sources":["../../src/utils/local-api-quiet.util.ts"],"names":[],"mappings":";;;AACA,SAAgB,eAAe;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,GAAG,CAAC;AACxD,CAAC;AAFD,0CAEC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveMonorepoRoot = exports.resolveProjectRoot = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
function resolveProjectRoot() {
|
|
7
|
+
if (process.env.REACTPRESS_ORIGINAL_CWD) {
|
|
8
|
+
return process.env.REACTPRESS_ORIGINAL_CWD;
|
|
9
|
+
}
|
|
10
|
+
let dir = process.cwd();
|
|
11
|
+
for (let depth = 0; depth < 8; depth += 1) {
|
|
12
|
+
if (fs.existsSync(path.join(dir, 'themes'))) {
|
|
13
|
+
process.env.REACTPRESS_ORIGINAL_CWD = dir;
|
|
14
|
+
return dir;
|
|
15
|
+
}
|
|
16
|
+
const parent = path.dirname(dir);
|
|
17
|
+
if (parent === dir)
|
|
18
|
+
break;
|
|
19
|
+
dir = parent;
|
|
20
|
+
}
|
|
21
|
+
return process.cwd();
|
|
22
|
+
}
|
|
23
|
+
exports.resolveProjectRoot = resolveProjectRoot;
|
|
24
|
+
function resolveMonorepoRoot() {
|
|
25
|
+
if (process.env.REACTPRESS_MONOREPO_ROOT) {
|
|
26
|
+
return process.env.REACTPRESS_MONOREPO_ROOT;
|
|
27
|
+
}
|
|
28
|
+
let dir = process.cwd();
|
|
29
|
+
for (let depth = 0; depth < 10; depth += 1) {
|
|
30
|
+
if (fs.existsSync(path.join(dir, 'cli', 'out', 'lib', 'theme-registry.js'))) {
|
|
31
|
+
process.env.REACTPRESS_MONOREPO_ROOT = dir;
|
|
32
|
+
return dir;
|
|
33
|
+
}
|
|
34
|
+
const parent = path.dirname(dir);
|
|
35
|
+
if (parent === dir)
|
|
36
|
+
break;
|
|
37
|
+
dir = parent;
|
|
38
|
+
}
|
|
39
|
+
return process.cwd();
|
|
40
|
+
}
|
|
41
|
+
exports.resolveMonorepoRoot = resolveMonorepoRoot;
|
|
42
|
+
//# sourceMappingURL=project-root.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-root.util.js","sourceRoot":"","sources":["../../src/utils/project-root.util.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAG7B,SAAgB,kBAAkB;IAChC,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;QACvC,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;KAC5C;IAED,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE;QACzC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE;YAC3C,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,GAAG,CAAC;YAC1C,OAAO,GAAG,CAAC;SACZ;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;KACd;IAED,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;AACvB,CAAC;AAjBD,gDAiBC;AAGD,SAAgB,mBAAmB;IACjC,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE;QACxC,OAAO,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;KAC7C;IAED,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,EAAE;QAC1C,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE;YAC3E,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,GAAG,CAAC;YAC3C,OAAO,GAAG,CAAC;SACZ;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;KACd;IAED,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;AACvB,CAAC;AAjBD,kDAiBC"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# ReactPress — local SQLite mode (auto-generated)
|
|
2
|
+
DB_TYPE=sqlite
|
|
3
|
+
DB_DATABASE=data/reactpress.db
|
|
4
|
+
SERVER_PORT=3002
|
|
5
|
+
SERVER_SITE_URL=http://127.0.0.1:3002
|
|
6
|
+
CLIENT_SITE_URL=http://localhost:3001
|
|
7
|
+
SERVER_API_PREFIX=/api
|
|
8
|
+
REACTPRESS_UPLOAD_DIR=uploads
|
|
9
|
+
ADMIN_USER=admin
|
|
10
|
+
ADMIN_PASSWD=admin
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"themes": [
|
|
4
|
+
{
|
|
5
|
+
"id": "reactpress-theme-starter",
|
|
6
|
+
"name": "ReactPress Theme Starter",
|
|
7
|
+
"version": "1.0.0-beta.0",
|
|
8
|
+
"description": "官方 Next.js 15 主题 — Tailwind CSS、知识库、评论、深色模式,Lighthouse 95+。",
|
|
9
|
+
"author": "ReactPress",
|
|
10
|
+
"themeUri": "https://github.com/fecommunity/reactpress-theme-starter",
|
|
11
|
+
"previewUrl": "https://reactpress-theme-starter.vercel.app",
|
|
12
|
+
"tags": [
|
|
13
|
+
"官方",
|
|
14
|
+
"Tailwind",
|
|
15
|
+
"App Router",
|
|
16
|
+
"Next.js 15"
|
|
17
|
+
],
|
|
18
|
+
"dependency": {
|
|
19
|
+
"name": "@fecommunity/reactpress-theme-starter",
|
|
20
|
+
"version": "1.0.0-beta.0"
|
|
21
|
+
},
|
|
22
|
+
"npm": "@fecommunity/reactpress-theme-starter@1.0.0-beta.0",
|
|
23
|
+
"featured": true,
|
|
24
|
+
"requires": ">=3.0.0"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
package/lib/api-dev.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const { spawn } = require('child_process');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { ensureProjectEnvironment } = require('./bootstrap');
|
|
4
|
-
const {
|
|
5
|
-
getServerBin,
|
|
6
|
-
getServerDir,
|
|
7
|
-
isUsingMonorepoServer,
|
|
8
|
-
canStartLocalApi,
|
|
9
|
-
} = require('./paths');
|
|
10
|
-
const { stopApi } = require('./lifecycle');
|
|
11
|
-
const { ensureOriginalCwd } = require('./root');
|
|
12
|
-
const { t } = require('./i18n');
|
|
13
|
-
|
|
14
|
-
let apiChild;
|
|
15
|
-
|
|
16
|
-
function stopApiDev(projectRoot) {
|
|
17
|
-
if (apiChild && !apiChild.killed) {
|
|
18
|
-
apiChild.kill('SIGTERM');
|
|
19
|
-
}
|
|
20
|
-
if (!isUsingMonorepoServer(projectRoot)) {
|
|
21
|
-
stopApi(projectRoot);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function startApiDev(projectRoot) {
|
|
26
|
-
if (isUsingMonorepoServer(projectRoot)) {
|
|
27
|
-
console.log(t('apiDev.modeServer'));
|
|
28
|
-
apiChild = spawn('pnpm', ['run', '--dir', './server', 'dev'], {
|
|
29
|
-
cwd: projectRoot,
|
|
30
|
-
stdio: 'inherit',
|
|
31
|
-
shell: true,
|
|
32
|
-
env: {
|
|
33
|
-
...process.env,
|
|
34
|
-
REACTPRESS_ORIGINAL_CWD: projectRoot,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
} else if (canStartLocalApi(projectRoot)) {
|
|
38
|
-
console.log(t('apiDev.modeBundled'));
|
|
39
|
-
apiChild = spawn(process.execPath, [getServerBin(projectRoot)], {
|
|
40
|
-
cwd: getServerDir(projectRoot),
|
|
41
|
-
stdio: 'inherit',
|
|
42
|
-
env: {
|
|
43
|
-
...process.env,
|
|
44
|
-
REACTPRESS_ORIGINAL_CWD: projectRoot,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
console.error(t('lifecycle.noServerAvailable'));
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (apiChild) {
|
|
53
|
-
apiChild.on('close', (code) => {
|
|
54
|
-
process.exit(code ?? 0);
|
|
55
|
-
});
|
|
56
|
-
console.log(t('apiDev.ctrlCHint'));
|
|
57
|
-
console.log(t('apiDev.stopHint'));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function runApiDev(projectRoot = ensureOriginalCwd()) {
|
|
62
|
-
try {
|
|
63
|
-
await ensureProjectEnvironment(projectRoot);
|
|
64
|
-
} catch (err) {
|
|
65
|
-
console.error(t('dev.envFailed'), err.message || err);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
process.on('SIGINT', () => {
|
|
70
|
-
stopApiDev(projectRoot);
|
|
71
|
-
process.exit(0);
|
|
72
|
-
});
|
|
73
|
-
process.on('SIGTERM', () => {
|
|
74
|
-
stopApiDev(projectRoot);
|
|
75
|
-
process.exit(0);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
startApiDev(projectRoot);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function getApiDevScriptPath() {
|
|
82
|
-
return path.join(__dirname, 'api-dev-runner.js');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
module.exports = {
|
|
86
|
-
runApiDev,
|
|
87
|
-
stopApiDev,
|
|
88
|
-
getApiDevScriptPath,
|
|
89
|
-
};
|
package/lib/bootstrap.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { pathToFileURL } = require('url');
|
|
4
|
-
const { ensureOriginalCwd, isMonorepoCheckout } = require('./root');
|
|
5
|
-
const { getCliPackageRoot } = require('./paths');
|
|
6
|
-
const { t } = require('./i18n');
|
|
7
|
-
|
|
8
|
-
async function importCliModule(relativePath) {
|
|
9
|
-
const modulePath = path.join(getCliPackageRoot(), 'dist', relativePath);
|
|
10
|
-
return import(pathToFileURL(modulePath).href);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async function copyTemplateFile(src, dest) {
|
|
14
|
-
await fs.promises.mkdir(path.dirname(dest), { recursive: true });
|
|
15
|
-
await fs.promises.copyFile(src, dest);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function initMonorepoProject(projectRoot, { force = false } = {}) {
|
|
19
|
-
const { getProjectPaths, getTemplatesDir } = await importCliModule('utils/paths.js');
|
|
20
|
-
const { saveConfig, syncEnvFromConfig } = await importCliModule('services/config.js');
|
|
21
|
-
const { ensureDatabase, ensureDatabaseHostPort } = await importCliModule('services/database.js');
|
|
22
|
-
|
|
23
|
-
const paths = getProjectPaths(projectRoot);
|
|
24
|
-
const templatesDir = getTemplatesDir();
|
|
25
|
-
|
|
26
|
-
if (fs.existsSync(paths.configPath) && !force) {
|
|
27
|
-
const config = await (await importCliModule('services/config.js')).loadConfig(projectRoot);
|
|
28
|
-
await ensureDatabaseHostPort(projectRoot, undefined, config);
|
|
29
|
-
const dbResult = await ensureDatabase(projectRoot, config);
|
|
30
|
-
if (!dbResult.ok) {
|
|
31
|
-
return { ok: false, projectRoot, message: dbResult.message };
|
|
32
|
-
}
|
|
33
|
-
return { ok: true, projectRoot, message: t('bootstrap.configReady') };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
await fs.promises.mkdir(paths.reactpressDir, { recursive: true });
|
|
37
|
-
await copyTemplateFile(
|
|
38
|
-
path.join(templatesDir, 'docker-compose.yml'),
|
|
39
|
-
paths.dockerComposePath
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const config = JSON.parse(
|
|
43
|
-
await fs.promises.readFile(path.join(templatesDir, 'config.default.json'), 'utf8')
|
|
44
|
-
);
|
|
45
|
-
await saveConfig(projectRoot, config);
|
|
46
|
-
await syncEnvFromConfig(projectRoot, config);
|
|
47
|
-
|
|
48
|
-
if (!fs.existsSync(paths.envPath) || force) {
|
|
49
|
-
await copyTemplateFile(path.join(templatesDir, 'env.default'), paths.envPath);
|
|
50
|
-
await syncEnvFromConfig(projectRoot, config);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
await ensureDatabaseHostPort(projectRoot, undefined, config);
|
|
54
|
-
const dbResult = await ensureDatabase(projectRoot, config);
|
|
55
|
-
|
|
56
|
-
if (!dbResult.ok) {
|
|
57
|
-
return {
|
|
58
|
-
ok: true,
|
|
59
|
-
projectRoot,
|
|
60
|
-
message: t('bootstrap.projectDbPending', { message: dbResult.message }),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
ok: true,
|
|
66
|
-
projectRoot,
|
|
67
|
-
message: t('bootstrap.ready'),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async function ensureProjectEnvironment(projectRoot = ensureOriginalCwd()) {
|
|
72
|
-
const root = path.resolve(projectRoot);
|
|
73
|
-
const { setProjectCwd } = await importCliModule('utils/cli-context.js');
|
|
74
|
-
setProjectCwd(root);
|
|
75
|
-
|
|
76
|
-
const { isReactPressProject, loadConfig } = await importCliModule('services/config.js');
|
|
77
|
-
const { ensureDatabase, ensureDatabaseHostPort } = await importCliModule('services/database.js');
|
|
78
|
-
|
|
79
|
-
if (!(await isReactPressProject(root))) {
|
|
80
|
-
if (isMonorepoCheckout(root)) {
|
|
81
|
-
const result = await initMonorepoProject(root);
|
|
82
|
-
if (!result.ok) {
|
|
83
|
-
throw new Error(result.message || t('bootstrap.initFailed'));
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const { initProject } = await importCliModule('services/init.js');
|
|
89
|
-
const result = await initProject({ directory: root, force: false });
|
|
90
|
-
if (!result.ok) {
|
|
91
|
-
throw new Error(result.message || t('bootstrap.cliInitFailed'));
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const config = await loadConfig(root);
|
|
97
|
-
await ensureDatabaseHostPort(root, undefined, config);
|
|
98
|
-
const dbResult = await ensureDatabase(root, config);
|
|
99
|
-
if (!dbResult.ok) {
|
|
100
|
-
throw new Error(
|
|
101
|
-
t('bootstrap.dbNotReady', {
|
|
102
|
-
message: dbResult.message || t('bootstrap.dbPendingShort'),
|
|
103
|
-
})
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return { ok: true, projectRoot: root, message: t('bootstrap.dbReady') };
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
module.exports = {
|
|
111
|
-
ensureProjectEnvironment,
|
|
112
|
-
initMonorepoProject,
|
|
113
|
-
isMonorepoCheckout,
|
|
114
|
-
};
|
package/lib/build.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const ora = require('ora');
|
|
4
|
-
const { brand, icon, ok, warn, label, chip } = require('../ui/theme');
|
|
5
|
-
const { runSync } = require('./spawn');
|
|
6
|
-
const { ensureOriginalCwd } = require('./root');
|
|
7
|
-
const { t } = require('./i18n');
|
|
8
|
-
|
|
9
|
-
const FORBIDDEN_SCRIPTS = new Set(['build']);
|
|
10
|
-
|
|
11
|
-
/** @type {Record<string, { script: string, labelKey: string }[]>} */
|
|
12
|
-
const BUILD_STEPS = {
|
|
13
|
-
toolkit: [{ script: 'build:toolkit', labelKey: 'build.label.toolkit' }],
|
|
14
|
-
server: [{ script: 'build:server', labelKey: 'build.label.server' }],
|
|
15
|
-
client: [{ script: 'build:client', labelKey: 'build.label.client' }],
|
|
16
|
-
docs: [{ script: 'build:docs', labelKey: 'build.label.docs' }],
|
|
17
|
-
all: [
|
|
18
|
-
{ script: 'build:toolkit', labelKey: 'build.label.toolkit' },
|
|
19
|
-
{ script: 'build:server', labelKey: 'build.label.server' },
|
|
20
|
-
{ script: 'build:client', labelKey: 'build.label.client' },
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const TARGETS = Object.keys(BUILD_STEPS);
|
|
25
|
-
|
|
26
|
-
const buildChildEnv = { REACTPRESS_BUILD_ACTIVE: '1' };
|
|
27
|
-
|
|
28
|
-
function readPackageScripts(packageJsonPath) {
|
|
29
|
-
try {
|
|
30
|
-
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
31
|
-
return pkg.scripts || {};
|
|
32
|
-
} catch {
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Prefer workspace package scripts over root package.json aliases. */
|
|
38
|
-
function resolveBuildInvocation(script, projectRoot) {
|
|
39
|
-
const root = path.resolve(projectRoot);
|
|
40
|
-
|
|
41
|
-
if (script === 'build:toolkit') {
|
|
42
|
-
const toolkitDir = path.join(root, 'toolkit');
|
|
43
|
-
if (fs.existsSync(path.join(toolkitDir, 'package.json'))) {
|
|
44
|
-
return { command: 'pnpm', args: ['run', 'build'], cwd: toolkitDir };
|
|
45
|
-
}
|
|
46
|
-
const rootScripts = readPackageScripts(path.join(root, 'package.json'));
|
|
47
|
-
if (rootScripts['build:toolkit']) {
|
|
48
|
-
return { command: 'pnpm', args: ['run', 'build:toolkit'], cwd: root };
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (script === 'build:server') {
|
|
54
|
-
const serverDir = path.join(root, 'server');
|
|
55
|
-
if (fs.existsSync(path.join(serverDir, 'package.json'))) {
|
|
56
|
-
return { command: 'pnpm', args: ['run', 'build'], cwd: serverDir };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (script === 'build:client') {
|
|
61
|
-
const clientDir = path.join(root, 'client');
|
|
62
|
-
if (fs.existsSync(path.join(clientDir, 'package.json'))) {
|
|
63
|
-
return { command: 'pnpm', args: ['run', 'build'], cwd: clientDir };
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (script === 'build:docs') {
|
|
68
|
-
const docsDir = path.join(root, 'docs');
|
|
69
|
-
if (fs.existsSync(path.join(docsDir, 'package.json'))) {
|
|
70
|
-
return { command: 'pnpm', args: ['run', 'build'], cwd: docsDir };
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const rootScripts = readPackageScripts(path.join(root, 'package.json'));
|
|
75
|
-
if (rootScripts[script]) {
|
|
76
|
-
return { command: 'pnpm', args: ['run', script], cwd: root };
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function stepBadge(current, total) {
|
|
83
|
-
return chip(`${current}/${total}`, brand.primary);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async function runBuild(target = 'all', projectRoot = ensureOriginalCwd()) {
|
|
87
|
-
if (process.env.REACTPRESS_BUILD_ACTIVE === '1') {
|
|
88
|
-
throw new Error(t('build.recursive'));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const steps = BUILD_STEPS[target];
|
|
92
|
-
if (!steps) {
|
|
93
|
-
throw new Error(
|
|
94
|
-
t('build.unknownTarget', {
|
|
95
|
-
target,
|
|
96
|
-
available: TARGETS.join(', '),
|
|
97
|
-
})
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const total = steps.length;
|
|
102
|
-
const buildStarted = Date.now();
|
|
103
|
-
|
|
104
|
-
console.log('');
|
|
105
|
-
if (total > 1) {
|
|
106
|
-
console.log(label(t('build.plan', { total })));
|
|
107
|
-
console.log('');
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
for (let i = 0; i < steps.length; i++) {
|
|
111
|
-
const { script, labelKey } = steps[i];
|
|
112
|
-
if (FORBIDDEN_SCRIPTS.has(script)) {
|
|
113
|
-
throw new Error(t('build.forbiddenScript', { script }));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const current = i + 1;
|
|
117
|
-
const stepLabel = t(labelKey);
|
|
118
|
-
const stepStarted = Date.now();
|
|
119
|
-
const badge = stepBadge(current, total);
|
|
120
|
-
|
|
121
|
-
const invocation = resolveBuildInvocation(script, projectRoot);
|
|
122
|
-
if (!invocation) {
|
|
123
|
-
console.log(` ${badge} ${warn(t('build.stepSkipped', { label: stepLabel }))}`);
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const spinner = ora({
|
|
128
|
-
text: `${badge} ${t('build.step', { current, total, label: stepLabel })}`,
|
|
129
|
-
color: 'magenta',
|
|
130
|
-
spinner: 'dots',
|
|
131
|
-
}).start();
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
runSync(invocation.command, invocation.args, {
|
|
135
|
-
cwd: invocation.cwd,
|
|
136
|
-
env: buildChildEnv,
|
|
137
|
-
});
|
|
138
|
-
} catch (err) {
|
|
139
|
-
spinner.fail(`${badge} ${t('build.stepFailed', { current, total, label: stepLabel })}`);
|
|
140
|
-
throw err;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const seconds = ((Date.now() - stepStarted) / 1000).toFixed(1);
|
|
144
|
-
spinner.succeed(
|
|
145
|
-
`${badge} ${ok(t('build.stepDone', { current, total, label: stepLabel, seconds }))}`
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (total > 1) {
|
|
150
|
-
const totalSeconds = ((Date.now() - buildStarted) / 1000).toFixed(1);
|
|
151
|
-
console.log('');
|
|
152
|
-
console.log(` ${icon.spark} ${ok(t('build.done', { seconds: totalSeconds }))}`);
|
|
153
|
-
}
|
|
154
|
-
console.log('');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
module.exports = {
|
|
158
|
-
runBuild,
|
|
159
|
-
TARGETS,
|
|
160
|
-
BUILD_STEPS,
|
|
161
|
-
resolveBuildInvocation,
|
|
162
|
-
};
|