@fecommunity/reactpress 2.0.0-beta-4-beta.1 → 3.0.0
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 +273 -0
- 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 +29 -0
- package/lib/db-backup.js +46 -0
- package/lib/dev-banner.js +40 -0
- package/lib/dev.js +134 -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 +559 -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/reactpress-publish.js → lib/publish.js} +26 -19
- package/lib/root.js +31 -0
- package/lib/spawn.js +91 -0
- package/lib/status.js +108 -0
- package/package.json +36 -70
- 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 +105 -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 +32 -0
- package/server/dist/modules/article/article.controller.js +242 -0
- package/server/dist/modules/article/article.controller.js.map +1 -0
- package/server/dist/modules/article/article.entity.d.ts +24 -0
- package/server/dist/modules/article/article.entity.js +133 -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 +42 -0
- package/server/dist/modules/article/article.module.js.map +1 -0
- package/server/dist/modules/article/article.service.d.ts +38 -0
- package/server/dist/modules/article/article.service.js +357 -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 +128 -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 +30 -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 +39 -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 +90 -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 +39 -0
- package/server/dist/modules/comment/comment.module.js.map +1 -0
- package/server/dist/modules/comment/comment.service.d.ts +26 -0
- package/server/dist/modules/comment/comment.service.js +182 -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 +144 -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 +98 -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 +83 -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 +104 -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 +115 -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 +152 -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 +16966 -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 +49 -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 +168 -0
- package/ui/theme.js +25 -0
- package/CONTRIBUTING.md +0 -122
- package/client/bin/reactpress-client.js +0 -190
- package/scripts/reactpress-cli.js +0 -90
- package/scripts/reactpress-deploy.sh +0 -47
- package/scripts/reactpress-dev.js +0 -39
- package/scripts/reactpress.js +0 -90
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FECommunity
|
|
4
|
+
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
in the Software without restriction, including without limitation the rights
|
|
8
8
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
The above copyright notice and this permission notice shall be included in all
|
|
13
13
|
copies or substantial portions of the Software.
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,195 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://gaoredu.com" title="ReactPress">
|
|
3
|
-
<img height="180" src="./public/logo.png" alt="ReactPress Logo">
|
|
4
|
-
</a>
|
|
1
|
+
# @fecommunity/reactpress-cli
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
零配置一键初始化与管理 ReactPress CMS & 博客服务器。内置 NestJS 服务端,无需单独克隆 [fecommunity/reactpress](https://github.com/fecommunity/reactpress)。
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
<em>Modern Full-Stack Publishing Platform Built with React, Next.js, and NestJS</em>
|
|
10
|
-
</p>
|
|
5
|
+
完整文档与贡献指南见:[github.com/fecommunity/reactpress-cli](https://github.com/fecommunity/reactpress-cli)
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
[](https://www.npmjs.com/package/@fecommunity/reactpress)
|
|
14
|
-
[](https://github.com/fecommunity/reactpress/pulls)
|
|
15
|
-
[](http://www.typescriptlang.org/)
|
|
16
|
-
[](https://nextjs.org/)
|
|
17
|
-
[](https://nestjs.com/)
|
|
18
|
-
[](https://vercel.com/new/clone?repository-url=https://github.com/fecommunity/reactpress)
|
|
19
|
-
[](https://github.com/fecommunity/reactpress/actions/workflows/npm-publish.yml)
|
|
7
|
+
## 安装
|
|
20
8
|
|
|
21
|
-
<p>
|
|
22
|
-
<a href="https://github.com/fecommunity/reactpress/issues">Report Bug</a>
|
|
23
|
-
·
|
|
24
|
-
<a href="https://github.com/fecommunity/reactpress/issues">Request Feature</a>
|
|
25
|
-
·
|
|
26
|
-
<a href="./README-zh_CN.md">中文文档</a>
|
|
27
|
-
</p>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
## 🌟 Modern Publishing Platform
|
|
31
|
-
|
|
32
|
-
**ReactPress 2.0** is a full-stack publishing platform built with modern web technologies. It enables developers and content creators to build professional blogs, websites, and content management systems with minimal setup.
|
|
33
|
-
|
|
34
|
-
[](https://gaoredu.com)
|
|
35
|
-
|
|
36
|
-
## ✨ Key Features
|
|
37
|
-
|
|
38
|
-
### ⚡ 5-Minute Installation
|
|
39
|
-
- **Zero-Configuration Setup** with intelligent defaults
|
|
40
|
-
- **WordPress-Style Installation Wizard** for intuitive setup
|
|
41
|
-
- **Auto-Database Provisioning** with automatic schema migration
|
|
42
|
-
|
|
43
|
-
### 🎨 Advanced Customization
|
|
44
|
-
- **Dynamic Theme Switching** with light/dark mode
|
|
45
|
-
- **Component-Level Customization** through modular architecture
|
|
46
|
-
- **Internationalization** support (Chinese & English)
|
|
47
|
-
|
|
48
|
-
### 🔧 Unified Development Experience
|
|
49
|
-
- **Monorepo Architecture** with modular packages
|
|
50
|
-
- **TypeScript** for type safety across frontend and backend
|
|
51
|
-
- **PM2 Process Management** for production deployments
|
|
52
|
-
|
|
53
|
-
### 🚀 Modern Technology Stack
|
|
54
|
-
- **Frontend**: React 18 + Next.js 14 App Router
|
|
55
|
-
- **Backend**: NestJS 10 with modular architecture
|
|
56
|
-
- **Database**: MySQL with TypeORM
|
|
57
|
-
- **UI**: Ant Design v5 components
|
|
58
|
-
|
|
59
|
-
## 📸 Screenshots
|
|
60
|
-
|
|
61
|
-
### Installation Wizard
|
|
62
|
-
[](https://gaoredu.com)
|
|
63
|
-
|
|
64
|
-
### Content Management Dashboard
|
|
65
|
-
[](https://gaoredu.com)
|
|
66
|
-
|
|
67
|
-
### Demo Site
|
|
68
|
-
[](https://gaoredu.com)
|
|
69
|
-
|
|
70
|
-
## 🚀 Quick Start
|
|
71
|
-
|
|
72
|
-
### 🏁 Installation Options
|
|
73
|
-
|
|
74
|
-
#### Option 1: Unified CLI (Recommended)
|
|
75
9
|
```bash
|
|
76
|
-
|
|
77
|
-
npm install -g @fecommunity/reactpress
|
|
78
|
-
|
|
79
|
-
# Launch installation wizard
|
|
80
|
-
reactpress server install
|
|
81
|
-
|
|
82
|
-
# Start services
|
|
83
|
-
reactpress server start
|
|
84
|
-
reactpress client
|
|
10
|
+
npm install -g @fecommunity/reactpress-cli
|
|
85
11
|
```
|
|
86
12
|
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
# Install and start ReactPress server
|
|
90
|
-
npx @fecommunity/reactpress-server
|
|
91
|
-
|
|
92
|
-
# Install and run client independently
|
|
93
|
-
npx @fecommunity/reactpress-client
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## 📦 Packages & Components
|
|
97
|
-
|
|
98
|
-
ReactPress is organized as a **monorepo with modular packages**:
|
|
99
|
-
|
|
100
|
-
### Core Packages
|
|
13
|
+
全局命令为 `reactpress-cli`(与 npm 包名无关)。
|
|
101
14
|
|
|
102
|
-
|
|
103
|
-
|---------|-------------|---------|
|
|
104
|
-
| [`@fecommunity/reactpress`](.) | Main CLI and unified entry point | 2.0.0 |
|
|
105
|
-
| [`@fecommunity/reactpress-client`](./client) | Next.js 14 frontend application | 1.0.0 |
|
|
106
|
-
| [`@fecommunity/reactpress-server`](./server) | NestJS 10 backend API | 1.0.0 |
|
|
107
|
-
| [`@fecommunity/reactpress-toolkit`](./toolkit) | Auto-generated API client SDK | 1.0.0 |
|
|
15
|
+
> npm 上的无作用域包名 `reactpress-cli` 已被占用,本包发布为 `@fecommunity/reactpress-cli`。
|
|
108
16
|
|
|
109
|
-
|
|
17
|
+
## 快速开始
|
|
110
18
|
|
|
111
|
-
| Template | Description | Package Name |
|
|
112
|
-
|----------|-------------|--------------|
|
|
113
|
-
| [`hello-world`](./templates/hello-world) | Minimal template for rapid prototyping | `@fecommunity/reactpress-template-hello-world` |
|
|
114
|
-
| [`twentytwentyfive`](./templates/twentytwentyfive) | Feature-rich blog template | `@fecommunity/reactpress-template-twentytwentyfive` |
|
|
115
|
-
|
|
116
|
-
## 🔧 Configuration
|
|
117
|
-
|
|
118
|
-
Create a `.env` file in the root directory for local development:
|
|
119
|
-
|
|
120
|
-
```env
|
|
121
|
-
# Database Config
|
|
122
|
-
DB_HOST=127.0.0.1
|
|
123
|
-
DB_PORT=3306
|
|
124
|
-
DB_USER=reactpress
|
|
125
|
-
DB_PASSWD=reactpress
|
|
126
|
-
DB_DATABASE=reactpress
|
|
127
|
-
|
|
128
|
-
# Client Config
|
|
129
|
-
CLIENT_SITE_URL=http://localhost:3001
|
|
130
|
-
|
|
131
|
-
# Server Config
|
|
132
|
-
SERVER_SITE_URL=http://localhost:3002
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## 🚀 Deployment Options
|
|
136
|
-
|
|
137
|
-
### Deploy with Vercel (Recommended for Startups)
|
|
138
|
-
[](https://vercel.com/new/clone?repository-url=https://github.com/fecommunity/reactpress)
|
|
139
|
-
|
|
140
|
-
### PM2 Deployment (Recommended for Production)
|
|
141
|
-
```bash
|
|
142
|
-
# Install PM2 globally
|
|
143
|
-
npm install -g pm2
|
|
144
|
-
|
|
145
|
-
# Start ReactPress server with PM2
|
|
146
|
-
npx @fecommunity/reactpress-server --pm2
|
|
147
|
-
|
|
148
|
-
# Start ReactPress client with PM2
|
|
149
|
-
npx @fecommunity/reactpress-client --pm2
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Traditional Deployment (Self-Managed)
|
|
153
19
|
```bash
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
# Start production servers
|
|
158
|
-
pnpm run start
|
|
20
|
+
mkdir my-blog && cd my-blog
|
|
21
|
+
reactpress-cli init
|
|
22
|
+
reactpress-cli start
|
|
159
23
|
```
|
|
160
24
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
We welcome contributions of all kinds! Whether it's bug fixes, new features, documentation improvements, or translations, your help is appreciated.
|
|
164
|
-
|
|
165
|
-
### 📋 Development Setup
|
|
166
|
-
|
|
167
|
-
1. Fork the repository
|
|
168
|
-
2. Clone your fork: `git clone https://github.com/your-username/reactpress.git`
|
|
169
|
-
3. Install dependencies: `pnpm install`
|
|
170
|
-
4. Start development servers: `pnpm run dev`
|
|
171
|
-
|
|
172
|
-
### 📦 Publishing
|
|
173
|
-
|
|
174
|
-
To publish packages to npm:
|
|
175
|
-
|
|
176
|
-
1. Ensure you're logged into npm: `pnpm login`
|
|
177
|
-
2. Run the publish script: `pnpm run publish`
|
|
178
|
-
3. Follow the interactive prompts to select packages and version increments
|
|
179
|
-
|
|
180
|
-
Please read our [Contributing Guide](https://github.com/fecommunity/reactpress/blob/master/CONTRIBUTING.md) for details on our code of conduct and development process.
|
|
25
|
+
浏览器访问 `http://localhost:3002`(API 文档:`/api`)。
|
|
181
26
|
|
|
182
|
-
##
|
|
27
|
+
## 常用命令
|
|
183
28
|
|
|
184
|
-
|
|
29
|
+
| 命令 | 说明 |
|
|
30
|
+
|------|------|
|
|
31
|
+
| `reactpress-cli init [dir]` | 初始化项目 |
|
|
32
|
+
| `reactpress-cli start` | 启动服务(自动准备数据库) |
|
|
33
|
+
| `reactpress-cli stop` | 停止服务 |
|
|
34
|
+
| `reactpress-cli restart` | 重启服务 |
|
|
35
|
+
| `reactpress-cli status` | 查看状态 |
|
|
36
|
+
| `reactpress-cli config [key] [value]` | 查看/修改配置 |
|
|
37
|
+
| `reactpress-cli config server.port 3003 --apply` | 改端口并重启 |
|
|
185
38
|
|
|
186
|
-
|
|
187
|
-
- [NestJS](https://github.com/nestjs/nest) - Progressive Node.js framework
|
|
188
|
-
- [Ant Design](https://github.com/ant-design/ant-design) - UI design language
|
|
189
|
-
- [TypeORM](https://github.com/typeorm/typeorm) - ORM for TypeScript and JavaScript
|
|
39
|
+
## 要求
|
|
190
40
|
|
|
191
|
-
|
|
41
|
+
- Node.js 18+
|
|
42
|
+
- macOS / Linux / Windows
|
|
43
|
+
- 默认使用 Docker 运行嵌入式 MySQL;也可在 `.reactpress/config.json` 中配置外部数据库
|
|
192
44
|
|
|
193
|
-
##
|
|
45
|
+
## 许可证
|
|
194
46
|
|
|
195
|
-
|
|
47
|
+
MIT © FECommunity
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated 3.0 起请使用 `reactpress`(@fecommunity/reactpress)。3.1 将移除此 bin。
|
|
5
|
+
*/
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const { t } = require('../lib/i18n');
|
|
8
|
+
|
|
9
|
+
function mapLegacyArgv(argv) {
|
|
10
|
+
const [cmd, ...rest] = argv;
|
|
11
|
+
if (cmd === 'start') return ['server', 'start', ...rest];
|
|
12
|
+
if (cmd === 'stop') return ['server', 'stop', ...rest];
|
|
13
|
+
if (cmd === 'restart') return ['server', 'restart', ...rest];
|
|
14
|
+
if (cmd === 'status') return ['server', 'status', ...rest];
|
|
15
|
+
return argv;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!process.env.REACTPRESS_SUPPRESS_DEPRECATION) {
|
|
19
|
+
console.warn(
|
|
20
|
+
chalk.yellow(
|
|
21
|
+
t('shim.deprecated')
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const mapped = mapLegacyArgv(process.argv.slice(2));
|
|
27
|
+
process.argv = [process.argv[0], process.argv[1], ...mapped];
|
|
28
|
+
require('./reactpress.js');
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ReactPress unified CLI — init, dev, build, server, docker, publish.
|
|
5
|
+
* Run without arguments for an interactive menu (Claude Code–style).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { Command } = require('commander');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const chalk = require('chalk');
|
|
11
|
+
const { ensureOriginalCwd, getMonorepoRoot } = require('../lib/root');
|
|
12
|
+
const { ensureProjectEnvironment, initMonorepoProject } = require('../lib/bootstrap');
|
|
13
|
+
const { runDev } = require('../lib/dev');
|
|
14
|
+
const { runApiDev } = require('../lib/api-dev');
|
|
15
|
+
const { runLifecycleCommand } = require('../lib/lifecycle');
|
|
16
|
+
const { runDockerCommand } = require('../lib/docker');
|
|
17
|
+
const { printUnifiedStatus } = require('../lib/status');
|
|
18
|
+
const { runDoctor } = require('../lib/doctor');
|
|
19
|
+
const { runDbBackup } = require('../lib/db-backup');
|
|
20
|
+
const { runBuild } = require('../lib/build');
|
|
21
|
+
const { startApiWithPm2 } = require('../lib/pm2');
|
|
22
|
+
const { runNodeScript, runReactpressCli } = require('../lib/spawn');
|
|
23
|
+
const { getClientBin } = require('../lib/paths');
|
|
24
|
+
const { runInteractiveLoop } = require('../ui/interactive');
|
|
25
|
+
const { t } = require('../lib/i18n');
|
|
26
|
+
|
|
27
|
+
const rootPkg = require(path.join(getMonorepoRoot(), 'package.json'));
|
|
28
|
+
|
|
29
|
+
const program = new Command();
|
|
30
|
+
|
|
31
|
+
program
|
|
32
|
+
.name('reactpress')
|
|
33
|
+
.description(t('cli.description'))
|
|
34
|
+
.version(rootPkg.version);
|
|
35
|
+
|
|
36
|
+
program
|
|
37
|
+
.command('init')
|
|
38
|
+
.description(t('cli.init.description'))
|
|
39
|
+
.argument('[directory]', t('cli.init.directory'), '.')
|
|
40
|
+
.option('-f, --force', t('cli.init.force'))
|
|
41
|
+
.action(async (directory, options) => {
|
|
42
|
+
const projectRoot = path.resolve(directory);
|
|
43
|
+
process.env.REACTPRESS_ORIGINAL_CWD = projectRoot;
|
|
44
|
+
const { isMonorepoCheckout } = require('../lib/bootstrap');
|
|
45
|
+
if (isMonorepoCheckout(projectRoot)) {
|
|
46
|
+
const result = await initMonorepoProject(projectRoot, { force: !!options.force });
|
|
47
|
+
console.log(`[reactpress] ${result.message}`);
|
|
48
|
+
process.exit(result.ok ? 0 : 1);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const args = ['init', directory];
|
|
52
|
+
if (options.force) args.push('--force');
|
|
53
|
+
runReactpressCli(args, { cwd: projectRoot });
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
program
|
|
57
|
+
.command('dev')
|
|
58
|
+
.description(t('cli.dev.description'))
|
|
59
|
+
.option('--api-only', t('cli.dev.apiOnly'))
|
|
60
|
+
.option('--client-only', t('cli.dev.clientOnly'))
|
|
61
|
+
.action(async (options) => {
|
|
62
|
+
const projectRoot = ensureOriginalCwd();
|
|
63
|
+
try {
|
|
64
|
+
if (options.clientOnly) {
|
|
65
|
+
await runNodeScript(getClientBin(), [], { cwd: projectRoot });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (options.apiOnly) {
|
|
69
|
+
await runApiDev(projectRoot);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
await runDev(projectRoot);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.error(chalk.red('[reactpress]'), err.message || err);
|
|
75
|
+
process.exit(err.exitCode ?? 1);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const serverCmd = program.command('server').description(t('cli.server.description'));
|
|
80
|
+
|
|
81
|
+
serverCmd
|
|
82
|
+
.command('start')
|
|
83
|
+
.description(t('cli.server.start.description'))
|
|
84
|
+
.option('--pm2', t('cli.server.start.pm2'))
|
|
85
|
+
.option('--bg', t('cli.server.start.bg'))
|
|
86
|
+
.action(async (options) => {
|
|
87
|
+
const projectRoot = ensureOriginalCwd();
|
|
88
|
+
try {
|
|
89
|
+
if (options.pm2) {
|
|
90
|
+
await startApiWithPm2(projectRoot);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const cmd = options.bg ? 'start:bg' : 'start';
|
|
94
|
+
const code = await runLifecycleCommand(cmd, projectRoot);
|
|
95
|
+
process.exit(code ?? 0);
|
|
96
|
+
} catch (err) {
|
|
97
|
+
console.error(chalk.red('[reactpress]'), err.message || err);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
serverCmd.command('stop').description(t('cli.server.stop')).action(async () => {
|
|
103
|
+
const code = await runLifecycleCommand('stop', ensureOriginalCwd());
|
|
104
|
+
process.exit(code ?? 0);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
serverCmd.command('restart').description(t('cli.server.restart')).action(async () => {
|
|
108
|
+
const code = await runLifecycleCommand('restart', ensureOriginalCwd());
|
|
109
|
+
process.exit(code ?? 0);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
serverCmd.command('status').description(t('cli.server.status')).action(async () => {
|
|
113
|
+
await runLifecycleCommand('status', ensureOriginalCwd());
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const clientCmd = program.command('client').description(t('cli.client.description'));
|
|
117
|
+
|
|
118
|
+
clientCmd
|
|
119
|
+
.command('start')
|
|
120
|
+
.description(t('cli.client.start'))
|
|
121
|
+
.option('--pm2', t('cli.client.start.pm2'))
|
|
122
|
+
.action(async (options) => {
|
|
123
|
+
const args = options.pm2 ? ['--pm2'] : [];
|
|
124
|
+
await runNodeScript(getClientBin(), args, { cwd: ensureOriginalCwd() });
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
program
|
|
128
|
+
.command('build')
|
|
129
|
+
.description(t('cli.build.description'))
|
|
130
|
+
.option('-t, --target <target>', 'toolkit | server | client | docs | all', 'all')
|
|
131
|
+
.action(async (options) => {
|
|
132
|
+
try {
|
|
133
|
+
await runBuild(options.target, ensureOriginalCwd());
|
|
134
|
+
} catch (err) {
|
|
135
|
+
console.error(chalk.red('[reactpress]'), err.message || err);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const dockerCmd = program.command('docker').description(t('cli.docker.description'));
|
|
141
|
+
|
|
142
|
+
dockerCmd
|
|
143
|
+
.command('up')
|
|
144
|
+
.description(t('cli.docker.up'))
|
|
145
|
+
.action(async () => {
|
|
146
|
+
await runDockerCommand('up', ensureOriginalCwd());
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
dockerCmd
|
|
150
|
+
.command('down')
|
|
151
|
+
.alias('stop')
|
|
152
|
+
.description(t('cli.docker.down'))
|
|
153
|
+
.action(async () => {
|
|
154
|
+
await runDockerCommand('down', ensureOriginalCwd());
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
dockerCmd
|
|
158
|
+
.command('start')
|
|
159
|
+
.description(t('cli.docker.start'))
|
|
160
|
+
.action(async () => {
|
|
161
|
+
await runDockerCommand('start', ensureOriginalCwd());
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
dockerCmd.command('restart').description(t('cli.docker.restart')).action(async () => {
|
|
165
|
+
await runDockerCommand('restart', ensureOriginalCwd());
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
dockerCmd.command('status').description(t('cli.docker.status')).action(async () => {
|
|
169
|
+
await runDockerCommand('status', ensureOriginalCwd());
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
dockerCmd
|
|
173
|
+
.command('logs [service]')
|
|
174
|
+
.description(t('cli.docker.logs'))
|
|
175
|
+
.action(async (service) => {
|
|
176
|
+
await runDockerCommand('logs', ensureOriginalCwd(), service ? [service] : []);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
program
|
|
180
|
+
.command('status')
|
|
181
|
+
.description(t('cli.status.description'))
|
|
182
|
+
.action(async () => {
|
|
183
|
+
await printUnifiedStatus(ensureOriginalCwd());
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
program
|
|
187
|
+
.command('doctor')
|
|
188
|
+
.description(t('cli.doctor.description'))
|
|
189
|
+
.action(async () => {
|
|
190
|
+
const code = await runDoctor(ensureOriginalCwd());
|
|
191
|
+
process.exit(code);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const dbCmd = program.command('db').description(t('cli.db.description'));
|
|
195
|
+
|
|
196
|
+
dbCmd
|
|
197
|
+
.command('backup')
|
|
198
|
+
.description(t('cli.db.backup'))
|
|
199
|
+
.option('-o, --output <file>', t('cli.db.backup.output'))
|
|
200
|
+
.action(async (options) => {
|
|
201
|
+
try {
|
|
202
|
+
await runDbBackup(ensureOriginalCwd(), options.output);
|
|
203
|
+
} catch (err) {
|
|
204
|
+
console.error(chalk.red('[reactpress]'), err.message || err);
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
program
|
|
210
|
+
.command('publish')
|
|
211
|
+
.description(t('cli.publish.description'))
|
|
212
|
+
.option('--build', t('cli.publish.build'))
|
|
213
|
+
.option('--publish', t('cli.publish.publish'))
|
|
214
|
+
.action(async (options) => {
|
|
215
|
+
const prev = process.argv.slice();
|
|
216
|
+
const args = [process.argv[0], process.argv[1]];
|
|
217
|
+
if (options.build) args.push('--build');
|
|
218
|
+
else if (options.publish) args.push('--publish');
|
|
219
|
+
else args.push('--publish');
|
|
220
|
+
process.argv = args;
|
|
221
|
+
try {
|
|
222
|
+
await require('../lib/publish').main();
|
|
223
|
+
} catch (err) {
|
|
224
|
+
console.error(chalk.red('[reactpress]'), err.message || err);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
} finally {
|
|
227
|
+
process.argv = prev;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
program
|
|
232
|
+
.command('start')
|
|
233
|
+
.description(t('cli.start.description'))
|
|
234
|
+
.action(async () => {
|
|
235
|
+
const projectRoot = ensureOriginalCwd();
|
|
236
|
+
const { spawn } = require('child_process');
|
|
237
|
+
const code = await runLifecycleCommand('start', projectRoot);
|
|
238
|
+
if (code !== 0) process.exit(code);
|
|
239
|
+
const child = spawn('pnpm', ['run', '--dir', './client', 'start'], {
|
|
240
|
+
stdio: 'inherit',
|
|
241
|
+
shell: true,
|
|
242
|
+
cwd: projectRoot,
|
|
243
|
+
});
|
|
244
|
+
child.on('close', (c) => process.exit(c ?? 0));
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
program.on('--help', () => {
|
|
248
|
+
console.log('');
|
|
249
|
+
console.log(chalk.gray(t('cli.help.examples')));
|
|
250
|
+
console.log(t('cli.help.interactive'));
|
|
251
|
+
console.log(t('cli.help.dev'));
|
|
252
|
+
console.log(t('cli.help.init'));
|
|
253
|
+
console.log(t('cli.help.server'));
|
|
254
|
+
console.log(t('cli.help.status'));
|
|
255
|
+
console.log(t('cli.help.doctor'));
|
|
256
|
+
console.log(t('cli.help.docker'));
|
|
257
|
+
console.log(t('cli.help.publish'));
|
|
258
|
+
console.log('');
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
async function main() {
|
|
262
|
+
const argv = process.argv.slice(2);
|
|
263
|
+
if (argv.length === 0) {
|
|
264
|
+
await runInteractiveLoop();
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
program.parse(process.argv);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
main().catch((err) => {
|
|
271
|
+
console.error(chalk.red('[reactpress]'), err.message || err);
|
|
272
|
+
process.exit(1);
|
|
273
|
+
});
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBpC,wBAAgB,aAAa,IAAI,OAAO,CAiFvC;AAED,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQzE"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { runInitCommand } from './commands/init.js';
|
|
6
|
+
import { runStartCommand } from './commands/start.js';
|
|
7
|
+
import { runStopCommand } from './commands/stop.js';
|
|
8
|
+
import { runRestartCommand } from './commands/restart.js';
|
|
9
|
+
import { runStatusCommand } from './commands/status.js';
|
|
10
|
+
import { runConfigCommand } from './commands/config.js';
|
|
11
|
+
import { printBanner, logger } from './utils/logger.js';
|
|
12
|
+
import { setProjectCwd } from './utils/cli-context.js';
|
|
13
|
+
function getVersion() {
|
|
14
|
+
try {
|
|
15
|
+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
|
16
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
17
|
+
return pkg.version;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return '1.0.0';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function createProgram() {
|
|
24
|
+
const program = new Command();
|
|
25
|
+
program
|
|
26
|
+
.name('reactpress-cli')
|
|
27
|
+
.description('零配置初始化与管理 ReactPress CMS & 博客服务器')
|
|
28
|
+
.version(getVersion())
|
|
29
|
+
.option('--cwd <dir>', 'ReactPress 项目目录(默认:当前工作目录)')
|
|
30
|
+
.hook('preAction', (thisCommand) => {
|
|
31
|
+
printBanner();
|
|
32
|
+
const opts = thisCommand.optsWithGlobals();
|
|
33
|
+
setProjectCwd(opts.cwd);
|
|
34
|
+
});
|
|
35
|
+
program
|
|
36
|
+
.command('init')
|
|
37
|
+
.description('一键初始化 ReactPress CMS & 博客服务器(零配置)')
|
|
38
|
+
.argument('[directory]', '项目目录', '.')
|
|
39
|
+
.option('-f, --force', '覆盖已有配置')
|
|
40
|
+
.action(async (directory, opts) => {
|
|
41
|
+
const code = await runInitCommand({
|
|
42
|
+
directory,
|
|
43
|
+
force: opts.force,
|
|
44
|
+
});
|
|
45
|
+
process.exitCode = code;
|
|
46
|
+
});
|
|
47
|
+
program
|
|
48
|
+
.command('start')
|
|
49
|
+
.description('启动服务器(自动准备数据库)')
|
|
50
|
+
.action(async () => {
|
|
51
|
+
process.exitCode = await runStartCommand();
|
|
52
|
+
});
|
|
53
|
+
program
|
|
54
|
+
.command('stop')
|
|
55
|
+
.description('停止服务器')
|
|
56
|
+
.option('--database', '同时停止嵌入式数据库容器')
|
|
57
|
+
.action(async (opts) => {
|
|
58
|
+
process.exitCode = await runStopCommand({ database: opts.database });
|
|
59
|
+
});
|
|
60
|
+
program
|
|
61
|
+
.command('restart')
|
|
62
|
+
.description('重启服务器')
|
|
63
|
+
.action(async () => {
|
|
64
|
+
process.exitCode = await runRestartCommand();
|
|
65
|
+
});
|
|
66
|
+
program
|
|
67
|
+
.command('status')
|
|
68
|
+
.description('查看服务与数据库状态')
|
|
69
|
+
.action(async () => {
|
|
70
|
+
process.exitCode = await runStatusCommand();
|
|
71
|
+
});
|
|
72
|
+
program
|
|
73
|
+
.command('config')
|
|
74
|
+
.description('查看或更新配置(更新后可用 --apply 重启生效)')
|
|
75
|
+
.argument('[key]', '配置键,如 server.port')
|
|
76
|
+
.argument('[value]', '新值')
|
|
77
|
+
.option('-l, --list', '列出所有配置')
|
|
78
|
+
.option('-a, --apply', '更新后自动重启服务')
|
|
79
|
+
.action(async (key, value, opts) => {
|
|
80
|
+
process.exitCode = await runConfigCommand({
|
|
81
|
+
key,
|
|
82
|
+
value,
|
|
83
|
+
list: opts.list,
|
|
84
|
+
apply: opts.apply,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
program.on('command:*', () => {
|
|
88
|
+
logger.error(`未知命令: ${program.args.join(' ')}`);
|
|
89
|
+
program.outputHelp();
|
|
90
|
+
process.exitCode = 1;
|
|
91
|
+
});
|
|
92
|
+
return program;
|
|
93
|
+
}
|
|
94
|
+
export async function runCli(argv = process.argv) {
|
|
95
|
+
const program = createProgram();
|
|
96
|
+
await program.parseAsync(argv);
|
|
97
|
+
if (!argv.slice(2).length) {
|
|
98
|
+
program.outputHelp();
|
|
99
|
+
process.exitCode = 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":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