@fecommunity/reactpress 2.0.0-beta.0 → 3.0.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/LICENSE +6 -6
- package/README.md +28 -176
- package/bin/reactpress-cli-shim.js +28 -0
- package/bin/reactpress.js +245 -61
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +102 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +54 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +33 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/restart.d.ts +2 -0
- package/dist/commands/restart.d.ts.map +1 -0
- package/dist/commands/restart.js +29 -0
- package/dist/commands/restart.js.map +1 -0
- package/dist/commands/start.d.ts +2 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +31 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +20 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/stop.d.ts +5 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +29 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/i18n.js +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +3 -0
- package/dist/services/config.d.ts +11 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +102 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/database.d.ts +43 -0
- package/dist/services/database.d.ts.map +1 -0
- package/dist/services/database.js +252 -0
- package/dist/services/database.js.map +1 -0
- package/dist/services/exec.d.ts +22 -0
- package/dist/services/exec.d.ts.map +1 -0
- package/dist/services/exec.js +46 -0
- package/dist/services/exec.js.map +1 -0
- package/dist/services/init.d.ts +10 -0
- package/dist/services/init.d.ts.map +1 -0
- package/dist/services/init.js +50 -0
- package/dist/services/init.js.map +1 -0
- package/dist/services/process.d.ts +9 -0
- package/dist/services/process.d.ts.map +1 -0
- package/dist/services/process.js +98 -0
- package/dist/services/process.js.map +1 -0
- package/dist/services/server-health.d.ts +4 -0
- package/dist/services/server-health.d.ts.map +1 -0
- package/dist/services/server-health.js +27 -0
- package/dist/services/server-health.js.map +1 -0
- package/dist/services/server.d.ts +19 -0
- package/dist/services/server.d.ts.map +1 -0
- package/dist/services/server.js +133 -0
- package/dist/services/server.js.map +1 -0
- package/dist/templates/config.default.json +12 -0
- package/dist/templates/docker-compose.yml +27 -0
- package/dist/templates/env.default +11 -0
- package/dist/templates/package.json +10 -0
- package/dist/types/config.d.ts +30 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/utils/cli-context.d.ts +4 -0
- package/dist/utils/cli-context.d.ts.map +1 -0
- package/dist/utils/cli-context.js +10 -0
- package/dist/utils/cli-context.js.map +1 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +32 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/paths.d.ts +17 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +27 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +21 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/port.d.ts +5 -0
- package/dist/utils/port.d.ts.map +1 -0
- package/dist/utils/port.js +25 -0
- package/dist/utils/port.js.map +1 -0
- package/dist/utils/server-bundle.d.ts +11 -0
- package/dist/utils/server-bundle.d.ts.map +1 -0
- package/dist/utils/server-bundle.js +71 -0
- package/dist/utils/server-bundle.js.map +1 -0
- package/lib/api-dev-runner.js +6 -0
- package/lib/api-dev.js +85 -0
- package/lib/bootstrap.js +114 -0
- package/lib/build.js +75 -0
- package/lib/db-backup.js +46 -0
- package/lib/dev-banner.js +40 -0
- package/lib/dev.js +122 -0
- package/lib/docker.js +157 -0
- package/lib/doctor.js +210 -0
- package/lib/http.js +147 -0
- package/lib/i18n/index.js +32 -0
- package/lib/i18n/strings.js +587 -0
- package/lib/lifecycle.js +160 -0
- package/lib/paths.js +75 -0
- package/lib/pm2.js +32 -0
- package/lib/process.js +45 -0
- package/{scripts/publish-packages.js → lib/publish.js} +255 -58
- package/lib/root.js +39 -0
- package/lib/spawn.js +92 -0
- package/lib/status.js +108 -0
- package/package.json +38 -73
- package/scripts/install-bundled-runtime.mjs +46 -0
- package/server/bin/reactpress-server.js +4 -4
- package/server/dist/app.module.d.ts +2 -0
- package/server/dist/app.module.js +80 -0
- package/server/dist/app.module.js.map +1 -0
- package/server/dist/common/api-messages.d.ts +32 -0
- package/server/dist/common/api-messages.js +36 -0
- package/server/dist/common/api-messages.js.map +1 -0
- package/server/dist/filters/http-exception.filter.d.ts +4 -0
- package/server/dist/filters/http-exception.filter.js +36 -0
- package/server/dist/filters/http-exception.filter.js.map +1 -0
- package/server/dist/generate-swagger.d.ts +1 -0
- package/server/dist/generate-swagger.js +73 -0
- package/server/dist/generate-swagger.js.map +1 -0
- package/server/dist/interceptors/transform.interceptor.d.ts +9 -0
- package/server/dist/interceptors/transform.interceptor.js +36 -0
- package/server/dist/interceptors/transform.interceptor.js.map +1 -0
- package/server/dist/logger/index.d.ts +4 -0
- package/server/dist/logger/index.js +33 -0
- package/server/dist/logger/index.js.map +1 -0
- package/server/dist/main.d.ts +6 -0
- package/server/dist/main.js +263 -0
- package/server/dist/main.js.map +1 -0
- package/server/dist/modules/api-key/api-key.controller.d.ts +14 -0
- package/server/dist/modules/api-key/api-key.controller.js +63 -0
- package/server/dist/modules/api-key/api-key.controller.js.map +1 -0
- package/server/dist/modules/api-key/api-key.entity.d.ts +11 -0
- package/server/dist/modules/api-key/api-key.entity.js +63 -0
- package/server/dist/modules/api-key/api-key.entity.js.map +1 -0
- package/server/dist/modules/api-key/api-key.guard.d.ts +7 -0
- package/server/dist/modules/api-key/api-key.guard.js +40 -0
- package/server/dist/modules/api-key/api-key.guard.js.map +1 -0
- package/server/dist/modules/api-key/api-key.module.d.ts +2 -0
- package/server/dist/modules/api-key/api-key.module.js +28 -0
- package/server/dist/modules/api-key/api-key.module.js.map +1 -0
- package/server/dist/modules/api-key/api-key.service.d.ts +15 -0
- package/server/dist/modules/api-key/api-key.service.js +81 -0
- package/server/dist/modules/api-key/api-key.service.js.map +1 -0
- package/server/dist/modules/article/article-revision.entity.d.ts +11 -0
- package/server/dist/modules/article/article-revision.entity.js +53 -0
- package/server/dist/modules/article/article-revision.entity.js.map +1 -0
- package/server/dist/modules/article/article.controller.d.ts +27 -0
- package/server/dist/modules/article/article.controller.js +198 -0
- package/server/dist/modules/article/article.controller.js.map +1 -0
- package/server/dist/modules/article/article.entity.d.ts +23 -0
- package/server/dist/modules/article/article.entity.js +128 -0
- package/server/dist/modules/article/article.entity.js.map +1 -0
- package/server/dist/modules/article/article.module.d.ts +2 -0
- package/server/dist/modules/article/article.module.js +30 -0
- package/server/dist/modules/article/article.module.js.map +1 -0
- package/server/dist/modules/article/article.service.d.ts +30 -0
- package/server/dist/modules/article/article.service.js +303 -0
- package/server/dist/modules/article/article.service.js.map +1 -0
- package/server/dist/modules/article/article.util.d.ts +1 -0
- package/server/dist/modules/article/article.util.js +9 -0
- package/server/dist/modules/article/article.util.js.map +1 -0
- package/server/dist/modules/article/scheduled-publish.service.d.ts +13 -0
- package/server/dist/modules/article/scheduled-publish.service.js +65 -0
- package/server/dist/modules/article/scheduled-publish.service.js.map +1 -0
- package/server/dist/modules/auth/auth.controller.d.ts +12 -0
- package/server/dist/modules/auth/auth.controller.js +66 -0
- package/server/dist/modules/auth/auth.controller.js.map +1 -0
- package/server/dist/modules/auth/auth.module.d.ts +2 -0
- package/server/dist/modules/auth/auth.module.js +41 -0
- package/server/dist/modules/auth/auth.module.js.map +1 -0
- package/server/dist/modules/auth/auth.service.d.ts +26 -0
- package/server/dist/modules/auth/auth.service.js +127 -0
- package/server/dist/modules/auth/auth.service.js.map +1 -0
- package/server/dist/modules/auth/jwt-auth.guard.d.ts +7 -0
- package/server/dist/modules/auth/jwt-auth.guard.js +29 -0
- package/server/dist/modules/auth/jwt-auth.guard.js.map +1 -0
- package/server/dist/modules/auth/jwt.strategy.d.ts +9 -0
- package/server/dist/modules/auth/jwt.strategy.js +38 -0
- package/server/dist/modules/auth/jwt.strategy.js.map +1 -0
- package/server/dist/modules/auth/roles.guard.d.ts +10 -0
- package/server/dist/modules/auth/roles.guard.js +46 -0
- package/server/dist/modules/auth/roles.guard.js.map +1 -0
- package/server/dist/modules/category/category.controller.d.ts +11 -0
- package/server/dist/modules/category/category.controller.js +91 -0
- package/server/dist/modules/category/category.controller.js.map +1 -0
- package/server/dist/modules/category/category.entity.d.ts +9 -0
- package/server/dist/modules/category/category.entity.js +60 -0
- package/server/dist/modules/category/category.entity.js.map +1 -0
- package/server/dist/modules/category/category.module.d.ts +2 -0
- package/server/dist/modules/category/category.module.js +27 -0
- package/server/dist/modules/category/category.module.js.map +1 -0
- package/server/dist/modules/category/category.service.d.ts +12 -0
- package/server/dist/modules/category/category.service.js +89 -0
- package/server/dist/modules/category/category.service.js.map +1 -0
- package/server/dist/modules/comment/comment.controller.d.ts +12 -0
- package/server/dist/modules/comment/comment.controller.js +100 -0
- package/server/dist/modules/comment/comment.controller.js.map +1 -0
- package/server/dist/modules/comment/comment.entity.d.ts +17 -0
- package/server/dist/modules/comment/comment.entity.js +104 -0
- package/server/dist/modules/comment/comment.entity.js.map +1 -0
- package/server/dist/modules/comment/comment.module.d.ts +2 -0
- package/server/dist/modules/comment/comment.module.js +30 -0
- package/server/dist/modules/comment/comment.module.js.map +1 -0
- package/server/dist/modules/comment/comment.service.d.ts +24 -0
- package/server/dist/modules/comment/comment.service.js +172 -0
- package/server/dist/modules/comment/comment.service.js.map +1 -0
- package/server/dist/modules/comment/html.d.ts +15 -0
- package/server/dist/modules/comment/html.js +632 -0
- package/server/dist/modules/comment/html.js.map +1 -0
- package/server/dist/modules/file/file.controller.d.ts +10 -0
- package/server/dist/modules/file/file.controller.js +84 -0
- package/server/dist/modules/file/file.controller.js.map +1 -0
- package/server/dist/modules/file/file.entity.d.ts +9 -0
- package/server/dist/modules/file/file.entity.js +60 -0
- package/server/dist/modules/file/file.entity.js.map +1 -0
- package/server/dist/modules/file/file.module.d.ts +2 -0
- package/server/dist/modules/file/file.module.js +27 -0
- package/server/dist/modules/file/file.module.js.map +1 -0
- package/server/dist/modules/file/file.service.d.ts +17 -0
- package/server/dist/modules/file/file.service.js +111 -0
- package/server/dist/modules/file/file.service.js.map +1 -0
- package/server/dist/modules/health/health.controller.d.ts +11 -0
- package/server/dist/modules/health/health.controller.js +57 -0
- package/server/dist/modules/health/health.controller.js.map +1 -0
- package/server/dist/modules/health/health.module.d.ts +2 -0
- package/server/dist/modules/health/health.module.js +20 -0
- package/server/dist/modules/health/health.module.js.map +1 -0
- package/server/dist/modules/install/install.controller.d.ts +11 -0
- package/server/dist/modules/install/install.controller.js +49 -0
- package/server/dist/modules/install/install.controller.js.map +1 -0
- package/server/dist/modules/install/install.module.d.ts +2 -0
- package/server/dist/modules/install/install.module.js +26 -0
- package/server/dist/modules/install/install.module.js.map +1 -0
- package/server/dist/modules/install/install.service.d.ts +12 -0
- package/server/dist/modules/install/install.service.js +63 -0
- package/server/dist/modules/install/install.service.js.map +1 -0
- package/server/dist/modules/knowledge/knowledge.controller.d.ts +14 -0
- package/server/dist/modules/knowledge/knowledge.controller.js +128 -0
- package/server/dist/modules/knowledge/knowledge.controller.js.map +1 -0
- package/server/dist/modules/knowledge/knowledge.entity.d.ts +18 -0
- package/server/dist/modules/knowledge/knowledge.entity.js +109 -0
- package/server/dist/modules/knowledge/knowledge.entity.js.map +1 -0
- package/server/dist/modules/knowledge/knowledge.module.d.ts +2 -0
- package/server/dist/modules/knowledge/knowledge.module.js +27 -0
- package/server/dist/modules/knowledge/knowledge.module.js.map +1 -0
- package/server/dist/modules/knowledge/knowledge.service.d.ts +14 -0
- package/server/dist/modules/knowledge/knowledge.service.js +143 -0
- package/server/dist/modules/knowledge/knowledge.service.js.map +1 -0
- package/server/dist/modules/page/page.controller.d.ts +12 -0
- package/server/dist/modules/page/page.controller.js +102 -0
- package/server/dist/modules/page/page.controller.js.map +1 -0
- package/server/dist/modules/page/page.entity.d.ts +15 -0
- package/server/dist/modules/page/page.entity.js +94 -0
- package/server/dist/modules/page/page.entity.js.map +1 -0
- package/server/dist/modules/page/page.module.d.ts +2 -0
- package/server/dist/modules/page/page.module.js +27 -0
- package/server/dist/modules/page/page.module.js.map +1 -0
- package/server/dist/modules/page/page.service.d.ts +12 -0
- package/server/dist/modules/page/page.service.js +97 -0
- package/server/dist/modules/page/page.service.js.map +1 -0
- package/server/dist/modules/search/search.controller.d.ts +8 -0
- package/server/dist/modules/search/search.controller.js +67 -0
- package/server/dist/modules/search/search.controller.js.map +1 -0
- package/server/dist/modules/search/search.entity.d.ts +8 -0
- package/server/dist/modules/search/search.entity.js +59 -0
- package/server/dist/modules/search/search.entity.js.map +1 -0
- package/server/dist/modules/search/search.module.d.ts +2 -0
- package/server/dist/modules/search/search.module.js +27 -0
- package/server/dist/modules/search/search.module.js.map +1 -0
- package/server/dist/modules/search/search.service.d.ts +12 -0
- package/server/dist/modules/search/search.service.js +84 -0
- package/server/dist/modules/search/search.service.js.map +1 -0
- package/server/dist/modules/setting/setting.constant.d.ts +3 -0
- package/server/dist/modules/setting/setting.constant.js +25 -0
- package/server/dist/modules/setting/setting.constant.js.map +1 -0
- package/server/dist/modules/setting/setting.controller.d.ts +12 -0
- package/server/dist/modules/setting/setting.controller.js +77 -0
- package/server/dist/modules/setting/setting.controller.js.map +1 -0
- package/server/dist/modules/setting/setting.entity.d.ts +26 -0
- package/server/dist/modules/setting/setting.entity.js +149 -0
- package/server/dist/modules/setting/setting.entity.js.map +1 -0
- package/server/dist/modules/setting/setting.module.d.ts +2 -0
- package/server/dist/modules/setting/setting.module.js +28 -0
- package/server/dist/modules/setting/setting.module.js.map +1 -0
- package/server/dist/modules/setting/setting.service.d.ts +10 -0
- package/server/dist/modules/setting/setting.service.js +106 -0
- package/server/dist/modules/setting/setting.service.js.map +1 -0
- package/server/dist/modules/smtp/mail.util.d.ts +6 -0
- package/server/dist/modules/smtp/mail.util.js +33 -0
- package/server/dist/modules/smtp/mail.util.js.map +1 -0
- package/server/dist/modules/smtp/smtp.controller.d.ts +9 -0
- package/server/dist/modules/smtp/smtp.controller.js +69 -0
- package/server/dist/modules/smtp/smtp.controller.js.map +1 -0
- package/server/dist/modules/smtp/smtp.entity.d.ts +9 -0
- package/server/dist/modules/smtp/smtp.entity.js +60 -0
- package/server/dist/modules/smtp/smtp.entity.js.map +1 -0
- package/server/dist/modules/smtp/smtp.module.d.ts +2 -0
- package/server/dist/modules/smtp/smtp.module.js +28 -0
- package/server/dist/modules/smtp/smtp.module.js.map +1 -0
- package/server/dist/modules/smtp/smtp.service.d.ts +11 -0
- package/server/dist/modules/smtp/smtp.service.js +82 -0
- package/server/dist/modules/smtp/smtp.service.js.map +1 -0
- package/server/dist/modules/tag/tag.controller.d.ts +12 -0
- package/server/dist/modules/tag/tag.controller.js +101 -0
- package/server/dist/modules/tag/tag.controller.js.map +1 -0
- package/server/dist/modules/tag/tag.entity.d.ts +9 -0
- package/server/dist/modules/tag/tag.entity.js +59 -0
- package/server/dist/modules/tag/tag.entity.js.map +1 -0
- package/server/dist/modules/tag/tag.module.d.ts +2 -0
- package/server/dist/modules/tag/tag.module.js +27 -0
- package/server/dist/modules/tag/tag.module.js.map +1 -0
- package/server/dist/modules/tag/tag.service.d.ts +13 -0
- package/server/dist/modules/tag/tag.service.js +103 -0
- package/server/dist/modules/tag/tag.service.js.map +1 -0
- package/server/dist/modules/user/user.controller.d.ts +13 -0
- package/server/dist/modules/user/user.controller.js +114 -0
- package/server/dist/modules/user/user.controller.js.map +1 -0
- package/server/dist/modules/user/user.entity.d.ts +15 -0
- package/server/dist/modules/user/user.entity.js +96 -0
- package/server/dist/modules/user/user.entity.js.map +1 -0
- package/server/dist/modules/user/user.module.d.ts +2 -0
- package/server/dist/modules/user/user.module.js +28 -0
- package/server/dist/modules/user/user.module.js.map +1 -0
- package/server/dist/modules/user/user.service.d.ts +16 -0
- package/server/dist/modules/user/user.service.js +151 -0
- package/server/dist/modules/user/user.service.js.map +1 -0
- package/server/dist/modules/view/view.controller.d.ts +11 -0
- package/server/dist/modules/view/view.controller.js +92 -0
- package/server/dist/modules/view/view.controller.js.map +1 -0
- package/server/dist/modules/view/view.entity.d.ts +14 -0
- package/server/dist/modules/view/view.entity.js +88 -0
- package/server/dist/modules/view/view.entity.js.map +1 -0
- package/server/dist/modules/view/view.module.d.ts +2 -0
- package/server/dist/modules/view/view.module.js +27 -0
- package/server/dist/modules/view/view.module.js.map +1 -0
- package/server/dist/modules/view/view.service.d.ts +11 -0
- package/server/dist/modules/view/view.service.js +89 -0
- package/server/dist/modules/view/view.service.js.map +1 -0
- package/server/dist/modules/webhook/webhook.controller.d.ts +12 -0
- package/server/dist/modules/webhook/webhook.controller.js +63 -0
- package/server/dist/modules/webhook/webhook.controller.js.map +1 -0
- package/server/dist/modules/webhook/webhook.entity.d.ts +9 -0
- package/server/dist/modules/webhook/webhook.entity.js +54 -0
- package/server/dist/modules/webhook/webhook.entity.js.map +1 -0
- package/server/dist/modules/webhook/webhook.module.d.ts +2 -0
- package/server/dist/modules/webhook/webhook.module.js +27 -0
- package/server/dist/modules/webhook/webhook.module.js.map +1 -0
- package/server/dist/modules/webhook/webhook.service.d.ts +16 -0
- package/server/dist/modules/webhook/webhook.service.js +97 -0
- package/server/dist/modules/webhook/webhook.service.js.map +1 -0
- package/server/dist/public/favicon.png +0 -0
- package/server/dist/public/index.html +439 -0
- package/server/dist/public/swagger/custom.css +11 -0
- package/server/dist/starter.d.ts +1 -0
- package/server/dist/starter.js +84 -0
- package/server/dist/starter.js.map +1 -0
- package/server/dist/tsconfig.build.tsbuildinfo +16764 -0
- package/server/dist/utils/date.util.d.ts +1 -0
- package/server/dist/utils/date.util.js +13 -0
- package/server/dist/utils/date.util.js.map +1 -0
- package/server/dist/utils/ip.util.d.ts +2 -0
- package/server/dist/utils/ip.util.js +27 -0
- package/server/dist/utils/ip.util.js.map +1 -0
- package/server/dist/utils/markdown.util.d.ts +4 -0
- package/server/dist/utils/markdown.util.js +42 -0
- package/server/dist/utils/markdown.util.js.map +1 -0
- package/server/dist/utils/oss/aliyun-oss-client.d.ts +6 -0
- package/server/dist/utils/oss/aliyun-oss-client.js +28 -0
- package/server/dist/utils/oss/aliyun-oss-client.js.map +1 -0
- package/server/dist/utils/oss/oss-client.d.ts +6 -0
- package/server/dist/utils/oss/oss-client.js +10 -0
- package/server/dist/utils/oss/oss-client.js.map +1 -0
- package/server/dist/utils/oss.util.d.ts +13 -0
- package/server/dist/utils/oss.util.js +48 -0
- package/server/dist/utils/oss.util.js.map +1 -0
- package/server/dist/utils/ua.util.d.ts +9 -0
- package/server/dist/utils/ua.util.js +36 -0
- package/server/dist/utils/ua.util.js.map +1 -0
- package/server/dist/utils/uniqueid.util.d.ts +1 -0
- package/server/dist/utils/uniqueid.util.js +9 -0
- package/server/dist/utils/uniqueid.util.js.map +1 -0
- package/server/dist/utils/upload.util.d.ts +5 -0
- package/server/dist/utils/upload.util.js +34 -0
- package/server/dist/utils/upload.util.js.map +1 -0
- package/server/dist/utils/user.util.d.ts +1 -0
- package/server/dist/utils/user.util.js +18 -0
- package/server/dist/utils/user.util.js.map +1 -0
- package/server/ecosystem.config.js +18 -0
- package/server/package.json +146 -0
- package/server/public/favicon.png +0 -0
- package/server/public/index.html +439 -0
- package/server/public/swagger/custom.css +11 -0
- package/templates/config.default.json +12 -0
- package/templates/docker-compose.prod.yml +56 -0
- package/templates/docker-compose.yml +27 -0
- package/templates/env.default +11 -0
- package/templates/package.json +10 -0
- package/ui/banner.js +22 -0
- package/ui/interactive.js +184 -0
- package/ui/theme.js +25 -0
- package/CONTRIBUTING.md +0 -122
- package/client/bin/reactpress-client.js +0 -190
- package/scripts/build-packages.js +0 -271
- package/scripts/deploy.sh +0 -25
- package/scripts/dev.js +0 -39
- package/scripts/reactpress-server-old.js +0 -130
- package/scripts/reactpress-server.js +0 -666
package/lib/doctor.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const net = require('net');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
const { getHealthUrl, checkHealth } = require('./http');
|
|
7
|
+
const { isDockerRunning } = require('./docker');
|
|
8
|
+
const { envFileStatus } = require('./status');
|
|
9
|
+
const { t } = require('./i18n');
|
|
10
|
+
|
|
11
|
+
function checkNodeVersion() {
|
|
12
|
+
const major = parseInt(process.versions.node.split('.')[0], 10);
|
|
13
|
+
if (major >= 18) {
|
|
14
|
+
return { ok: true, message: `Node.js ${process.version}` };
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
message: t('doctor.nodeBad', { version: process.version }),
|
|
19
|
+
fix: t('doctor.nodeFix'),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function checkDocker() {
|
|
24
|
+
if (isDockerRunning()) {
|
|
25
|
+
return { ok: true, message: t('doctor.dockerOk') };
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
ok: false,
|
|
29
|
+
message: t('doctor.dockerBad'),
|
|
30
|
+
fix: t('doctor.dockerFix'),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function parseEnv(projectRoot) {
|
|
35
|
+
const envPath = path.join(projectRoot, '.env');
|
|
36
|
+
const out = {};
|
|
37
|
+
try {
|
|
38
|
+
const content = fs.readFileSync(envPath, 'utf8');
|
|
39
|
+
for (const line of content.split('\n')) {
|
|
40
|
+
const m = line.match(/^([A-Z_]+)=(.*)$/);
|
|
41
|
+
if (m) out[m[1]] = m[2].trim().replace(/^['"]|['"]$/g, '');
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
// ignore
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function checkPort(port, host = '127.0.0.1') {
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
const socket = net.createConnection({ port, host }, () => {
|
|
52
|
+
socket.destroy();
|
|
53
|
+
resolve(true);
|
|
54
|
+
});
|
|
55
|
+
socket.on('error', () => resolve(false));
|
|
56
|
+
socket.setTimeout(1000, () => {
|
|
57
|
+
socket.destroy();
|
|
58
|
+
resolve(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function checkPorts(projectRoot) {
|
|
64
|
+
const env = parseEnv(projectRoot);
|
|
65
|
+
const apiPort = parseInt(env.SERVER_PORT || '3002', 10);
|
|
66
|
+
const clientPort = parseInt(env.CLIENT_PORT || '3001', 10);
|
|
67
|
+
const [apiBusy, clientBusy] = await Promise.all([checkPort(apiPort), checkPort(clientPort)]);
|
|
68
|
+
const issues = [];
|
|
69
|
+
if (apiBusy) issues.push(t('doctor.portApiBusy', { port: apiPort }));
|
|
70
|
+
if (clientBusy) issues.push(t('doctor.portClientBusy', { port: clientPort }));
|
|
71
|
+
if (issues.length) {
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
message: issues.join('; '),
|
|
75
|
+
fix: t('doctor.portFix'),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
ok: true,
|
|
80
|
+
message: t('doctor.portOk', { apiPort, clientPort }),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function checkDatabase(projectRoot) {
|
|
85
|
+
const env = parseEnv(projectRoot);
|
|
86
|
+
const host = env.DB_HOST || '127.0.0.1';
|
|
87
|
+
const port = parseInt(env.DB_PORT || '3306', 10);
|
|
88
|
+
const user = env.DB_USER || 'root';
|
|
89
|
+
const password = env.DB_PASSWD || env.DB_PASSWORD || 'root';
|
|
90
|
+
const database = env.DB_DATABASE || 'reactpress';
|
|
91
|
+
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
let mysql;
|
|
94
|
+
try {
|
|
95
|
+
mysql = require('mysql2/promise');
|
|
96
|
+
} catch {
|
|
97
|
+
try {
|
|
98
|
+
mysql = require(path.join(projectRoot, 'server/node_modules/mysql2/promise'));
|
|
99
|
+
} catch {
|
|
100
|
+
resolve({
|
|
101
|
+
ok: false,
|
|
102
|
+
message: t('doctor.dbNoMysql2'),
|
|
103
|
+
fix: t('doctor.dbMysql2Fix'),
|
|
104
|
+
});
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
mysql
|
|
110
|
+
.createConnection({ host, port, user, password, database, connectTimeout: 5000 })
|
|
111
|
+
.then(async (conn) => {
|
|
112
|
+
await conn.ping();
|
|
113
|
+
await conn.end();
|
|
114
|
+
resolve({
|
|
115
|
+
ok: true,
|
|
116
|
+
message: t('doctor.dbOk', { host, port, database }),
|
|
117
|
+
});
|
|
118
|
+
})
|
|
119
|
+
.catch((err) => {
|
|
120
|
+
resolve({
|
|
121
|
+
ok: false,
|
|
122
|
+
message: t('doctor.dbBad', { error: err.message }),
|
|
123
|
+
fix: t('doctor.dbFix'),
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function checkApiHealth(projectRoot) {
|
|
130
|
+
const healthUrl = getHealthUrl(projectRoot);
|
|
131
|
+
const result = await checkHealth(healthUrl);
|
|
132
|
+
if (result.ok) {
|
|
133
|
+
return { ok: true, message: t('doctor.apiOk', { url: healthUrl }) };
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
ok: false,
|
|
137
|
+
message: t('doctor.apiBad', { url: healthUrl }),
|
|
138
|
+
fix: t('doctor.apiFix'),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function checkPnpm() {
|
|
143
|
+
try {
|
|
144
|
+
const v = execSync('pnpm -v', { encoding: 'utf8' }).trim();
|
|
145
|
+
return { ok: true, message: `pnpm ${v}` };
|
|
146
|
+
} catch {
|
|
147
|
+
return {
|
|
148
|
+
ok: false,
|
|
149
|
+
message: t('doctor.pnpmBad'),
|
|
150
|
+
fix: t('doctor.pnpmFix'),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function runDoctor(projectRoot) {
|
|
156
|
+
const env = envFileStatus(projectRoot);
|
|
157
|
+
const checks = [
|
|
158
|
+
{ name: 'Node.js', run: () => checkNodeVersion() },
|
|
159
|
+
{ name: 'pnpm', run: () => checkPnpm() },
|
|
160
|
+
{
|
|
161
|
+
name: t('doctor.check.config'),
|
|
162
|
+
run: () => ({
|
|
163
|
+
ok: env.config,
|
|
164
|
+
message: env.config ? t('doctor.configOk') : t('doctor.configBad'),
|
|
165
|
+
fix: t('doctor.configFix'),
|
|
166
|
+
}),
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: t('doctor.check.env'),
|
|
170
|
+
run: () => ({
|
|
171
|
+
ok: env.env,
|
|
172
|
+
message: env.env ? t('doctor.envOk') : t('doctor.envBad'),
|
|
173
|
+
fix: t('doctor.envFix'),
|
|
174
|
+
}),
|
|
175
|
+
},
|
|
176
|
+
{ name: 'Docker', run: () => checkDocker() },
|
|
177
|
+
{ name: t('doctor.check.ports'), run: () => checkPorts(projectRoot) },
|
|
178
|
+
{ name: t('doctor.check.database'), run: () => checkDatabase(projectRoot) },
|
|
179
|
+
{ name: t('doctor.check.api'), run: () => checkApiHealth(projectRoot) },
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
console.log('');
|
|
183
|
+
console.log(chalk.bold.cyan(' ReactPress Doctor'));
|
|
184
|
+
console.log(chalk.gray(t('doctor.project', { path: projectRoot })));
|
|
185
|
+
console.log(chalk.gray(' ─────────────────────────────────────'));
|
|
186
|
+
|
|
187
|
+
let failed = 0;
|
|
188
|
+
for (const { name, run } of checks) {
|
|
189
|
+
const result = await run();
|
|
190
|
+
const icon = result.ok ? chalk.green('✓') : chalk.red('✗');
|
|
191
|
+
console.log(` ${icon} ${chalk.bold(name)} ${result.message}`);
|
|
192
|
+
if (!result.ok && result.fix) {
|
|
193
|
+
console.log(chalk.yellow(` → ${result.fix}`));
|
|
194
|
+
failed += 1;
|
|
195
|
+
} else if (!result.ok) {
|
|
196
|
+
failed += 1;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
console.log(chalk.gray(' ─────────────────────────────────────'));
|
|
201
|
+
if (failed === 0) {
|
|
202
|
+
console.log(chalk.green(t('doctor.allPass')));
|
|
203
|
+
} else {
|
|
204
|
+
console.log(chalk.yellow(t('doctor.failed', { count: failed })));
|
|
205
|
+
}
|
|
206
|
+
console.log('');
|
|
207
|
+
return failed === 0 ? 0 : 1;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
module.exports = { runDoctor };
|
package/lib/http.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function loadServerSiteUrl(projectRoot) {
|
|
6
|
+
const envPath = path.join(projectRoot, '.env');
|
|
7
|
+
try {
|
|
8
|
+
const content = fs.readFileSync(envPath, 'utf8');
|
|
9
|
+
const match = content.match(/^SERVER_SITE_URL=(.+)$/m);
|
|
10
|
+
if (match) {
|
|
11
|
+
return match[1].trim().replace(/^['"]|['"]$/g, '');
|
|
12
|
+
}
|
|
13
|
+
} catch {
|
|
14
|
+
// ignore
|
|
15
|
+
}
|
|
16
|
+
return 'http://localhost:3002';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function loadClientSiteUrl(projectRoot) {
|
|
20
|
+
const envPath = path.join(projectRoot, '.env');
|
|
21
|
+
try {
|
|
22
|
+
const content = fs.readFileSync(envPath, 'utf8');
|
|
23
|
+
const match = content.match(/^CLIENT_SITE_URL=(.+)$/m);
|
|
24
|
+
if (match) {
|
|
25
|
+
return match[1].trim().replace(/^['"]|['"]$/g, '');
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
// ignore
|
|
29
|
+
}
|
|
30
|
+
return 'http://localhost:3001';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getApiPrefix(projectRoot) {
|
|
34
|
+
const envPath = path.join(projectRoot, '.env');
|
|
35
|
+
try {
|
|
36
|
+
const content = fs.readFileSync(envPath, 'utf8');
|
|
37
|
+
const match = content.match(/^SERVER_API_PREFIX=(.+)$/m);
|
|
38
|
+
if (match) {
|
|
39
|
+
return match[1].trim().replace(/^['"]|['"]$/g, '');
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
// ignore
|
|
43
|
+
}
|
|
44
|
+
return '/api';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getHealthUrl(projectRoot) {
|
|
48
|
+
const base = loadServerSiteUrl(projectRoot).replace(/\/$/, '');
|
|
49
|
+
const prefix = getApiPrefix(projectRoot).replace(/\/$/, '');
|
|
50
|
+
return `${base}${prefix}/health`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function checkHealth(url, timeoutMs = 3000) {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
let parsed;
|
|
56
|
+
try {
|
|
57
|
+
parsed = new URL(url);
|
|
58
|
+
} catch {
|
|
59
|
+
resolve({ ok: false });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const port = parsed.port || (parsed.protocol === 'https:' ? 443 : 80);
|
|
63
|
+
const req = http.request(
|
|
64
|
+
{
|
|
65
|
+
hostname: parsed.hostname,
|
|
66
|
+
port,
|
|
67
|
+
path: parsed.pathname + (parsed.search || ''),
|
|
68
|
+
method: 'GET',
|
|
69
|
+
timeout: timeoutMs,
|
|
70
|
+
},
|
|
71
|
+
(res) => {
|
|
72
|
+
let body = '';
|
|
73
|
+
res.on('data', (chunk) => {
|
|
74
|
+
body += chunk;
|
|
75
|
+
});
|
|
76
|
+
res.on('end', () => {
|
|
77
|
+
const ok = res.statusCode === 200;
|
|
78
|
+
let data = null;
|
|
79
|
+
try {
|
|
80
|
+
data = JSON.parse(body);
|
|
81
|
+
} catch {
|
|
82
|
+
// ignore
|
|
83
|
+
}
|
|
84
|
+
resolve({ ok, statusCode: res.statusCode, data });
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
req.on('timeout', () => {
|
|
89
|
+
req.destroy();
|
|
90
|
+
resolve({ ok: false });
|
|
91
|
+
});
|
|
92
|
+
req.on('error', () => resolve({ ok: false }));
|
|
93
|
+
req.end();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function isHttpResponding(url, timeoutMs = 2000) {
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
let parsed;
|
|
100
|
+
try {
|
|
101
|
+
parsed = new URL(url);
|
|
102
|
+
} catch {
|
|
103
|
+
resolve(false);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const port = parsed.port || (parsed.protocol === 'https:' ? 443 : 80);
|
|
108
|
+
const req = http.request(
|
|
109
|
+
{
|
|
110
|
+
hostname: parsed.hostname,
|
|
111
|
+
port,
|
|
112
|
+
path: parsed.pathname || '/',
|
|
113
|
+
method: 'GET',
|
|
114
|
+
timeout: timeoutMs,
|
|
115
|
+
},
|
|
116
|
+
(res) => resolve(res.statusCode > 0)
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
req.on('timeout', () => {
|
|
120
|
+
req.destroy();
|
|
121
|
+
resolve(false);
|
|
122
|
+
});
|
|
123
|
+
req.on('error', () => resolve(false));
|
|
124
|
+
req.end();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function waitForHttp(url, timeoutMs = 120_000, intervalMs = 500) {
|
|
129
|
+
const deadline = Date.now() + timeoutMs;
|
|
130
|
+
while (Date.now() < deadline) {
|
|
131
|
+
if (await isHttpResponding(url)) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
module.exports = {
|
|
140
|
+
loadServerSiteUrl,
|
|
141
|
+
loadClientSiteUrl,
|
|
142
|
+
getApiPrefix,
|
|
143
|
+
getHealthUrl,
|
|
144
|
+
checkHealth,
|
|
145
|
+
isHttpResponding,
|
|
146
|
+
waitForHttp,
|
|
147
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const { STRINGS } = require('./strings');
|
|
2
|
+
|
|
3
|
+
function resolveLocale() {
|
|
4
|
+
const raw = process.env.REACTPRESS_LANG || process.env.LANG || 'en';
|
|
5
|
+
const code = String(raw).split(/[._-]/)[0].toLowerCase();
|
|
6
|
+
return code === 'zh' ? 'zh' : 'en';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let locale = resolveLocale();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} key
|
|
13
|
+
* @param {Record<string, string | number>} [vars]
|
|
14
|
+
*/
|
|
15
|
+
function t(key, vars = {}) {
|
|
16
|
+
const table = STRINGS[locale] || STRINGS.en;
|
|
17
|
+
let text = table[key] ?? STRINGS.en[key] ?? key;
|
|
18
|
+
for (const [name, value] of Object.entries(vars)) {
|
|
19
|
+
text = text.replace(new RegExp(`\\{${name}\\}`, 'g'), String(value));
|
|
20
|
+
}
|
|
21
|
+
return text;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getLocale() {
|
|
25
|
+
return locale;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function setLocale(next) {
|
|
29
|
+
locale = next === 'zh' ? 'zh' : 'en';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = { t, getLocale, setLocale, resolveLocale };
|