@fecommunity/reactpress 2.0.0-beta.0 → 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 +244 -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 +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/publish-packages.js → lib/publish.js} +255 -58
- package/lib/root.js +31 -0
- package/lib/spawn.js +91 -0
- package/lib/status.js +108 -0
- package/package.json +34 -72
- 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/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
|
@@ -6,28 +6,30 @@ const path = require('path');
|
|
|
6
6
|
const chalk = require('chalk');
|
|
7
7
|
const inquirer = require('inquirer');
|
|
8
8
|
const crypto = require('crypto');
|
|
9
|
+
const { t } = require('./i18n');
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
function getPackages() {
|
|
12
|
+
return [
|
|
12
13
|
{
|
|
13
|
-
name: '@fecommunity/reactpress
|
|
14
|
-
path: '
|
|
15
|
-
description: '
|
|
14
|
+
name: '@fecommunity/reactpress',
|
|
15
|
+
path: 'cli',
|
|
16
|
+
description: t('publish.pkg.main')
|
|
16
17
|
},
|
|
17
18
|
{
|
|
18
|
-
name: '@fecommunity/reactpress-
|
|
19
|
-
path: '
|
|
20
|
-
description: '
|
|
19
|
+
name: '@fecommunity/reactpress-toolkit',
|
|
20
|
+
path: 'toolkit',
|
|
21
|
+
description: 'API client and utilities toolkit'
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
name: '@fecommunity/reactpress-client',
|
|
24
|
-
path: 'client',
|
|
25
|
+
path: 'client',
|
|
25
26
|
description: 'Frontend application package'
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
|
-
name: '@fecommunity/reactpress-
|
|
29
|
-
path: '
|
|
30
|
-
description: '
|
|
29
|
+
name: '@fecommunity/reactpress-server',
|
|
30
|
+
path: 'server',
|
|
31
|
+
description: t('publish.pkg.server'),
|
|
32
|
+
deprecated: true
|
|
31
33
|
},
|
|
32
34
|
{
|
|
33
35
|
name: '@fecommunity/reactpress-template-hello-world',
|
|
@@ -40,6 +42,9 @@ const packages = [
|
|
|
40
42
|
description: 'Twenty Twenty Five blog template for ReactPress'
|
|
41
43
|
}
|
|
42
44
|
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const packages = getPackages();
|
|
43
48
|
|
|
44
49
|
// Generate a hash for a file or directory
|
|
45
50
|
function generateHash(filePath) {
|
|
@@ -66,8 +71,31 @@ function getPackageHash(packagePath) {
|
|
|
66
71
|
return generateHash(fullPath);
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
// Check if package has meaningful changes
|
|
70
|
-
function
|
|
74
|
+
// Check if package has meaningful changes (for build)
|
|
75
|
+
function hasMeaningfulChangesForBuild(packagePath, packageName) {
|
|
76
|
+
try {
|
|
77
|
+
// Create a hash file path to store previous hash in node_modules
|
|
78
|
+
const hashFilePath = path.join(process.cwd(), 'node_modules', '.build-cache', `${packageName.replace('/', '_')}.hash`);
|
|
79
|
+
|
|
80
|
+
// Generate current hash
|
|
81
|
+
const currentHash = getPackageHash(packagePath);
|
|
82
|
+
|
|
83
|
+
// Check if we have a previous hash
|
|
84
|
+
if (fs.existsSync(hashFilePath)) {
|
|
85
|
+
const previousHash = fs.readFileSync(hashFilePath, 'utf8').trim();
|
|
86
|
+
return currentHash !== previousHash;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// If no previous hash, consider it as having changes
|
|
90
|
+
return true;
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.log(chalk.yellow(`⚠️ Could not check changes for ${packageName}, assuming changes exist`));
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Check if package has meaningful changes (for publish)
|
|
98
|
+
function hasMeaningfulChangesForPublish(packagePath, packageName) {
|
|
71
99
|
try {
|
|
72
100
|
// Create a hash file path to store previous hash in node_modules
|
|
73
101
|
const hashFilePath = path.join(process.cwd(), 'node_modules', '.publish-cache', `${packageName.replace('/', '_')}.hash`);
|
|
@@ -89,8 +117,27 @@ function hasMeaningfulChanges(packagePath, packageName) {
|
|
|
89
117
|
}
|
|
90
118
|
}
|
|
91
119
|
|
|
92
|
-
// Save package hash
|
|
93
|
-
function
|
|
120
|
+
// Save package hash (for build)
|
|
121
|
+
function savePackageHashForBuild(packagePath, packageName) {
|
|
122
|
+
try {
|
|
123
|
+
const hashFilePath = path.join(process.cwd(), 'node_modules', '.build-cache', `${packageName.replace('/', '_')}.hash`);
|
|
124
|
+
|
|
125
|
+
// Ensure cache directory exists
|
|
126
|
+
const cacheDir = path.dirname(hashFilePath);
|
|
127
|
+
if (!fs.existsSync(cacheDir)) {
|
|
128
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Generate and save current hash
|
|
132
|
+
const currentHash = getPackageHash(packagePath);
|
|
133
|
+
fs.writeFileSync(hashFilePath, currentHash);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.log(chalk.yellow(`⚠️ Could not save hash for ${packageName}`));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Save package hash (for publish)
|
|
140
|
+
function savePackageHashForPublish(packagePath, packageName) {
|
|
94
141
|
try {
|
|
95
142
|
const hashFilePath = path.join(process.cwd(), 'node_modules', '.publish-cache', `${packageName.replace('/', '_')}.hash`);
|
|
96
143
|
|
|
@@ -209,8 +256,67 @@ function updateVersion(packagePath, newVersion) {
|
|
|
209
256
|
console.log(chalk.green(`✅ Version updated from ${oldVersion} to ${newVersion}`));
|
|
210
257
|
}
|
|
211
258
|
|
|
259
|
+
// Fix workspace dependencies for build
|
|
260
|
+
function fixWorkspaceDependenciesForBuild(packagePath) {
|
|
261
|
+
console.log(chalk.blue(`🔧 Fixing workspace dependencies for build: ${packagePath}...`));
|
|
262
|
+
|
|
263
|
+
const pkgPath = path.join(process.cwd(), packagePath, 'package.json');
|
|
264
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
265
|
+
|
|
266
|
+
// Fix dependencies
|
|
267
|
+
const depTypes = ['dependencies', 'devDependencies', 'peerDependencies'];
|
|
268
|
+
|
|
269
|
+
depTypes.forEach(depType => {
|
|
270
|
+
if (pkg[depType]) {
|
|
271
|
+
Object.keys(pkg[depType]).forEach(depName => {
|
|
272
|
+
// Check if it's a workspace dependency
|
|
273
|
+
if (pkg[depType][depName] === 'workspace:*' || pkg[depType][depName].startsWith('workspace:')) {
|
|
274
|
+
// For build purposes, we'll use the file: protocol to reference local packages
|
|
275
|
+
const depPackage = packages.find(p => p.name === depName);
|
|
276
|
+
if (depPackage) {
|
|
277
|
+
console.log(chalk.gray(` Replacing ${depName} workspace dependency with file reference`));
|
|
278
|
+
pkg[depType][depName] = `file:../${depPackage.path}`;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
// Write the updated package.json
|
|
286
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
287
|
+
console.log(chalk.green(`✅ Workspace dependencies fixed for build: ${packagePath}`));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Restore workspace dependencies after build
|
|
291
|
+
function restoreWorkspaceDependenciesAfterBuild(packagePath) {
|
|
292
|
+
console.log(chalk.blue(`🔄 Restoring workspace dependencies after build: ${packagePath}...`));
|
|
293
|
+
|
|
294
|
+
const pkgPath = path.join(process.cwd(), packagePath, 'package.json');
|
|
295
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
296
|
+
|
|
297
|
+
// Restore dependencies
|
|
298
|
+
const depTypes = ['dependencies', 'devDependencies', 'peerDependencies'];
|
|
299
|
+
|
|
300
|
+
depTypes.forEach(depType => {
|
|
301
|
+
if (pkg[depType]) {
|
|
302
|
+
Object.keys(pkg[depType]).forEach(depName => {
|
|
303
|
+
// Check if this is one of our internal packages referenced with file:
|
|
304
|
+
const depPackage = packages.find(p => p.name === depName);
|
|
305
|
+
if (depPackage && pkg[depType][depName].startsWith('file:')) {
|
|
306
|
+
console.log(chalk.gray(` Restoring ${depName} to workspace dependency`));
|
|
307
|
+
pkg[depType][depName] = 'workspace:*';
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// Write the updated package.json
|
|
314
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
315
|
+
console.log(chalk.green(`✅ Workspace dependencies restored after build: ${packagePath}`));
|
|
316
|
+
}
|
|
317
|
+
|
|
212
318
|
// Fix workspace dependencies for publish
|
|
213
|
-
function
|
|
319
|
+
function fixWorkspaceDependenciesForPublish(packagePath, packageVersions) {
|
|
214
320
|
console.log(chalk.blue(`🔧 Fixing workspace dependencies for publish: ${packagePath}...`));
|
|
215
321
|
|
|
216
322
|
const pkgPath = path.join(process.cwd(), packagePath, 'package.json');
|
|
@@ -241,7 +347,7 @@ function fixWorkspaceDependencies(packagePath, packageVersions) {
|
|
|
241
347
|
}
|
|
242
348
|
|
|
243
349
|
// Restore workspace dependencies after publish
|
|
244
|
-
function
|
|
350
|
+
function restoreWorkspaceDependenciesAfterPublish(packagePath) {
|
|
245
351
|
console.log(chalk.blue(`🔄 Restoring workspace dependencies for ${packagePath}...`));
|
|
246
352
|
|
|
247
353
|
const pkgPath = path.join(process.cwd(), packagePath, 'package.json');
|
|
@@ -269,25 +375,31 @@ function restoreWorkspaceDependencies(packagePath) {
|
|
|
269
375
|
}
|
|
270
376
|
|
|
271
377
|
// Build package
|
|
272
|
-
function buildPackage(
|
|
273
|
-
console.log(chalk.blue(`\n🔨 Building ${
|
|
378
|
+
function buildPackage(pkg) {
|
|
379
|
+
console.log(chalk.blue(`\n🔨 Building ${pkg.name} (${pkg.description})...`));
|
|
274
380
|
|
|
275
381
|
try {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
382
|
+
// Fix workspace dependencies for build
|
|
383
|
+
fixWorkspaceDependenciesForBuild(pkg.path);
|
|
384
|
+
|
|
385
|
+
try {
|
|
386
|
+
if (pkg.path === 'config') {
|
|
387
|
+
execSync('pnpm run build', { cwd: path.join(process.cwd(), pkg.path), stdio: 'inherit' });
|
|
388
|
+
} else if (pkg.path === 'client') {
|
|
389
|
+
execSync('pnpm run prebuild && pnpm run build', { cwd: path.join(process.cwd(), pkg.path), stdio: 'inherit' });
|
|
390
|
+
} else if (pkg.path === 'toolkit') {
|
|
391
|
+
execSync('pnpm run build', { cwd: path.join(process.cwd(), pkg.path), stdio: 'inherit' });
|
|
392
|
+
} else if (pkg.path === 'templates/hello-world' || pkg.path === 'templates/twentytwentyfive') {
|
|
393
|
+
// Templates don't need to be built, just validate package.json
|
|
394
|
+
console.log(chalk.gray(' Templates do not require building, skipping...'));
|
|
395
|
+
}
|
|
396
|
+
console.log(chalk.green(`✅ ${pkg.name} built successfully`));
|
|
397
|
+
} finally {
|
|
398
|
+
// Always restore workspace dependencies
|
|
399
|
+
restoreWorkspaceDependenciesAfterBuild(pkg.path);
|
|
400
|
+
}
|
|
289
401
|
} catch (error) {
|
|
290
|
-
console.log(chalk.red(`❌ Failed to build ${
|
|
402
|
+
console.log(chalk.red(`❌ Failed to build ${pkg.name}`));
|
|
291
403
|
throw error;
|
|
292
404
|
}
|
|
293
405
|
}
|
|
@@ -342,8 +454,57 @@ function checkEnvironment() {
|
|
|
342
454
|
return true;
|
|
343
455
|
}
|
|
344
456
|
|
|
345
|
-
//
|
|
346
|
-
async function
|
|
457
|
+
// Build packages function
|
|
458
|
+
async function buildPackages() {
|
|
459
|
+
console.log(chalk.blue('🏗️ ReactPress Package Builder\n'));
|
|
460
|
+
|
|
461
|
+
// Show current versions
|
|
462
|
+
console.log(chalk.cyan('📋 Current package versions:'));
|
|
463
|
+
packages.forEach(pkg => {
|
|
464
|
+
const version = getCurrentVersion(pkg.path);
|
|
465
|
+
console.log(chalk.gray(` ${pkg.name}: ${version}`));
|
|
466
|
+
});
|
|
467
|
+
console.log();
|
|
468
|
+
|
|
469
|
+
try {
|
|
470
|
+
// Track which packages actually need to be built
|
|
471
|
+
const packagesToBuild = [];
|
|
472
|
+
|
|
473
|
+
// Check for meaningful changes in each package
|
|
474
|
+
for (const pkg of packages) {
|
|
475
|
+
if (fs.existsSync(path.join(process.cwd(), pkg.path))) {
|
|
476
|
+
if (hasMeaningfulChangesForBuild(pkg.path, pkg.name)) {
|
|
477
|
+
packagesToBuild.push(pkg);
|
|
478
|
+
console.log(chalk.blue(`\n📦 ${pkg.name} has changes, will be built`));
|
|
479
|
+
} else {
|
|
480
|
+
console.log(chalk.gray(`\n⏭️ ${pkg.name} has no meaningful changes, skipping...`));
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
console.log(chalk.yellow(`⚠️ Package ${pkg.name} directory not found, skipping...`));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if (packagesToBuild.length === 0) {
|
|
488
|
+
console.log(chalk.green('\n✅ No packages have meaningful changes. Nothing to build!'));
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// Build packages that have changes
|
|
493
|
+
for (const pkg of packagesToBuild) {
|
|
494
|
+
await buildPackage(pkg);
|
|
495
|
+
// Save the hash after successful build
|
|
496
|
+
savePackageHashForBuild(pkg.path, pkg.name);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
console.log(chalk.green(`\n🎉 ${packagesToBuild.length} package(s) built successfully!`));
|
|
500
|
+
} catch (error) {
|
|
501
|
+
console.error(chalk.red('❌ Build failed:'), error);
|
|
502
|
+
process.exit(1);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// Publish packages function
|
|
507
|
+
async function publishPackages() {
|
|
347
508
|
// Check if called with --no-build flag
|
|
348
509
|
const noBuild = process.argv.includes('--no-build');
|
|
349
510
|
|
|
@@ -392,7 +553,7 @@ async function main() {
|
|
|
392
553
|
// Check for meaningful changes in each package
|
|
393
554
|
for (const pkg of packages) {
|
|
394
555
|
if (fs.existsSync(path.join(process.cwd(), pkg.path))) {
|
|
395
|
-
if (
|
|
556
|
+
if (hasMeaningfulChangesForPublish(pkg.path, pkg.name)) {
|
|
396
557
|
packagesToBuild.push(pkg);
|
|
397
558
|
console.log(chalk.blue(`\n📦 ${pkg.name} has changes, will be built`));
|
|
398
559
|
} else {
|
|
@@ -410,9 +571,9 @@ async function main() {
|
|
|
410
571
|
|
|
411
572
|
// Build packages that have changes
|
|
412
573
|
for (const pkg of packagesToBuild) {
|
|
413
|
-
buildPackage(pkg
|
|
574
|
+
buildPackage(pkg);
|
|
414
575
|
// Save the hash after successful build
|
|
415
|
-
|
|
576
|
+
savePackageHashForPublish(pkg.path, pkg.name);
|
|
416
577
|
}
|
|
417
578
|
|
|
418
579
|
console.log(chalk.green(`\n🎉 ${packagesToBuild.length} package(s) built successfully!`));
|
|
@@ -433,7 +594,7 @@ async function main() {
|
|
|
433
594
|
]);
|
|
434
595
|
|
|
435
596
|
// Check if the selected package has meaningful changes
|
|
436
|
-
if (!
|
|
597
|
+
if (!hasMeaningfulChangesForPublish(selectedPackage.path, selectedPackage.name)) {
|
|
437
598
|
console.log(chalk.gray(`\n⏭️ ${selectedPackage.name} has no meaningful changes, skipping...`));
|
|
438
599
|
console.log(chalk.green('✅ Nothing to publish!'));
|
|
439
600
|
return;
|
|
@@ -483,13 +644,13 @@ async function main() {
|
|
|
483
644
|
packageVersions[selectedPackage.name] = newVersion;
|
|
484
645
|
|
|
485
646
|
// Fix workspace dependencies before publishing
|
|
486
|
-
|
|
647
|
+
fixWorkspaceDependenciesForPublish(selectedPackage.path, packageVersions);
|
|
487
648
|
|
|
488
649
|
try {
|
|
489
650
|
updateVersion(selectedPackage.path, newVersion);
|
|
490
651
|
// Only build if not disabled
|
|
491
652
|
if (!noBuild) {
|
|
492
|
-
buildPackage(selectedPackage
|
|
653
|
+
buildPackage(selectedPackage);
|
|
493
654
|
}
|
|
494
655
|
|
|
495
656
|
// Determine tag based on version type
|
|
@@ -497,12 +658,12 @@ async function main() {
|
|
|
497
658
|
publishPackage(selectedPackage.path, selectedPackage.name, tag);
|
|
498
659
|
|
|
499
660
|
// Save the hash after successful publish
|
|
500
|
-
|
|
661
|
+
savePackageHashForPublish(selectedPackage.path, selectedPackage.name);
|
|
501
662
|
|
|
502
663
|
console.log(chalk.green(`\n🎉 ${selectedPackage.name} v${newVersion} published successfully!`));
|
|
503
664
|
} finally {
|
|
504
665
|
// Always restore workspace dependencies
|
|
505
|
-
|
|
666
|
+
restoreWorkspaceDependenciesAfterPublish(selectedPackage.path);
|
|
506
667
|
}
|
|
507
668
|
|
|
508
669
|
return;
|
|
@@ -550,7 +711,7 @@ async function main() {
|
|
|
550
711
|
continue;
|
|
551
712
|
}
|
|
552
713
|
|
|
553
|
-
if (
|
|
714
|
+
if (hasMeaningfulChangesForPublish(pkg.path, pkg.name)) {
|
|
554
715
|
packagesToPublish.push(pkg);
|
|
555
716
|
console.log(chalk.blue(`\n📦 ${pkg.name} has changes, will be published`));
|
|
556
717
|
} else {
|
|
@@ -586,21 +747,21 @@ async function main() {
|
|
|
586
747
|
packageVersions[pkg.name] = newVersion;
|
|
587
748
|
|
|
588
749
|
// Fix workspace dependencies before publishing
|
|
589
|
-
|
|
750
|
+
fixWorkspaceDependenciesForPublish(pkg.path, packageVersions);
|
|
590
751
|
|
|
591
752
|
try {
|
|
592
753
|
updateVersion(pkg.path, newVersion);
|
|
593
754
|
// Only build if not disabled
|
|
594
755
|
if (!noBuild) {
|
|
595
|
-
buildPackage(pkg
|
|
756
|
+
buildPackage(pkg);
|
|
596
757
|
}
|
|
597
758
|
publishPackage(pkg.path, pkg.name, tag);
|
|
598
759
|
|
|
599
760
|
// Save the hash after successful publish
|
|
600
|
-
|
|
761
|
+
savePackageHashForPublish(pkg.path, pkg.name);
|
|
601
762
|
} finally {
|
|
602
763
|
// Always restore workspace dependencies
|
|
603
|
-
|
|
764
|
+
restoreWorkspaceDependenciesAfterPublish(pkg.path);
|
|
604
765
|
}
|
|
605
766
|
}
|
|
606
767
|
|
|
@@ -689,7 +850,7 @@ async function main() {
|
|
|
689
850
|
continue;
|
|
690
851
|
}
|
|
691
852
|
|
|
692
|
-
if (
|
|
853
|
+
if (hasMeaningfulChangesForPublish(pkg.path, pkg.name)) {
|
|
693
854
|
packagesToPublish.push(pkg);
|
|
694
855
|
console.log(chalk.blue(`\n📦 ${pkg.name} has changes, will be published`));
|
|
695
856
|
} else {
|
|
@@ -711,13 +872,13 @@ async function main() {
|
|
|
711
872
|
packageVersions[pkg.name] = pkgVersion;
|
|
712
873
|
|
|
713
874
|
// Fix workspace dependencies before publishing
|
|
714
|
-
|
|
875
|
+
fixWorkspaceDependenciesForPublish(pkg.path, packageVersions);
|
|
715
876
|
|
|
716
877
|
try {
|
|
717
878
|
updateVersion(pkg.path, pkgVersion);
|
|
718
879
|
// Only build if not disabled
|
|
719
880
|
if (!noBuild) {
|
|
720
|
-
buildPackage(pkg
|
|
881
|
+
buildPackage(pkg);
|
|
721
882
|
}
|
|
722
883
|
|
|
723
884
|
// Determine tag based on version type and branch
|
|
@@ -725,10 +886,10 @@ async function main() {
|
|
|
725
886
|
publishPackage(pkg.path, pkg.name, tag);
|
|
726
887
|
|
|
727
888
|
// Save the hash after successful publish
|
|
728
|
-
|
|
889
|
+
savePackageHashForPublish(pkg.path, pkg.name);
|
|
729
890
|
} finally {
|
|
730
891
|
// Always restore workspace dependencies
|
|
731
|
-
|
|
892
|
+
restoreWorkspaceDependenciesAfterPublish(pkg.path);
|
|
732
893
|
}
|
|
733
894
|
}
|
|
734
895
|
|
|
@@ -749,7 +910,43 @@ ${Object.entries(packageVersions).map(([name, version]) => `- ${name}@${version}
|
|
|
749
910
|
}
|
|
750
911
|
}
|
|
751
912
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
913
|
+
// Main function
|
|
914
|
+
async function main() {
|
|
915
|
+
// Check command line arguments
|
|
916
|
+
const args = process.argv.slice(2);
|
|
917
|
+
|
|
918
|
+
if (args.includes('--publish')) {
|
|
919
|
+
// When called with --publish, start the publish process
|
|
920
|
+
console.log(chalk.blue('🏗️ ReactPress Package Builder\n'));
|
|
921
|
+
|
|
922
|
+
// Show current versions
|
|
923
|
+
console.log(chalk.cyan('📋 Current package versions:'));
|
|
924
|
+
packages.forEach(pkg => {
|
|
925
|
+
const version = getCurrentVersion(pkg.path);
|
|
926
|
+
console.log(chalk.gray(` ${pkg.name}: ${version}`));
|
|
927
|
+
});
|
|
928
|
+
console.log();
|
|
929
|
+
|
|
930
|
+
// Start the publish process
|
|
931
|
+
await publishPackages();
|
|
932
|
+
} else if (args.includes('--build')) {
|
|
933
|
+
// When called with --build, just build packages
|
|
934
|
+
await buildPackages();
|
|
935
|
+
} else {
|
|
936
|
+
// Default behavior - show help
|
|
937
|
+
console.log(chalk.blue('🏗️ ReactPress CLI\n'));
|
|
938
|
+
console.log('Usage:');
|
|
939
|
+
console.log(' reactpress publish --build Build all packages');
|
|
940
|
+
console.log(' reactpress publish --publish Publish packages (interactive)');
|
|
941
|
+
console.log('');
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
module.exports = { main, buildPackages, publishPackages };
|
|
946
|
+
|
|
947
|
+
if (require.main === module) {
|
|
948
|
+
main().catch((error) => {
|
|
949
|
+
console.error(chalk.red('❌ Operation failed:'), error);
|
|
950
|
+
process.exit(1);
|
|
951
|
+
});
|
|
952
|
+
}
|
package/lib/root.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/** Monorepo root (parent of cli/) */
|
|
5
|
+
function getMonorepoRoot() {
|
|
6
|
+
return path.resolve(__dirname, '../..');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getProjectRoot() {
|
|
10
|
+
return path.resolve(process.env.REACTPRESS_ORIGINAL_CWD || process.cwd());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function ensureOriginalCwd() {
|
|
14
|
+
const root = getProjectRoot();
|
|
15
|
+
process.env.REACTPRESS_ORIGINAL_CWD = root;
|
|
16
|
+
return root;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isMonorepoCheckout(cwd = getMonorepoRoot()) {
|
|
20
|
+
return (
|
|
21
|
+
fs.existsSync(path.join(cwd, 'pnpm-workspace.yaml')) ||
|
|
22
|
+
fs.existsSync(path.join(cwd, 'server', 'src', 'main.ts'))
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = {
|
|
27
|
+
getMonorepoRoot,
|
|
28
|
+
getProjectRoot,
|
|
29
|
+
ensureOriginalCwd,
|
|
30
|
+
isMonorepoCheckout,
|
|
31
|
+
};
|
package/lib/spawn.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const { spawn, spawnSync } = require('child_process');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const { getMonorepoRoot } = require('./root');
|
|
5
|
+
const { getCliPackageRoot } = require('./paths');
|
|
6
|
+
const { t, resolveLocale } = require('./i18n');
|
|
7
|
+
|
|
8
|
+
function runSync(command, args, options = {}) {
|
|
9
|
+
const result = spawnSync(command, args, {
|
|
10
|
+
cwd: options.cwd || getMonorepoRoot(),
|
|
11
|
+
stdio: 'inherit',
|
|
12
|
+
env: {
|
|
13
|
+
...process.env,
|
|
14
|
+
REACTPRESS_LANG: process.env.REACTPRESS_LANG || resolveLocale(),
|
|
15
|
+
REACTPRESS_ORIGINAL_CWD:
|
|
16
|
+
options.cwd || process.env.REACTPRESS_ORIGINAL_CWD || process.cwd(),
|
|
17
|
+
},
|
|
18
|
+
shell: options.shell ?? false,
|
|
19
|
+
});
|
|
20
|
+
if (result.status !== 0) {
|
|
21
|
+
const err = new Error(
|
|
22
|
+
t('spawn.commandFailed', { command, code: result.status ?? 1 })
|
|
23
|
+
);
|
|
24
|
+
err.exitCode = result.status ?? 1;
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function runNodeScript(scriptPath, args = [], options = {}) {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const child = spawn(process.execPath, [scriptPath, ...args], {
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
cwd: options.cwd || getMonorepoRoot(),
|
|
35
|
+
env: {
|
|
36
|
+
...process.env,
|
|
37
|
+
REACTPRESS_LANG: process.env.REACTPRESS_LANG || resolveLocale(),
|
|
38
|
+
REACTPRESS_ORIGINAL_CWD:
|
|
39
|
+
options.cwd || process.env.REACTPRESS_ORIGINAL_CWD || process.cwd(),
|
|
40
|
+
...options.env,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
child.on('error', (error) => {
|
|
45
|
+
console.error(chalk.red('[ReactPress]'), error.message || error);
|
|
46
|
+
reject(error);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
child.on('close', (code) => {
|
|
50
|
+
if (code !== 0) {
|
|
51
|
+
reject(Object.assign(new Error(t('spawn.exitCode', { code })), { exitCode: code }));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
resolve(code);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function spawnDetached(scriptPath, args = [], options = {}) {
|
|
60
|
+
const child = spawn(process.execPath, [scriptPath, ...args], {
|
|
61
|
+
stdio: options.stdio ?? 'ignore',
|
|
62
|
+
detached: true,
|
|
63
|
+
cwd: options.cwd,
|
|
64
|
+
env: {
|
|
65
|
+
...process.env,
|
|
66
|
+
REACTPRESS_LANG: process.env.REACTPRESS_LANG || resolveLocale(),
|
|
67
|
+
REACTPRESS_ORIGINAL_CWD:
|
|
68
|
+
options.cwd || process.env.REACTPRESS_ORIGINAL_CWD || process.cwd(),
|
|
69
|
+
...options.env,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
child.unref();
|
|
73
|
+
return child;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function runReactpressCli(args, options = {}) {
|
|
77
|
+
const cliBin = path.join(getCliPackageRoot(), 'dist', 'index.js');
|
|
78
|
+
return runSync(process.execPath, [cliBin, ...args], options);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function resolveCliScript(relativePath) {
|
|
82
|
+
return path.join(__dirname, '..', relativePath);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = {
|
|
86
|
+
runSync,
|
|
87
|
+
runNodeScript,
|
|
88
|
+
spawnDetached,
|
|
89
|
+
runReactpressCli,
|
|
90
|
+
resolveCliScript,
|
|
91
|
+
};
|