@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
package/out/lib/dev.js
ADDED
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
const { spawn, spawnSync } = require('child_process');
|
|
5
|
+
const { spawnDevChild } = require('./dev-child-io');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const ora = require('ora');
|
|
9
|
+
const { runBuild } = require('./build');
|
|
10
|
+
const { ensureProjectEnvironment } = require('./bootstrap');
|
|
11
|
+
const { loadWebAdminUrl, loadClientSiteUrl, loadServerSiteUrl, getHealthUrl, checkHealth, waitForHttp, } = require('./http');
|
|
12
|
+
const { printDevReadyBanner } = require('./dev-banner');
|
|
13
|
+
const { startDevNginx, stopDevNginx, nginxEntryUrl } = require('./nginx');
|
|
14
|
+
const { ensureOriginalCwd, isMonorepoCheckout } = require('./root');
|
|
15
|
+
const { detectProjectType, hasWeb, hasToolkit } = require('./project-type');
|
|
16
|
+
const { hasResolvableActiveTheme, hasThemePackages, readActiveThemeManifest, resolveThemeDirectory, } = require('./theme-runtime');
|
|
17
|
+
const { shouldBuildToolkit } = require('./toolkit-build');
|
|
18
|
+
const { buildLocalPlugins } = require('./plugin-build');
|
|
19
|
+
const { startThemeSiteWithWatch, stopThemeSite } = require('./theme-dev');
|
|
20
|
+
const { scheduleBackgroundThemeBuilds } = require('./theme-prod');
|
|
21
|
+
const { shouldBlockOnThemeWarmup, warmupThemeDevRoutes, warmupThemeDevRoutesInBackground, } = require('./theme-warmup');
|
|
22
|
+
const { DEV_PORTS, ensureApiPortFree, ensurePortFree, readEnvPort, isPortListening } = require('./ports');
|
|
23
|
+
const { ensureDevDatabase, probeMysqlHost } = require('./docker');
|
|
24
|
+
const { acquireDevSession, releaseDevSession } = require('./dev-session');
|
|
25
|
+
const { checkNodeVersion, checkDocker } = require('./doctor');
|
|
26
|
+
const { startDevTimer, markDevPhase, isDevVerbose, logDevLine, logDevDetail, logDevStatus, logDevTimingSummary, } = require('./dev-log');
|
|
27
|
+
const { t } = require('./i18n');
|
|
28
|
+
const { resolveRemoteThemeApiBase, readDevClientApiOrigin, normalizeRemoteOrigin, } = require('./remote-dev');
|
|
29
|
+
const CLIENT_READY_TIMEOUT_MS = 120_000;
|
|
30
|
+
const API_READY_TIMEOUT_MS = 180_000;
|
|
31
|
+
const DEV_POLL_MS = 250;
|
|
32
|
+
const DEV_POLL_FAST_MS = 150;
|
|
33
|
+
function shouldWaitForThemeInForeground() {
|
|
34
|
+
if (process.env.REACTPRESS_DESKTOP_LOCAL === '1')
|
|
35
|
+
return true;
|
|
36
|
+
return process.env.REACTPRESS_DEV_WAIT_THEME === '1';
|
|
37
|
+
}
|
|
38
|
+
function logDevPhase(step, total, messageKey, vars = {}) {
|
|
39
|
+
console.log('');
|
|
40
|
+
console.log(`[reactpress] [${step}/${total}] ${t(messageKey, vars)}`);
|
|
41
|
+
}
|
|
42
|
+
function isDesktopLocalMode() {
|
|
43
|
+
return process.env.REACTPRESS_DESKTOP_LOCAL === '1';
|
|
44
|
+
}
|
|
45
|
+
function isLocalSqliteMode() {
|
|
46
|
+
return process.env.REACTPRESS_LOCAL_MODE === '1' || isDesktopLocalMode();
|
|
47
|
+
}
|
|
48
|
+
function desktopPhaseKey(defaultKey) {
|
|
49
|
+
if (isLocalSqliteMode()) {
|
|
50
|
+
const localMap = {
|
|
51
|
+
'dev.phasePrerequisites': 'dev.phasePrerequisitesDesktop',
|
|
52
|
+
'dev.phaseInfra': 'dev.phaseInfraDesktop',
|
|
53
|
+
'dev.phaseServices': 'dev.phaseServicesLocalWeb',
|
|
54
|
+
};
|
|
55
|
+
if (localMap[defaultKey])
|
|
56
|
+
return localMap[defaultKey];
|
|
57
|
+
}
|
|
58
|
+
if (!isDesktopLocalMode())
|
|
59
|
+
return defaultKey;
|
|
60
|
+
const map = {
|
|
61
|
+
'dev.phasePrerequisites': 'dev.phasePrerequisitesDesktop',
|
|
62
|
+
'dev.phaseInfra': 'dev.phaseInfraDesktop',
|
|
63
|
+
'dev.phaseServices': 'dev.phaseServicesDesktop',
|
|
64
|
+
};
|
|
65
|
+
return map[defaultKey] || defaultKey;
|
|
66
|
+
}
|
|
67
|
+
function formatDevFailureHint() {
|
|
68
|
+
return [
|
|
69
|
+
t('dev.nextSteps'),
|
|
70
|
+
t('dev.nextDoctor'),
|
|
71
|
+
t('dev.nextDocker'),
|
|
72
|
+
t('dev.nextEnv'),
|
|
73
|
+
].join('\n');
|
|
74
|
+
}
|
|
75
|
+
let apiChild;
|
|
76
|
+
let webChild;
|
|
77
|
+
let desktopChild;
|
|
78
|
+
let shuttingDown = false;
|
|
79
|
+
let nginxEnabled = false;
|
|
80
|
+
/** When false, admin/API child exit during startup must not tear down the stack. */
|
|
81
|
+
let devServicesReady = false;
|
|
82
|
+
function shutdown(signal = 'SIGINT') {
|
|
83
|
+
if (shuttingDown)
|
|
84
|
+
return;
|
|
85
|
+
shuttingDown = true;
|
|
86
|
+
stopThemeSite();
|
|
87
|
+
if (nginxEnabled)
|
|
88
|
+
stopDevNginx(ensureOriginalCwd());
|
|
89
|
+
const stopEmbeddedApi = signal === 'SIGINT' || devServicesReady || !isDesktopLocalMode();
|
|
90
|
+
if (stopEmbeddedApi) {
|
|
91
|
+
try {
|
|
92
|
+
const { stopLocalServer } = require(path.join(ensureOriginalCwd(), 'desktop/out/main/local-server.js'));
|
|
93
|
+
stopLocalServer();
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// desktop local API not running
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (desktopChild && !desktopChild.killed)
|
|
100
|
+
desktopChild.kill(signal);
|
|
101
|
+
if (webChild && !webChild.killed)
|
|
102
|
+
webChild.kill(signal);
|
|
103
|
+
if (apiChild && !apiChild.killed)
|
|
104
|
+
apiChild.kill(signal);
|
|
105
|
+
try {
|
|
106
|
+
releaseDevSession(ensureOriginalCwd());
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// ignore
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function buildToolkit(projectRoot) {
|
|
113
|
+
if (!hasToolkit(projectRoot))
|
|
114
|
+
return;
|
|
115
|
+
if (!shouldBuildToolkit(projectRoot)) {
|
|
116
|
+
logDevDetail('dev.toolkitUpToDate');
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
await runBuild('toolkit', projectRoot);
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
buildLocalPlugins(projectRoot);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
console.error(`[reactpress] ${err.message || err}`);
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function spawnApi(projectRoot) {
|
|
130
|
+
const { reused, port: apiPort } = await ensureApiPortFree(projectRoot, { allowReuse: true });
|
|
131
|
+
if (reused) {
|
|
132
|
+
logDevStatus('dev.apiReusing', { port: apiPort });
|
|
133
|
+
return { reused: true, port: apiPort };
|
|
134
|
+
}
|
|
135
|
+
const apiDevRunner = path.join(__dirname, 'api-dev-runner.js');
|
|
136
|
+
logDevStatus('dev.startingApi');
|
|
137
|
+
apiChild = spawn(process.execPath, [apiDevRunner], {
|
|
138
|
+
stdio: 'inherit',
|
|
139
|
+
cwd: projectRoot,
|
|
140
|
+
env: {
|
|
141
|
+
...process.env,
|
|
142
|
+
REACTPRESS_ORIGINAL_CWD: projectRoot,
|
|
143
|
+
REACTPRESS_DEV_SESSION_PID: String(process.pid),
|
|
144
|
+
REACTPRESS_DEV_DB_READY: '1',
|
|
145
|
+
REACTPRESS_DEV_PORTS_READY: '1',
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
apiChild.on('close', (code) => {
|
|
149
|
+
if (shuttingDown) {
|
|
150
|
+
process.exit(code ?? 0);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (webChild && !webChild.killed)
|
|
154
|
+
webChild.kill('SIGINT');
|
|
155
|
+
process.exit(code ?? 1);
|
|
156
|
+
});
|
|
157
|
+
return { reused: false, port: apiPort };
|
|
158
|
+
}
|
|
159
|
+
async function waitForApiReady(projectRoot, { readyMessageKey = 'dev.apiReady', alreadyHealthy = false } = {}) {
|
|
160
|
+
const healthUrl = getHealthUrl(projectRoot);
|
|
161
|
+
const apiPort = readEnvPort(projectRoot, 'SERVER_PORT', DEV_PORTS.API);
|
|
162
|
+
if (alreadyHealthy) {
|
|
163
|
+
const health = await checkHealth(healthUrl, 2000);
|
|
164
|
+
if (health.ok) {
|
|
165
|
+
logDevStatus(readyMessageKey);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const useSpinner = isDevVerbose() && process.stdout.isTTY;
|
|
170
|
+
const spinner = useSpinner
|
|
171
|
+
? ora({
|
|
172
|
+
text: t('dev.waitingApi', { url: healthUrl }),
|
|
173
|
+
color: 'magenta',
|
|
174
|
+
spinner: 'dots',
|
|
175
|
+
}).start()
|
|
176
|
+
: null;
|
|
177
|
+
if (!useSpinner)
|
|
178
|
+
logDevStatus('dev.waitingApiQuiet');
|
|
179
|
+
const deadline = Date.now() + API_READY_TIMEOUT_MS;
|
|
180
|
+
let lastHint = '';
|
|
181
|
+
while (Date.now() < deadline) {
|
|
182
|
+
if (!isPortListening(apiPort)) {
|
|
183
|
+
lastHint = t('dev.waitingApiCompile', { port: apiPort });
|
|
184
|
+
if (spinner) {
|
|
185
|
+
spinner.text = `${t('dev.waitingApi', { url: healthUrl })} — ${lastHint}`;
|
|
186
|
+
}
|
|
187
|
+
await new Promise((r) => setTimeout(r, DEV_POLL_MS));
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
const health = await checkHealth(healthUrl, 2500);
|
|
191
|
+
if (health.ok) {
|
|
192
|
+
if (spinner)
|
|
193
|
+
spinner.succeed(t(readyMessageKey));
|
|
194
|
+
else
|
|
195
|
+
logDevStatus(readyMessageKey);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (health.data?.database === 'down') {
|
|
199
|
+
lastHint = t('dev.healthDbDown');
|
|
200
|
+
}
|
|
201
|
+
else if (health.statusCode === 200 && health.data?.status === 'degraded') {
|
|
202
|
+
lastHint = t('dev.healthDegraded');
|
|
203
|
+
}
|
|
204
|
+
else if (health.statusCode === 0) {
|
|
205
|
+
lastHint = t('dev.waitingApiStarting');
|
|
206
|
+
}
|
|
207
|
+
else if (health.statusCode > 0) {
|
|
208
|
+
lastHint = `HTTP ${health.statusCode}`;
|
|
209
|
+
}
|
|
210
|
+
if (spinner && lastHint) {
|
|
211
|
+
spinner.text = `${t('dev.waitingApi', { url: healthUrl })} — ${lastHint}`;
|
|
212
|
+
}
|
|
213
|
+
await new Promise((r) => setTimeout(r, DEV_POLL_FAST_MS));
|
|
214
|
+
}
|
|
215
|
+
if (spinner)
|
|
216
|
+
spinner.fail(t('dev.apiTimeout', { seconds: API_READY_TIMEOUT_MS / 1000 }));
|
|
217
|
+
else
|
|
218
|
+
console.error(t('dev.apiTimeout', { seconds: API_READY_TIMEOUT_MS / 1000 }));
|
|
219
|
+
shutdown('SIGINT');
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
222
|
+
function handlePrimaryDevChildClose(code, label = 'dev', projectRoot = ensureOriginalCwd()) {
|
|
223
|
+
if (!devServicesReady) {
|
|
224
|
+
console.warn(`[reactpress] ${label} process exited during startup (code ${code ?? 'unknown'}) — waiting for services…`);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const adminPort = readEnvPort(projectRoot, 'WEB_ADMIN_PORT', DEV_PORTS.ADMIN_WEB);
|
|
228
|
+
if (isDesktopLocalMode() && label === 'Admin dev') {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (label === 'Admin dev' && isPortListening(adminPort)) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (!shuttingDown)
|
|
235
|
+
shutdown('SIGINT');
|
|
236
|
+
process.exit(code ?? 0);
|
|
237
|
+
}
|
|
238
|
+
async function spawnAdminWeb(projectRoot, { behindNginx = false, integratedStack = false, adminApiOrigin = null, waitForReady = true, } = {}) {
|
|
239
|
+
const adminPort = readEnvPort(projectRoot, 'WEB_ADMIN_PORT', DEV_PORTS.ADMIN_WEB);
|
|
240
|
+
await ensurePortFree(adminPort, { label: 'admin' });
|
|
241
|
+
logDevDetail('dev.startingAdmin', { url: loadWebAdminUrl(projectRoot) });
|
|
242
|
+
const adminEnv = {
|
|
243
|
+
...process.env,
|
|
244
|
+
REACTPRESS_ORIGINAL_CWD: projectRoot,
|
|
245
|
+
WEB_ADMIN_PORT: String(adminPort),
|
|
246
|
+
};
|
|
247
|
+
if (nginxEnabled && process.env.REACTPRESS_NGINX_ENTRY_URL) {
|
|
248
|
+
adminEnv.REACTPRESS_NGINX_ENTRY_URL = process.env.REACTPRESS_NGINX_ENTRY_URL;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
adminEnv.REACTPRESS_SKIP_DEV_PORT_REDIRECT = '1';
|
|
252
|
+
}
|
|
253
|
+
if (behindNginx) {
|
|
254
|
+
adminEnv.VITE_ADMIN_BASE = '/admin/';
|
|
255
|
+
process.env.REACTPRESS_BEHIND_NGINX = '1';
|
|
256
|
+
}
|
|
257
|
+
// Full stack (API + theme site): theme install/activate must hit Nest, not MSW.
|
|
258
|
+
if (integratedStack || adminApiOrigin) {
|
|
259
|
+
adminEnv.VITE_ENABLE_MOCK = 'false';
|
|
260
|
+
adminEnv.VITE_AUTH_MODE = 'server';
|
|
261
|
+
if (adminApiOrigin) {
|
|
262
|
+
// Vite proxies `/api` → `${target}/api/...`; target is host-only origin.
|
|
263
|
+
adminEnv.VITE_DEV_API_PROXY_TARGET = normalizeRemoteOrigin(adminApiOrigin) || adminApiOrigin;
|
|
264
|
+
}
|
|
265
|
+
else if (isDesktopLocalMode() && process.env.REACTPRESS_DESKTOP_LOCAL_API) {
|
|
266
|
+
// Desktop dev embeds SQLite API on a dedicated port (default :13102), not :3002.
|
|
267
|
+
adminEnv.VITE_DEV_API_PROXY_TARGET = process.env.REACTPRESS_DESKTOP_LOCAL_API.replace(/\/api\/?$/, '');
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
adminEnv.VITE_DEV_API_PROXY_TARGET = loadServerSiteUrl(projectRoot).replace(/\/$/, '');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
webChild = isDesktopLocalMode()
|
|
274
|
+
? spawn(process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm', ['exec', 'vp', 'dev'], {
|
|
275
|
+
cwd: path.join(projectRoot, 'web'),
|
|
276
|
+
env: adminEnv,
|
|
277
|
+
stdio: 'inherit',
|
|
278
|
+
shell: process.platform === 'win32',
|
|
279
|
+
})
|
|
280
|
+
: spawnDevChild('pnpm', ['run', '--dir', './web', 'dev'], {
|
|
281
|
+
shell: true,
|
|
282
|
+
cwd: projectRoot,
|
|
283
|
+
env: adminEnv,
|
|
284
|
+
});
|
|
285
|
+
webChild.on('close', (code) => {
|
|
286
|
+
handlePrimaryDevChildClose(code, 'Admin dev', projectRoot);
|
|
287
|
+
});
|
|
288
|
+
if (!waitForReady)
|
|
289
|
+
return Promise.resolve(true);
|
|
290
|
+
const readyUrl = loadWebAdminUrl(projectRoot);
|
|
291
|
+
return waitForHttp(readyUrl, CLIENT_READY_TIMEOUT_MS, DEV_POLL_MS).then((ready) => {
|
|
292
|
+
if (!ready) {
|
|
293
|
+
console.warn(t('dev.adminSlow', {
|
|
294
|
+
seconds: CLIENT_READY_TIMEOUT_MS / 1000,
|
|
295
|
+
url: readyUrl,
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
return ready;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function assertDevPrerequisites() {
|
|
302
|
+
const node = checkNodeVersion();
|
|
303
|
+
if (!node.ok) {
|
|
304
|
+
console.error(`[reactpress] ${node.message}`);
|
|
305
|
+
if (node.fix)
|
|
306
|
+
console.error(` → ${node.fix}`);
|
|
307
|
+
console.error(formatDevFailureHint());
|
|
308
|
+
process.exit(1);
|
|
309
|
+
}
|
|
310
|
+
if (!isLocalSqliteMode()) {
|
|
311
|
+
const docker = checkDocker();
|
|
312
|
+
if (!docker.ok) {
|
|
313
|
+
console.error(`[reactpress] ${docker.message}`);
|
|
314
|
+
if (docker.fix)
|
|
315
|
+
console.error(` → ${docker.fix}`);
|
|
316
|
+
console.error(formatDevFailureHint());
|
|
317
|
+
process.exit(1);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
logDevStatus(isDesktopLocalMode() || process.env.REACTPRESS_LOCAL_MODE === '1'
|
|
321
|
+
? 'dev.prerequisitesOkDesktop'
|
|
322
|
+
: 'dev.prerequisitesOk', { version: process.version });
|
|
323
|
+
}
|
|
324
|
+
async function prepareDevInfrastructure(projectRoot, { needsLocalApi = true } = {}) {
|
|
325
|
+
await acquireDevSession(projectRoot);
|
|
326
|
+
if (isLocalSqliteMode()) {
|
|
327
|
+
if (process.env.REACTPRESS_LOCAL_MODE === '1') {
|
|
328
|
+
const { ensureLocalSite } = require('../core/services/local-site');
|
|
329
|
+
const { ensureSqliteDatabase } = require('../core/services/database/sqlite');
|
|
330
|
+
const { getMonorepoRoot } = require('./root');
|
|
331
|
+
const port = readEnvPort(projectRoot, 'SERVER_PORT', DEV_PORTS.API);
|
|
332
|
+
ensureLocalSite(projectRoot, port, { monorepoRoot: getMonorepoRoot() });
|
|
333
|
+
const sqliteResult = await ensureSqliteDatabase(projectRoot);
|
|
334
|
+
if (!sqliteResult.ok) {
|
|
335
|
+
throw new Error(sqliteResult.message || 'SQLite 数据库未就绪');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
nginxEnabled = false;
|
|
339
|
+
delete process.env.REACTPRESS_NGINX_ENTRY_URL;
|
|
340
|
+
process.env.REACTPRESS_SKIP_DEV_PORT_REDIRECT = '1';
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const planNginx = process.env.REACTPRESS_SKIP_NGINX !== '1';
|
|
344
|
+
const clientApiOrigin = readDevClientApiOrigin(projectRoot);
|
|
345
|
+
const [, nginxResult] = await Promise.all([
|
|
346
|
+
needsLocalApi ? ensureDevDatabase(projectRoot, { quiet: true }) : Promise.resolve(true),
|
|
347
|
+
planNginx ? startDevNginx(projectRoot) : Promise.resolve(false),
|
|
348
|
+
]);
|
|
349
|
+
nginxEnabled = nginxResult;
|
|
350
|
+
if (nginxEnabled) {
|
|
351
|
+
process.env.REACTPRESS_NGINX_ENTRY_URL = nginxEntryUrl(projectRoot);
|
|
352
|
+
delete process.env.REACTPRESS_SKIP_DEV_PORT_REDIRECT;
|
|
353
|
+
if (clientApiOrigin) {
|
|
354
|
+
logDevStatus('dev.nginxReadyRemote', {
|
|
355
|
+
url: nginxEntryUrl(projectRoot),
|
|
356
|
+
api: clientApiOrigin,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
logDevStatus('dev.nginxReady', { url: nginxEntryUrl(projectRoot) });
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
delete process.env.REACTPRESS_NGINX_ENTRY_URL;
|
|
365
|
+
process.env.REACTPRESS_SKIP_DEV_PORT_REDIRECT = '1';
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
async function startDevStack(projectRoot, { webOnly = false, themeOnly = false, desktopMode = false, localWebMode = false, infraDone = false, apiOrigins = { admin: null, client: null, needsLocalApi: true }, } = {}) {
|
|
369
|
+
const { admin: adminApiOrigin, client: clientApiOrigin, needsLocalApi } = apiOrigins;
|
|
370
|
+
if (!infraDone) {
|
|
371
|
+
logDevPhase(1, 3, desktopPhaseKey('dev.phasePrerequisites'));
|
|
372
|
+
assertDevPrerequisites();
|
|
373
|
+
logDevPhase(2, 3, desktopPhaseKey('dev.phaseInfra'));
|
|
374
|
+
try {
|
|
375
|
+
await prepareDevInfrastructure(projectRoot, { needsLocalApi });
|
|
376
|
+
}
|
|
377
|
+
catch (err) {
|
|
378
|
+
console.error(t('dev.dbEnsureFailed', { message: err.message || err }));
|
|
379
|
+
console.error(formatDevFailureHint());
|
|
380
|
+
process.exit(1);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
else if (needsLocalApi && !isLocalSqliteMode() && !(await probeMysqlHost(projectRoot))) {
|
|
384
|
+
console.error(t('dev.dbEnsureFailed', {
|
|
385
|
+
message: t('docker.devStartBlocked', {
|
|
386
|
+
port: readEnvPort(projectRoot, 'DB_PORT', DEV_PORTS.MYSQL),
|
|
387
|
+
}),
|
|
388
|
+
}));
|
|
389
|
+
console.error(formatDevFailureHint());
|
|
390
|
+
process.exit(1);
|
|
391
|
+
}
|
|
392
|
+
const includeAdmin = webOnly && hasWeb(projectRoot);
|
|
393
|
+
// Always run theme watchers when packages exist — admin activate/preview writes manifests
|
|
394
|
+
// and relies on fs.watch even if the current active theme is not yet resolvable.
|
|
395
|
+
const includeThemeSite = themeOnly ||
|
|
396
|
+
(desktopMode && hasThemePackages(projectRoot)) ||
|
|
397
|
+
(!webOnly && hasThemePackages(projectRoot));
|
|
398
|
+
if (!webOnly && !themeOnly && includeThemeSite && !hasResolvableActiveTheme(projectRoot)) {
|
|
399
|
+
const { activeTheme } = readActiveThemeManifest(projectRoot);
|
|
400
|
+
console.warn(`[reactpress] ${t('themeDev.notFound', { id: activeTheme })} — ${t('dev.themeSiteSkipped')}`);
|
|
401
|
+
}
|
|
402
|
+
if (includeThemeSite) {
|
|
403
|
+
const { validateBundledThemes, validateCatalogThemes } = require('./theme-registry');
|
|
404
|
+
const bundled = validateBundledThemes(projectRoot);
|
|
405
|
+
if (bundled.missing.length) {
|
|
406
|
+
console.warn(`[reactpress] themes/package.json lists bundled theme(s) without theme.json: ${bundled.missing.join(', ')}`);
|
|
407
|
+
}
|
|
408
|
+
const catalog = validateCatalogThemes(projectRoot);
|
|
409
|
+
if (catalog.missing.length) {
|
|
410
|
+
console.warn(`[reactpress] themes/package.json lists catalog dir(s) without reactpress.theme in package.json: ${catalog.missing.join(', ')}`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const planNginx = process.env.REACTPRESS_SKIP_NGINX !== '1';
|
|
414
|
+
const includeWebInStack = hasWeb(projectRoot) && !webOnly && !themeOnly;
|
|
415
|
+
if (infraDone) {
|
|
416
|
+
logDevPhase(3, 3, localWebMode ? 'dev.phaseServicesLocalWeb' : desktopPhaseKey('dev.phaseServices'));
|
|
417
|
+
}
|
|
418
|
+
markDevPhase('services');
|
|
419
|
+
const readinessWaits = [];
|
|
420
|
+
let apiSpawn = null;
|
|
421
|
+
const prewarmPreviewBuilds = includeThemeSite &&
|
|
422
|
+
isDesktopLocalMode() &&
|
|
423
|
+
process.env.REACTPRESS_SKIP_PREVIEW_BUILD !== '1';
|
|
424
|
+
if (prewarmPreviewBuilds) {
|
|
425
|
+
const { warmupAllPreviewThemeBuilds } = require('./theme-prod');
|
|
426
|
+
logDevStatus('dev.previewPrewarmStarting');
|
|
427
|
+
readinessWaits.push(warmupAllPreviewThemeBuilds(projectRoot));
|
|
428
|
+
}
|
|
429
|
+
if (adminApiOrigin || clientApiOrigin) {
|
|
430
|
+
if (adminApiOrigin) {
|
|
431
|
+
logDevStatus('dev.adminApiRemote', { url: adminApiOrigin });
|
|
432
|
+
}
|
|
433
|
+
if (clientApiOrigin) {
|
|
434
|
+
logDevStatus('dev.clientApiRemote', { url: clientApiOrigin });
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (needsLocalApi) {
|
|
438
|
+
logDevStatus('dev.phaseApi');
|
|
439
|
+
apiSpawn = await spawnApi(projectRoot);
|
|
440
|
+
const readyMessageKey = webOnly || hasWeb(projectRoot) ? 'dev.apiReadyAdmin' : 'dev.apiReady';
|
|
441
|
+
readinessWaits.push(waitForApiReady(projectRoot, {
|
|
442
|
+
readyMessageKey,
|
|
443
|
+
alreadyHealthy: Boolean(apiSpawn?.reused),
|
|
444
|
+
}));
|
|
445
|
+
}
|
|
446
|
+
if (!includeAdmin && !includeThemeSite && !includeWebInStack) {
|
|
447
|
+
await Promise.all(readinessWaits);
|
|
448
|
+
printDevReadyBanner(projectRoot, { apiOnly: true, nginx: nginxEnabled });
|
|
449
|
+
console.log(t('dev.standaloneHint'));
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const waitThemeInForeground = includeThemeSite && shouldWaitForThemeInForeground();
|
|
453
|
+
let themeSiteStarted = false;
|
|
454
|
+
if (includeWebInStack) {
|
|
455
|
+
logDevDetail('dev.phaseAdmin');
|
|
456
|
+
if (planNginx)
|
|
457
|
+
process.env.REACTPRESS_BEHIND_NGINX = '1';
|
|
458
|
+
logDevDetail('dev.startingAdmin', { url: loadWebAdminUrl(projectRoot) });
|
|
459
|
+
spawnAdminWeb(projectRoot, {
|
|
460
|
+
behindNginx: planNginx,
|
|
461
|
+
integratedStack: true,
|
|
462
|
+
adminApiOrigin,
|
|
463
|
+
waitForReady: false,
|
|
464
|
+
});
|
|
465
|
+
const adminBase = loadWebAdminUrl(projectRoot).replace(/\/$/, '');
|
|
466
|
+
const adminProbe = planNginx ? `${adminBase}/admin/` : `${adminBase}/`;
|
|
467
|
+
readinessWaits.push(waitForHttp(adminProbe, 120_000, DEV_POLL_MS));
|
|
468
|
+
}
|
|
469
|
+
else if (includeAdmin) {
|
|
470
|
+
logDevDetail('dev.phaseAdmin');
|
|
471
|
+
spawnAdminWeb(projectRoot, {
|
|
472
|
+
behindNginx: desktopMode || localWebMode ? false : planNginx,
|
|
473
|
+
integratedStack: desktopMode || localWebMode || isLocalSqliteMode(),
|
|
474
|
+
adminApiOrigin,
|
|
475
|
+
waitForReady: false,
|
|
476
|
+
});
|
|
477
|
+
const adminBase = loadWebAdminUrl(projectRoot).replace(/\/$/, '');
|
|
478
|
+
const adminProbe = planNginx ? `${adminBase}/admin/` : `${adminBase}/`;
|
|
479
|
+
readinessWaits.push(waitForHttp(adminProbe, 120_000, DEV_POLL_MS));
|
|
480
|
+
}
|
|
481
|
+
if (includeThemeSite) {
|
|
482
|
+
const { activeTheme } = readActiveThemeManifest(projectRoot);
|
|
483
|
+
logDevStatus('dev.themeStarting', {
|
|
484
|
+
id: activeTheme,
|
|
485
|
+
port: readEnvPort(projectRoot, 'CLIENT_PORT', DEV_PORTS.VISITOR),
|
|
486
|
+
});
|
|
487
|
+
if (planNginx)
|
|
488
|
+
process.env.REACTPRESS_BEHIND_NGINX = '1';
|
|
489
|
+
if (clientApiOrigin) {
|
|
490
|
+
delete process.env.REACTPRESS_DEV_FORCE_LOCAL_THEME_API;
|
|
491
|
+
const themeApiBase = resolveRemoteThemeApiBase(clientApiOrigin);
|
|
492
|
+
process.env.REACTPRESS_THEME_API_URL = themeApiBase;
|
|
493
|
+
process.env.REACTPRESS_THEME_PUBLIC_API_URL = planNginx
|
|
494
|
+
? `${nginxEntryUrl(projectRoot).replace(/\/$/, '')}/api`
|
|
495
|
+
: themeApiBase;
|
|
496
|
+
const themeDir = resolveThemeDirectory(projectRoot, activeTheme);
|
|
497
|
+
if (themeDir) {
|
|
498
|
+
const nextCache = path.join(themeDir, '.next');
|
|
499
|
+
if (fs.existsSync(nextCache)) {
|
|
500
|
+
fs.rmSync(nextCache, { recursive: true, force: true });
|
|
501
|
+
logDevDetail('dev.themeCacheClearedForRemote');
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
process.env.REACTPRESS_DEV_FORCE_LOCAL_THEME_API = '1';
|
|
507
|
+
}
|
|
508
|
+
const themeBoot = startThemeSiteWithWatch(projectRoot);
|
|
509
|
+
const themeWait = themeBoot.then(async (started) => {
|
|
510
|
+
themeSiteStarted = started;
|
|
511
|
+
if (!started)
|
|
512
|
+
return false;
|
|
513
|
+
const clientUrl = loadClientSiteUrl(projectRoot);
|
|
514
|
+
const port = readEnvPort(projectRoot, 'CLIENT_PORT', DEV_PORTS.VISITOR);
|
|
515
|
+
const portOpen = await (async () => {
|
|
516
|
+
const deadline = Date.now() + 120_000;
|
|
517
|
+
while (Date.now() < deadline) {
|
|
518
|
+
if (isPortListening(port))
|
|
519
|
+
return true;
|
|
520
|
+
await new Promise((r) => setTimeout(r, DEV_POLL_MS));
|
|
521
|
+
}
|
|
522
|
+
return false;
|
|
523
|
+
})();
|
|
524
|
+
if (portOpen) {
|
|
525
|
+
if (isDesktopLocalMode()) {
|
|
526
|
+
const { warmupThemeHomepage } = require('./theme-warmup');
|
|
527
|
+
await warmupThemeHomepage(projectRoot, clientUrl);
|
|
528
|
+
}
|
|
529
|
+
else if (shouldBlockOnThemeWarmup()) {
|
|
530
|
+
await warmupThemeDevRoutes(projectRoot);
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
warmupThemeDevRoutesInBackground(projectRoot);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return portOpen;
|
|
537
|
+
});
|
|
538
|
+
if (waitThemeInForeground) {
|
|
539
|
+
readinessWaits.push(themeWait);
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
themeWait.then((ready) => {
|
|
543
|
+
if (ready)
|
|
544
|
+
logDevDetail('dev.themeReadyQuiet', { url: loadClientSiteUrl(projectRoot) });
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
if (readinessWaits.length > 1) {
|
|
549
|
+
logDevStatus('dev.waitingProxies');
|
|
550
|
+
}
|
|
551
|
+
await Promise.all(readinessWaits);
|
|
552
|
+
if (readinessWaits.length > 1) {
|
|
553
|
+
logDevStatus('dev.proxiesReady');
|
|
554
|
+
}
|
|
555
|
+
if (includeWebInStack && planNginx && nginxEnabled) {
|
|
556
|
+
const adminViaNginx = `${nginxEntryUrl(projectRoot).replace(/\/$/, '')}/admin/`;
|
|
557
|
+
waitForHttp(adminViaNginx, 15_000, DEV_POLL_MS).then((adminOk) => {
|
|
558
|
+
if (!adminOk) {
|
|
559
|
+
console.warn(t('dev.adminNginxSlow', { url: adminViaNginx }));
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
else if (planNginx && !nginxEnabled) {
|
|
564
|
+
startDevNginx(projectRoot).then((enabled) => {
|
|
565
|
+
nginxEnabled = enabled;
|
|
566
|
+
if (enabled) {
|
|
567
|
+
console.log(t('dev.nginxReady', { url: nginxEntryUrl(projectRoot) }));
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
const dbOk = isDesktopLocalMode()
|
|
572
|
+
? true
|
|
573
|
+
: needsLocalApi
|
|
574
|
+
? await probeMysqlHost(projectRoot)
|
|
575
|
+
: true;
|
|
576
|
+
if (needsLocalApi && !dbOk && !isDesktopLocalMode()) {
|
|
577
|
+
console.warn(t('dev.mysqlUnreachable'));
|
|
578
|
+
}
|
|
579
|
+
if (includeThemeSite && process.env.REACTPRESS_SKIP_PREVIEW_BUILD !== '1' && !prewarmPreviewBuilds) {
|
|
580
|
+
const { activeTheme } = readActiveThemeManifest(projectRoot);
|
|
581
|
+
scheduleBackgroundThemeBuilds(projectRoot, { excludeThemeId: activeTheme });
|
|
582
|
+
}
|
|
583
|
+
printDevReadyBanner(projectRoot, {
|
|
584
|
+
webOnly: (includeAdmin && !includeThemeSite) || localWebMode,
|
|
585
|
+
desktop: desktopMode && !localWebMode,
|
|
586
|
+
localWeb: localWebMode,
|
|
587
|
+
nginx: nginxEnabled,
|
|
588
|
+
hasThemeSite: includeThemeSite,
|
|
589
|
+
dbOk,
|
|
590
|
+
adminApiOrigin,
|
|
591
|
+
clientApiOrigin,
|
|
592
|
+
localApiUrl: isDesktopLocalMode() ? process.env.REACTPRESS_DESKTOP_LOCAL_API || null : null,
|
|
593
|
+
dbType: isDesktopLocalMode() ? 'sqlite' : needsLocalApi ? 'mysql' : null,
|
|
594
|
+
});
|
|
595
|
+
logDevTimingSummary({
|
|
596
|
+
apiReused: Boolean(apiSpawn?.reused),
|
|
597
|
+
});
|
|
598
|
+
devServicesReady = true;
|
|
599
|
+
}
|
|
600
|
+
async function runDevStartup(projectRoot, { webOnly = false, themeOnly = false, desktopMode = false, localWebMode = false, skipPrepareInfra = false, apiOrigins = { admin: null, client: null, needsLocalApi: true }, } = {}) {
|
|
601
|
+
startDevTimer();
|
|
602
|
+
try {
|
|
603
|
+
const result = await ensureProjectEnvironment(projectRoot, { skipDatabase: true });
|
|
604
|
+
if (result.message && isDevVerbose())
|
|
605
|
+
console.log(`[reactpress] ${result.message}`);
|
|
606
|
+
}
|
|
607
|
+
catch (err) {
|
|
608
|
+
console.error(t('dev.envFailed'), err.message || err);
|
|
609
|
+
console.error(formatDevFailureHint());
|
|
610
|
+
process.exit(1);
|
|
611
|
+
}
|
|
612
|
+
logDevPhase(1, 3, desktopPhaseKey('dev.phasePrerequisites'));
|
|
613
|
+
assertDevPrerequisites();
|
|
614
|
+
logDevPhase(2, 3, desktopPhaseKey('dev.phaseInfra'));
|
|
615
|
+
try {
|
|
616
|
+
const infraTasks = [buildToolkit(projectRoot)];
|
|
617
|
+
if (!skipPrepareInfra) {
|
|
618
|
+
infraTasks.unshift(prepareDevInfrastructure(projectRoot, { needsLocalApi: apiOrigins.needsLocalApi }));
|
|
619
|
+
}
|
|
620
|
+
await Promise.all(infraTasks);
|
|
621
|
+
markDevPhase('infra');
|
|
622
|
+
}
|
|
623
|
+
catch (err) {
|
|
624
|
+
console.error(t('dev.dbEnsureFailed', { message: err.message || err }));
|
|
625
|
+
console.error(formatDevFailureHint());
|
|
626
|
+
process.exit(1);
|
|
627
|
+
}
|
|
628
|
+
await startDevStack(projectRoot, {
|
|
629
|
+
webOnly,
|
|
630
|
+
themeOnly,
|
|
631
|
+
desktopMode,
|
|
632
|
+
localWebMode,
|
|
633
|
+
infraDone: true,
|
|
634
|
+
apiOrigins,
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
function loadDesktopBootstrap(projectRoot) {
|
|
638
|
+
return require(path.join(projectRoot, 'desktop/scripts/bootstrap-local-api.cjs'));
|
|
639
|
+
}
|
|
640
|
+
async function startDesktopLocalApi(projectRoot, { forceRestart = false } = {}) {
|
|
641
|
+
const desktopDir = path.join(projectRoot, 'desktop');
|
|
642
|
+
if (!fs.existsSync(path.join(desktopDir, 'package.json'))) {
|
|
643
|
+
console.error(`[reactpress] ${t('dev.desktopMissing')}`);
|
|
644
|
+
process.exit(1);
|
|
645
|
+
}
|
|
646
|
+
const boot = await loadDesktopBootstrap(projectRoot);
|
|
647
|
+
console.log('');
|
|
648
|
+
logDevStatus('dev.desktopLocalApiStarting');
|
|
649
|
+
const { siteRoot, localApiBase } = await boot.startDesktopLocalApi(projectRoot, { forceRestart });
|
|
650
|
+
process.env.REACTPRESS_DESKTOP_LOCAL_API = localApiBase;
|
|
651
|
+
process.env.REACTPRESS_DESKTOP_SITE_ROOT = siteRoot;
|
|
652
|
+
process.env.REACTPRESS_THEME_API_URL = localApiBase;
|
|
653
|
+
process.env.REACTPRESS_THEME_PUBLIC_API_URL = localApiBase;
|
|
654
|
+
const localApiOrigin = localApiBase.replace(/\/api\/?$/, '');
|
|
655
|
+
process.env.VITE_DEV_API_PROXY_TARGET = localApiOrigin;
|
|
656
|
+
logDevStatus('dev.desktopLocalApiReady', { url: localApiBase, db: t('dev.dbTypeSqlite') });
|
|
657
|
+
return { siteRoot, localApiBase };
|
|
658
|
+
}
|
|
659
|
+
async function ensureDesktopLocalApiHealthy(projectRoot, { forceRestart = false } = {}) {
|
|
660
|
+
if (!isDesktopLocalMode())
|
|
661
|
+
return true;
|
|
662
|
+
const base = process.env.REACTPRESS_DESKTOP_LOCAL_API?.trim();
|
|
663
|
+
if (!base)
|
|
664
|
+
return false;
|
|
665
|
+
const healthUrl = `${base.replace(/\/api\/?$/, '')}/api/health`;
|
|
666
|
+
const health = await checkHealth(healthUrl, 2500);
|
|
667
|
+
if (health.ok && !forceRestart)
|
|
668
|
+
return true;
|
|
669
|
+
console.warn('[reactpress] Local API unreachable — restarting embedded SQLite API…');
|
|
670
|
+
await startDesktopLocalApi(projectRoot, { forceRestart: true });
|
|
671
|
+
const retry = await checkHealth(healthUrl, 5000);
|
|
672
|
+
if (!retry.ok) {
|
|
673
|
+
console.warn(`[reactpress] Local API still unhealthy after restart (${healthUrl})`);
|
|
674
|
+
}
|
|
675
|
+
return retry.ok;
|
|
676
|
+
}
|
|
677
|
+
function registerDevShutdownHandlers(projectRoot) {
|
|
678
|
+
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
679
|
+
process.on('SIGTERM', () => {
|
|
680
|
+
// Stray SIGTERM during local web boot must not tear down the embedded API (Vite still starting).
|
|
681
|
+
if (!devServicesReady && isDesktopLocalMode())
|
|
682
|
+
return;
|
|
683
|
+
shutdown('SIGTERM');
|
|
684
|
+
});
|
|
685
|
+
process.on('exit', () => {
|
|
686
|
+
try {
|
|
687
|
+
releaseDevSession(projectRoot);
|
|
688
|
+
}
|
|
689
|
+
catch {
|
|
690
|
+
// ignore
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
/** Block until the primary dev child exits (admin Vite, Electron shell, or Nest API). */
|
|
695
|
+
function waitUntilDevChildExit(projectRoot = ensureOriginalCwd()) {
|
|
696
|
+
return new Promise((resolve) => {
|
|
697
|
+
const adminPort = readEnvPort(projectRoot, 'WEB_ADMIN_PORT', DEV_PORTS.ADMIN_WEB);
|
|
698
|
+
const waitForShutdownSignal = () => {
|
|
699
|
+
const onSignal = () => resolve(0);
|
|
700
|
+
process.once('SIGINT', onSignal);
|
|
701
|
+
process.once('SIGTERM', onSignal);
|
|
702
|
+
};
|
|
703
|
+
const child = webChild || desktopChild || apiChild;
|
|
704
|
+
if (!child) {
|
|
705
|
+
waitForShutdownSignal();
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
const finish = (code) => {
|
|
709
|
+
if (child === webChild && isPortListening(adminPort)) {
|
|
710
|
+
waitForShutdownSignal();
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
resolve(code ?? 0);
|
|
714
|
+
};
|
|
715
|
+
if (child.exitCode != null) {
|
|
716
|
+
finish(child.exitCode);
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
if (child.killed) {
|
|
720
|
+
finish(1);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
child.once('close', (code) => finish(code));
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
function canUseDesktopLocalStack(projectRoot) {
|
|
727
|
+
return (isMonorepoCheckout(projectRoot) &&
|
|
728
|
+
fs.existsSync(path.join(projectRoot, 'desktop', 'package.json')));
|
|
729
|
+
}
|
|
730
|
+
async function spawnDesktopApp(projectRoot) {
|
|
731
|
+
const desktopDir = path.join(projectRoot, 'desktop');
|
|
732
|
+
if (!fs.existsSync(path.join(desktopDir, 'package.json'))) {
|
|
733
|
+
console.error(`[reactpress] ${t('dev.desktopMissing')}`);
|
|
734
|
+
shutdown('SIGINT');
|
|
735
|
+
process.exit(1);
|
|
736
|
+
}
|
|
737
|
+
const adminUrl = loadWebAdminUrl(projectRoot).replace(/\/$/, '');
|
|
738
|
+
logDevStatus('dev.desktopStarting', { url: adminUrl });
|
|
739
|
+
const boot = await loadDesktopBootstrap(projectRoot);
|
|
740
|
+
boot.ensureDesktopBuilt(projectRoot);
|
|
741
|
+
desktopChild = spawnDevChild('pnpm', ['exec', 'cross-env', `VITE_DEV_SERVER_URL=${adminUrl}`, 'ELECTRON_IS_DEV=1', 'pnpm', 'run', 'dev:shell'], {
|
|
742
|
+
shell: true,
|
|
743
|
+
cwd: desktopDir,
|
|
744
|
+
env: {
|
|
745
|
+
...process.env,
|
|
746
|
+
REACTPRESS_ORIGINAL_CWD: projectRoot,
|
|
747
|
+
VITE_DEV_SERVER_URL: adminUrl,
|
|
748
|
+
ELECTRON_IS_DEV: '1',
|
|
749
|
+
},
|
|
750
|
+
});
|
|
751
|
+
desktopChild.on('close', (code) => {
|
|
752
|
+
handlePrimaryDevChildClose(code, 'Desktop shell');
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
async function runLocalMonorepoDev(projectRoot = ensureOriginalCwd()) {
|
|
756
|
+
if (!hasWeb(projectRoot)) {
|
|
757
|
+
console.error(t('dev.noWeb'));
|
|
758
|
+
process.exit(1);
|
|
759
|
+
}
|
|
760
|
+
process.env.REACTPRESS_SKIP_NGINX = '1';
|
|
761
|
+
process.env.REACTPRESS_DESKTOP_LOCAL = '1';
|
|
762
|
+
registerDevShutdownHandlers(projectRoot);
|
|
763
|
+
console.log('');
|
|
764
|
+
logDevLine('dev.localFullIntro');
|
|
765
|
+
await prepareDevInfrastructure(projectRoot, { needsLocalApi: false });
|
|
766
|
+
await startDesktopLocalApi(projectRoot, { forceRestart: true });
|
|
767
|
+
await runDevStartup(projectRoot, {
|
|
768
|
+
skipPrepareInfra: true,
|
|
769
|
+
apiOrigins: { admin: null, client: null, needsLocalApi: false },
|
|
770
|
+
});
|
|
771
|
+
await ensureDesktopLocalApiHealthy(projectRoot);
|
|
772
|
+
await new Promise((resolve) => {
|
|
773
|
+
const interval = setInterval(() => {
|
|
774
|
+
void ensureDesktopLocalApiHealthy(projectRoot).catch(() => { });
|
|
775
|
+
}, 20_000);
|
|
776
|
+
const onStop = (signal) => {
|
|
777
|
+
clearInterval(interval);
|
|
778
|
+
shutdown(signal);
|
|
779
|
+
resolve(0);
|
|
780
|
+
};
|
|
781
|
+
process.once('SIGINT', () => onStop('SIGINT'));
|
|
782
|
+
process.once('SIGTERM', () => onStop('SIGTERM'));
|
|
783
|
+
});
|
|
784
|
+
process.exit(0);
|
|
785
|
+
}
|
|
786
|
+
async function runDesktopDev(projectRoot = ensureOriginalCwd()) {
|
|
787
|
+
if (!hasWeb(projectRoot)) {
|
|
788
|
+
console.error(t('dev.noWeb'));
|
|
789
|
+
process.exit(1);
|
|
790
|
+
}
|
|
791
|
+
process.env.REACTPRESS_SKIP_NGINX = '1';
|
|
792
|
+
process.env.REACTPRESS_DESKTOP_LOCAL = '1';
|
|
793
|
+
registerDevShutdownHandlers(projectRoot);
|
|
794
|
+
console.log('');
|
|
795
|
+
logDevLine('dev.desktopIntro');
|
|
796
|
+
await prepareDevInfrastructure(projectRoot, { needsLocalApi: false });
|
|
797
|
+
await startDesktopLocalApi(projectRoot, { forceRestart: true });
|
|
798
|
+
await runDevStartup(projectRoot, {
|
|
799
|
+
webOnly: true,
|
|
800
|
+
desktopMode: true,
|
|
801
|
+
skipPrepareInfra: true,
|
|
802
|
+
apiOrigins: { admin: null, client: null, needsLocalApi: false },
|
|
803
|
+
});
|
|
804
|
+
await spawnDesktopApp(projectRoot);
|
|
805
|
+
const exitCode = await waitUntilDevChildExit(projectRoot);
|
|
806
|
+
process.exit(exitCode);
|
|
807
|
+
}
|
|
808
|
+
async function runLocalWebDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
|
|
809
|
+
if (!hasWeb(projectRoot)) {
|
|
810
|
+
console.error(t('dev.noWeb'));
|
|
811
|
+
process.exit(1);
|
|
812
|
+
}
|
|
813
|
+
registerDevShutdownHandlers(projectRoot);
|
|
814
|
+
if (canUseDesktopLocalStack(projectRoot)) {
|
|
815
|
+
delete process.env.REACTPRESS_LOCAL_MODE;
|
|
816
|
+
process.env.REACTPRESS_SKIP_NGINX = '1';
|
|
817
|
+
process.env.REACTPRESS_DESKTOP_LOCAL = '1';
|
|
818
|
+
console.log('');
|
|
819
|
+
logDevLine('dev.localWebIntro');
|
|
820
|
+
await prepareDevInfrastructure(projectRoot, { needsLocalApi: false });
|
|
821
|
+
await startDesktopLocalApi(projectRoot, { forceRestart: true });
|
|
822
|
+
await runDevStartup(projectRoot, {
|
|
823
|
+
webOnly: true,
|
|
824
|
+
desktopMode: true,
|
|
825
|
+
localWebMode: true,
|
|
826
|
+
skipPrepareInfra: true,
|
|
827
|
+
apiOrigins: { admin: null, client: null, needsLocalApi: false },
|
|
828
|
+
});
|
|
829
|
+
await ensureDesktopLocalApiHealthy(projectRoot);
|
|
830
|
+
await new Promise((resolve) => {
|
|
831
|
+
const interval = setInterval(() => {
|
|
832
|
+
void ensureDesktopLocalApiHealthy(projectRoot).catch(() => { });
|
|
833
|
+
}, 20_000);
|
|
834
|
+
const onStop = (signal) => {
|
|
835
|
+
clearInterval(interval);
|
|
836
|
+
shutdown(signal);
|
|
837
|
+
resolve(0);
|
|
838
|
+
};
|
|
839
|
+
process.once('SIGINT', () => onStop('SIGINT'));
|
|
840
|
+
process.once('SIGTERM', () => onStop('SIGTERM'));
|
|
841
|
+
});
|
|
842
|
+
process.exit(0);
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
process.env.REACTPRESS_LOCAL_MODE = '1';
|
|
846
|
+
process.env.REACTPRESS_SKIP_NGINX = '1';
|
|
847
|
+
console.log('');
|
|
848
|
+
logDevLine('dev.localWebIntro');
|
|
849
|
+
await runDevStartup(projectRoot, { webOnly: true, apiOrigins });
|
|
850
|
+
}
|
|
851
|
+
async function runThemeDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
|
|
852
|
+
if (!hasResolvableActiveTheme(projectRoot)) {
|
|
853
|
+
console.error(t('dev.themeSiteSkipped'));
|
|
854
|
+
process.exit(1);
|
|
855
|
+
}
|
|
856
|
+
process.env.REACTPRESS_THEME_DEV_ONLY = '1';
|
|
857
|
+
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
858
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
859
|
+
process.on('exit', () => {
|
|
860
|
+
try {
|
|
861
|
+
releaseDevSession(projectRoot);
|
|
862
|
+
}
|
|
863
|
+
catch {
|
|
864
|
+
// ignore
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
await runDevStartup(projectRoot, { themeOnly: true, apiOrigins });
|
|
868
|
+
}
|
|
869
|
+
async function runWebDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
|
|
870
|
+
if (!hasWeb(projectRoot)) {
|
|
871
|
+
console.error(t('dev.noWeb'));
|
|
872
|
+
process.exit(1);
|
|
873
|
+
}
|
|
874
|
+
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
875
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
876
|
+
process.on('exit', () => {
|
|
877
|
+
try {
|
|
878
|
+
releaseDevSession(projectRoot);
|
|
879
|
+
}
|
|
880
|
+
catch {
|
|
881
|
+
// ignore
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
await runDevStartup(projectRoot, { webOnly: true, apiOrigins });
|
|
885
|
+
}
|
|
886
|
+
async function runDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
|
|
887
|
+
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
888
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
889
|
+
process.on('exit', () => {
|
|
890
|
+
try {
|
|
891
|
+
releaseDevSession(projectRoot);
|
|
892
|
+
}
|
|
893
|
+
catch {
|
|
894
|
+
// ignore
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
await runDevStartup(projectRoot, { apiOrigins });
|
|
898
|
+
}
|
|
899
|
+
module.exports = {
|
|
900
|
+
runDev,
|
|
901
|
+
runWebDev,
|
|
902
|
+
runLocalWebDev,
|
|
903
|
+
runLocalMonorepoDev,
|
|
904
|
+
runThemeDev,
|
|
905
|
+
runDesktopDev,
|
|
906
|
+
runDevStartup,
|
|
907
|
+
buildToolkit,
|
|
908
|
+
assertDevPrerequisites,
|
|
909
|
+
prepareDevInfrastructure,
|
|
910
|
+
startDevStack,
|
|
911
|
+
detectProjectType,
|
|
912
|
+
nginxEntryUrl,
|
|
913
|
+
};
|
|
914
|
+
//# sourceMappingURL=dev.js.map
|