@fecommunity/reactpress 2.0.0-beta.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. package/LICENSE +6 -6
  2. package/README.md +28 -176
  3. package/bin/reactpress-cli-shim.js +28 -0
  4. package/bin/reactpress.js +245 -61
  5. package/dist/cli.d.ts +4 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +102 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/commands/config.d.ts +8 -0
  10. package/dist/commands/config.d.ts.map +1 -0
  11. package/dist/commands/config.js +54 -0
  12. package/dist/commands/config.js.map +1 -0
  13. package/dist/commands/init.d.ts +6 -0
  14. package/dist/commands/init.d.ts.map +1 -0
  15. package/dist/commands/init.js +33 -0
  16. package/dist/commands/init.js.map +1 -0
  17. package/dist/commands/restart.d.ts +2 -0
  18. package/dist/commands/restart.d.ts.map +1 -0
  19. package/dist/commands/restart.js +29 -0
  20. package/dist/commands/restart.js.map +1 -0
  21. package/dist/commands/start.d.ts +2 -0
  22. package/dist/commands/start.d.ts.map +1 -0
  23. package/dist/commands/start.js +31 -0
  24. package/dist/commands/start.js.map +1 -0
  25. package/dist/commands/status.d.ts +2 -0
  26. package/dist/commands/status.d.ts.map +1 -0
  27. package/dist/commands/status.js +20 -0
  28. package/dist/commands/status.js.map +1 -0
  29. package/dist/commands/stop.d.ts +5 -0
  30. package/dist/commands/stop.d.ts.map +1 -0
  31. package/dist/commands/stop.js +29 -0
  32. package/dist/commands/stop.js.map +1 -0
  33. package/dist/i18n.js +8 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +7 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/package.json +3 -0
  39. package/dist/services/config.d.ts +11 -0
  40. package/dist/services/config.d.ts.map +1 -0
  41. package/dist/services/config.js +102 -0
  42. package/dist/services/config.js.map +1 -0
  43. package/dist/services/database.d.ts +43 -0
  44. package/dist/services/database.d.ts.map +1 -0
  45. package/dist/services/database.js +252 -0
  46. package/dist/services/database.js.map +1 -0
  47. package/dist/services/exec.d.ts +22 -0
  48. package/dist/services/exec.d.ts.map +1 -0
  49. package/dist/services/exec.js +46 -0
  50. package/dist/services/exec.js.map +1 -0
  51. package/dist/services/init.d.ts +10 -0
  52. package/dist/services/init.d.ts.map +1 -0
  53. package/dist/services/init.js +50 -0
  54. package/dist/services/init.js.map +1 -0
  55. package/dist/services/process.d.ts +9 -0
  56. package/dist/services/process.d.ts.map +1 -0
  57. package/dist/services/process.js +98 -0
  58. package/dist/services/process.js.map +1 -0
  59. package/dist/services/server-health.d.ts +4 -0
  60. package/dist/services/server-health.d.ts.map +1 -0
  61. package/dist/services/server-health.js +27 -0
  62. package/dist/services/server-health.js.map +1 -0
  63. package/dist/services/server.d.ts +19 -0
  64. package/dist/services/server.d.ts.map +1 -0
  65. package/dist/services/server.js +133 -0
  66. package/dist/services/server.js.map +1 -0
  67. package/dist/templates/config.default.json +12 -0
  68. package/dist/templates/docker-compose.yml +27 -0
  69. package/dist/templates/env.default +11 -0
  70. package/dist/templates/package.json +10 -0
  71. package/dist/types/config.d.ts +30 -0
  72. package/dist/types/config.d.ts.map +1 -0
  73. package/dist/types/config.js +2 -0
  74. package/dist/types/config.js.map +1 -0
  75. package/dist/utils/cli-context.d.ts +4 -0
  76. package/dist/utils/cli-context.d.ts.map +1 -0
  77. package/dist/utils/cli-context.js +10 -0
  78. package/dist/utils/cli-context.js.map +1 -0
  79. package/dist/utils/logger.d.ts +10 -0
  80. package/dist/utils/logger.d.ts.map +1 -0
  81. package/dist/utils/logger.js +32 -0
  82. package/dist/utils/logger.js.map +1 -0
  83. package/dist/utils/paths.d.ts +17 -0
  84. package/dist/utils/paths.d.ts.map +1 -0
  85. package/dist/utils/paths.js +27 -0
  86. package/dist/utils/paths.js.map +1 -0
  87. package/dist/utils/platform.d.ts +8 -0
  88. package/dist/utils/platform.d.ts.map +1 -0
  89. package/dist/utils/platform.js +21 -0
  90. package/dist/utils/platform.js.map +1 -0
  91. package/dist/utils/port.d.ts +5 -0
  92. package/dist/utils/port.d.ts.map +1 -0
  93. package/dist/utils/port.js +25 -0
  94. package/dist/utils/port.js.map +1 -0
  95. package/dist/utils/server-bundle.d.ts +11 -0
  96. package/dist/utils/server-bundle.d.ts.map +1 -0
  97. package/dist/utils/server-bundle.js +71 -0
  98. package/dist/utils/server-bundle.js.map +1 -0
  99. package/lib/api-dev-runner.js +6 -0
  100. package/lib/api-dev.js +85 -0
  101. package/lib/bootstrap.js +114 -0
  102. package/lib/build.js +75 -0
  103. package/lib/db-backup.js +46 -0
  104. package/lib/dev-banner.js +40 -0
  105. package/lib/dev.js +122 -0
  106. package/lib/docker.js +157 -0
  107. package/lib/doctor.js +210 -0
  108. package/lib/http.js +147 -0
  109. package/lib/i18n/index.js +32 -0
  110. package/lib/i18n/strings.js +587 -0
  111. package/lib/lifecycle.js +160 -0
  112. package/lib/paths.js +75 -0
  113. package/lib/pm2.js +32 -0
  114. package/lib/process.js +45 -0
  115. package/{scripts/publish-packages.js → lib/publish.js} +255 -58
  116. package/lib/root.js +39 -0
  117. package/lib/spawn.js +92 -0
  118. package/lib/status.js +108 -0
  119. package/package.json +38 -73
  120. package/scripts/install-bundled-runtime.mjs +46 -0
  121. package/server/bin/reactpress-server.js +4 -4
  122. package/server/dist/app.module.d.ts +2 -0
  123. package/server/dist/app.module.js +80 -0
  124. package/server/dist/app.module.js.map +1 -0
  125. package/server/dist/common/api-messages.d.ts +32 -0
  126. package/server/dist/common/api-messages.js +36 -0
  127. package/server/dist/common/api-messages.js.map +1 -0
  128. package/server/dist/filters/http-exception.filter.d.ts +4 -0
  129. package/server/dist/filters/http-exception.filter.js +36 -0
  130. package/server/dist/filters/http-exception.filter.js.map +1 -0
  131. package/server/dist/generate-swagger.d.ts +1 -0
  132. package/server/dist/generate-swagger.js +73 -0
  133. package/server/dist/generate-swagger.js.map +1 -0
  134. package/server/dist/interceptors/transform.interceptor.d.ts +9 -0
  135. package/server/dist/interceptors/transform.interceptor.js +36 -0
  136. package/server/dist/interceptors/transform.interceptor.js.map +1 -0
  137. package/server/dist/logger/index.d.ts +4 -0
  138. package/server/dist/logger/index.js +33 -0
  139. package/server/dist/logger/index.js.map +1 -0
  140. package/server/dist/main.d.ts +6 -0
  141. package/server/dist/main.js +263 -0
  142. package/server/dist/main.js.map +1 -0
  143. package/server/dist/modules/api-key/api-key.controller.d.ts +14 -0
  144. package/server/dist/modules/api-key/api-key.controller.js +63 -0
  145. package/server/dist/modules/api-key/api-key.controller.js.map +1 -0
  146. package/server/dist/modules/api-key/api-key.entity.d.ts +11 -0
  147. package/server/dist/modules/api-key/api-key.entity.js +63 -0
  148. package/server/dist/modules/api-key/api-key.entity.js.map +1 -0
  149. package/server/dist/modules/api-key/api-key.guard.d.ts +7 -0
  150. package/server/dist/modules/api-key/api-key.guard.js +40 -0
  151. package/server/dist/modules/api-key/api-key.guard.js.map +1 -0
  152. package/server/dist/modules/api-key/api-key.module.d.ts +2 -0
  153. package/server/dist/modules/api-key/api-key.module.js +28 -0
  154. package/server/dist/modules/api-key/api-key.module.js.map +1 -0
  155. package/server/dist/modules/api-key/api-key.service.d.ts +15 -0
  156. package/server/dist/modules/api-key/api-key.service.js +81 -0
  157. package/server/dist/modules/api-key/api-key.service.js.map +1 -0
  158. package/server/dist/modules/article/article-revision.entity.d.ts +11 -0
  159. package/server/dist/modules/article/article-revision.entity.js +53 -0
  160. package/server/dist/modules/article/article-revision.entity.js.map +1 -0
  161. package/server/dist/modules/article/article.controller.d.ts +27 -0
  162. package/server/dist/modules/article/article.controller.js +198 -0
  163. package/server/dist/modules/article/article.controller.js.map +1 -0
  164. package/server/dist/modules/article/article.entity.d.ts +23 -0
  165. package/server/dist/modules/article/article.entity.js +128 -0
  166. package/server/dist/modules/article/article.entity.js.map +1 -0
  167. package/server/dist/modules/article/article.module.d.ts +2 -0
  168. package/server/dist/modules/article/article.module.js +30 -0
  169. package/server/dist/modules/article/article.module.js.map +1 -0
  170. package/server/dist/modules/article/article.service.d.ts +30 -0
  171. package/server/dist/modules/article/article.service.js +303 -0
  172. package/server/dist/modules/article/article.service.js.map +1 -0
  173. package/server/dist/modules/article/article.util.d.ts +1 -0
  174. package/server/dist/modules/article/article.util.js +9 -0
  175. package/server/dist/modules/article/article.util.js.map +1 -0
  176. package/server/dist/modules/article/scheduled-publish.service.d.ts +13 -0
  177. package/server/dist/modules/article/scheduled-publish.service.js +65 -0
  178. package/server/dist/modules/article/scheduled-publish.service.js.map +1 -0
  179. package/server/dist/modules/auth/auth.controller.d.ts +12 -0
  180. package/server/dist/modules/auth/auth.controller.js +66 -0
  181. package/server/dist/modules/auth/auth.controller.js.map +1 -0
  182. package/server/dist/modules/auth/auth.module.d.ts +2 -0
  183. package/server/dist/modules/auth/auth.module.js +41 -0
  184. package/server/dist/modules/auth/auth.module.js.map +1 -0
  185. package/server/dist/modules/auth/auth.service.d.ts +26 -0
  186. package/server/dist/modules/auth/auth.service.js +127 -0
  187. package/server/dist/modules/auth/auth.service.js.map +1 -0
  188. package/server/dist/modules/auth/jwt-auth.guard.d.ts +7 -0
  189. package/server/dist/modules/auth/jwt-auth.guard.js +29 -0
  190. package/server/dist/modules/auth/jwt-auth.guard.js.map +1 -0
  191. package/server/dist/modules/auth/jwt.strategy.d.ts +9 -0
  192. package/server/dist/modules/auth/jwt.strategy.js +38 -0
  193. package/server/dist/modules/auth/jwt.strategy.js.map +1 -0
  194. package/server/dist/modules/auth/roles.guard.d.ts +10 -0
  195. package/server/dist/modules/auth/roles.guard.js +46 -0
  196. package/server/dist/modules/auth/roles.guard.js.map +1 -0
  197. package/server/dist/modules/category/category.controller.d.ts +11 -0
  198. package/server/dist/modules/category/category.controller.js +91 -0
  199. package/server/dist/modules/category/category.controller.js.map +1 -0
  200. package/server/dist/modules/category/category.entity.d.ts +9 -0
  201. package/server/dist/modules/category/category.entity.js +60 -0
  202. package/server/dist/modules/category/category.entity.js.map +1 -0
  203. package/server/dist/modules/category/category.module.d.ts +2 -0
  204. package/server/dist/modules/category/category.module.js +27 -0
  205. package/server/dist/modules/category/category.module.js.map +1 -0
  206. package/server/dist/modules/category/category.service.d.ts +12 -0
  207. package/server/dist/modules/category/category.service.js +89 -0
  208. package/server/dist/modules/category/category.service.js.map +1 -0
  209. package/server/dist/modules/comment/comment.controller.d.ts +12 -0
  210. package/server/dist/modules/comment/comment.controller.js +100 -0
  211. package/server/dist/modules/comment/comment.controller.js.map +1 -0
  212. package/server/dist/modules/comment/comment.entity.d.ts +17 -0
  213. package/server/dist/modules/comment/comment.entity.js +104 -0
  214. package/server/dist/modules/comment/comment.entity.js.map +1 -0
  215. package/server/dist/modules/comment/comment.module.d.ts +2 -0
  216. package/server/dist/modules/comment/comment.module.js +30 -0
  217. package/server/dist/modules/comment/comment.module.js.map +1 -0
  218. package/server/dist/modules/comment/comment.service.d.ts +24 -0
  219. package/server/dist/modules/comment/comment.service.js +172 -0
  220. package/server/dist/modules/comment/comment.service.js.map +1 -0
  221. package/server/dist/modules/comment/html.d.ts +15 -0
  222. package/server/dist/modules/comment/html.js +632 -0
  223. package/server/dist/modules/comment/html.js.map +1 -0
  224. package/server/dist/modules/file/file.controller.d.ts +10 -0
  225. package/server/dist/modules/file/file.controller.js +84 -0
  226. package/server/dist/modules/file/file.controller.js.map +1 -0
  227. package/server/dist/modules/file/file.entity.d.ts +9 -0
  228. package/server/dist/modules/file/file.entity.js +60 -0
  229. package/server/dist/modules/file/file.entity.js.map +1 -0
  230. package/server/dist/modules/file/file.module.d.ts +2 -0
  231. package/server/dist/modules/file/file.module.js +27 -0
  232. package/server/dist/modules/file/file.module.js.map +1 -0
  233. package/server/dist/modules/file/file.service.d.ts +17 -0
  234. package/server/dist/modules/file/file.service.js +111 -0
  235. package/server/dist/modules/file/file.service.js.map +1 -0
  236. package/server/dist/modules/health/health.controller.d.ts +11 -0
  237. package/server/dist/modules/health/health.controller.js +57 -0
  238. package/server/dist/modules/health/health.controller.js.map +1 -0
  239. package/server/dist/modules/health/health.module.d.ts +2 -0
  240. package/server/dist/modules/health/health.module.js +20 -0
  241. package/server/dist/modules/health/health.module.js.map +1 -0
  242. package/server/dist/modules/install/install.controller.d.ts +11 -0
  243. package/server/dist/modules/install/install.controller.js +49 -0
  244. package/server/dist/modules/install/install.controller.js.map +1 -0
  245. package/server/dist/modules/install/install.module.d.ts +2 -0
  246. package/server/dist/modules/install/install.module.js +26 -0
  247. package/server/dist/modules/install/install.module.js.map +1 -0
  248. package/server/dist/modules/install/install.service.d.ts +12 -0
  249. package/server/dist/modules/install/install.service.js +63 -0
  250. package/server/dist/modules/install/install.service.js.map +1 -0
  251. package/server/dist/modules/knowledge/knowledge.controller.d.ts +14 -0
  252. package/server/dist/modules/knowledge/knowledge.controller.js +128 -0
  253. package/server/dist/modules/knowledge/knowledge.controller.js.map +1 -0
  254. package/server/dist/modules/knowledge/knowledge.entity.d.ts +18 -0
  255. package/server/dist/modules/knowledge/knowledge.entity.js +109 -0
  256. package/server/dist/modules/knowledge/knowledge.entity.js.map +1 -0
  257. package/server/dist/modules/knowledge/knowledge.module.d.ts +2 -0
  258. package/server/dist/modules/knowledge/knowledge.module.js +27 -0
  259. package/server/dist/modules/knowledge/knowledge.module.js.map +1 -0
  260. package/server/dist/modules/knowledge/knowledge.service.d.ts +14 -0
  261. package/server/dist/modules/knowledge/knowledge.service.js +143 -0
  262. package/server/dist/modules/knowledge/knowledge.service.js.map +1 -0
  263. package/server/dist/modules/page/page.controller.d.ts +12 -0
  264. package/server/dist/modules/page/page.controller.js +102 -0
  265. package/server/dist/modules/page/page.controller.js.map +1 -0
  266. package/server/dist/modules/page/page.entity.d.ts +15 -0
  267. package/server/dist/modules/page/page.entity.js +94 -0
  268. package/server/dist/modules/page/page.entity.js.map +1 -0
  269. package/server/dist/modules/page/page.module.d.ts +2 -0
  270. package/server/dist/modules/page/page.module.js +27 -0
  271. package/server/dist/modules/page/page.module.js.map +1 -0
  272. package/server/dist/modules/page/page.service.d.ts +12 -0
  273. package/server/dist/modules/page/page.service.js +97 -0
  274. package/server/dist/modules/page/page.service.js.map +1 -0
  275. package/server/dist/modules/search/search.controller.d.ts +8 -0
  276. package/server/dist/modules/search/search.controller.js +67 -0
  277. package/server/dist/modules/search/search.controller.js.map +1 -0
  278. package/server/dist/modules/search/search.entity.d.ts +8 -0
  279. package/server/dist/modules/search/search.entity.js +59 -0
  280. package/server/dist/modules/search/search.entity.js.map +1 -0
  281. package/server/dist/modules/search/search.module.d.ts +2 -0
  282. package/server/dist/modules/search/search.module.js +27 -0
  283. package/server/dist/modules/search/search.module.js.map +1 -0
  284. package/server/dist/modules/search/search.service.d.ts +12 -0
  285. package/server/dist/modules/search/search.service.js +84 -0
  286. package/server/dist/modules/search/search.service.js.map +1 -0
  287. package/server/dist/modules/setting/setting.constant.d.ts +3 -0
  288. package/server/dist/modules/setting/setting.constant.js +25 -0
  289. package/server/dist/modules/setting/setting.constant.js.map +1 -0
  290. package/server/dist/modules/setting/setting.controller.d.ts +12 -0
  291. package/server/dist/modules/setting/setting.controller.js +77 -0
  292. package/server/dist/modules/setting/setting.controller.js.map +1 -0
  293. package/server/dist/modules/setting/setting.entity.d.ts +26 -0
  294. package/server/dist/modules/setting/setting.entity.js +149 -0
  295. package/server/dist/modules/setting/setting.entity.js.map +1 -0
  296. package/server/dist/modules/setting/setting.module.d.ts +2 -0
  297. package/server/dist/modules/setting/setting.module.js +28 -0
  298. package/server/dist/modules/setting/setting.module.js.map +1 -0
  299. package/server/dist/modules/setting/setting.service.d.ts +10 -0
  300. package/server/dist/modules/setting/setting.service.js +106 -0
  301. package/server/dist/modules/setting/setting.service.js.map +1 -0
  302. package/server/dist/modules/smtp/mail.util.d.ts +6 -0
  303. package/server/dist/modules/smtp/mail.util.js +33 -0
  304. package/server/dist/modules/smtp/mail.util.js.map +1 -0
  305. package/server/dist/modules/smtp/smtp.controller.d.ts +9 -0
  306. package/server/dist/modules/smtp/smtp.controller.js +69 -0
  307. package/server/dist/modules/smtp/smtp.controller.js.map +1 -0
  308. package/server/dist/modules/smtp/smtp.entity.d.ts +9 -0
  309. package/server/dist/modules/smtp/smtp.entity.js +60 -0
  310. package/server/dist/modules/smtp/smtp.entity.js.map +1 -0
  311. package/server/dist/modules/smtp/smtp.module.d.ts +2 -0
  312. package/server/dist/modules/smtp/smtp.module.js +28 -0
  313. package/server/dist/modules/smtp/smtp.module.js.map +1 -0
  314. package/server/dist/modules/smtp/smtp.service.d.ts +11 -0
  315. package/server/dist/modules/smtp/smtp.service.js +82 -0
  316. package/server/dist/modules/smtp/smtp.service.js.map +1 -0
  317. package/server/dist/modules/tag/tag.controller.d.ts +12 -0
  318. package/server/dist/modules/tag/tag.controller.js +101 -0
  319. package/server/dist/modules/tag/tag.controller.js.map +1 -0
  320. package/server/dist/modules/tag/tag.entity.d.ts +9 -0
  321. package/server/dist/modules/tag/tag.entity.js +59 -0
  322. package/server/dist/modules/tag/tag.entity.js.map +1 -0
  323. package/server/dist/modules/tag/tag.module.d.ts +2 -0
  324. package/server/dist/modules/tag/tag.module.js +27 -0
  325. package/server/dist/modules/tag/tag.module.js.map +1 -0
  326. package/server/dist/modules/tag/tag.service.d.ts +13 -0
  327. package/server/dist/modules/tag/tag.service.js +103 -0
  328. package/server/dist/modules/tag/tag.service.js.map +1 -0
  329. package/server/dist/modules/user/user.controller.d.ts +13 -0
  330. package/server/dist/modules/user/user.controller.js +114 -0
  331. package/server/dist/modules/user/user.controller.js.map +1 -0
  332. package/server/dist/modules/user/user.entity.d.ts +15 -0
  333. package/server/dist/modules/user/user.entity.js +96 -0
  334. package/server/dist/modules/user/user.entity.js.map +1 -0
  335. package/server/dist/modules/user/user.module.d.ts +2 -0
  336. package/server/dist/modules/user/user.module.js +28 -0
  337. package/server/dist/modules/user/user.module.js.map +1 -0
  338. package/server/dist/modules/user/user.service.d.ts +16 -0
  339. package/server/dist/modules/user/user.service.js +151 -0
  340. package/server/dist/modules/user/user.service.js.map +1 -0
  341. package/server/dist/modules/view/view.controller.d.ts +11 -0
  342. package/server/dist/modules/view/view.controller.js +92 -0
  343. package/server/dist/modules/view/view.controller.js.map +1 -0
  344. package/server/dist/modules/view/view.entity.d.ts +14 -0
  345. package/server/dist/modules/view/view.entity.js +88 -0
  346. package/server/dist/modules/view/view.entity.js.map +1 -0
  347. package/server/dist/modules/view/view.module.d.ts +2 -0
  348. package/server/dist/modules/view/view.module.js +27 -0
  349. package/server/dist/modules/view/view.module.js.map +1 -0
  350. package/server/dist/modules/view/view.service.d.ts +11 -0
  351. package/server/dist/modules/view/view.service.js +89 -0
  352. package/server/dist/modules/view/view.service.js.map +1 -0
  353. package/server/dist/modules/webhook/webhook.controller.d.ts +12 -0
  354. package/server/dist/modules/webhook/webhook.controller.js +63 -0
  355. package/server/dist/modules/webhook/webhook.controller.js.map +1 -0
  356. package/server/dist/modules/webhook/webhook.entity.d.ts +9 -0
  357. package/server/dist/modules/webhook/webhook.entity.js +54 -0
  358. package/server/dist/modules/webhook/webhook.entity.js.map +1 -0
  359. package/server/dist/modules/webhook/webhook.module.d.ts +2 -0
  360. package/server/dist/modules/webhook/webhook.module.js +27 -0
  361. package/server/dist/modules/webhook/webhook.module.js.map +1 -0
  362. package/server/dist/modules/webhook/webhook.service.d.ts +16 -0
  363. package/server/dist/modules/webhook/webhook.service.js +97 -0
  364. package/server/dist/modules/webhook/webhook.service.js.map +1 -0
  365. package/server/dist/public/favicon.png +0 -0
  366. package/server/dist/public/index.html +439 -0
  367. package/server/dist/public/swagger/custom.css +11 -0
  368. package/server/dist/starter.d.ts +1 -0
  369. package/server/dist/starter.js +84 -0
  370. package/server/dist/starter.js.map +1 -0
  371. package/server/dist/tsconfig.build.tsbuildinfo +16764 -0
  372. package/server/dist/utils/date.util.d.ts +1 -0
  373. package/server/dist/utils/date.util.js +13 -0
  374. package/server/dist/utils/date.util.js.map +1 -0
  375. package/server/dist/utils/ip.util.d.ts +2 -0
  376. package/server/dist/utils/ip.util.js +27 -0
  377. package/server/dist/utils/ip.util.js.map +1 -0
  378. package/server/dist/utils/markdown.util.d.ts +4 -0
  379. package/server/dist/utils/markdown.util.js +42 -0
  380. package/server/dist/utils/markdown.util.js.map +1 -0
  381. package/server/dist/utils/oss/aliyun-oss-client.d.ts +6 -0
  382. package/server/dist/utils/oss/aliyun-oss-client.js +28 -0
  383. package/server/dist/utils/oss/aliyun-oss-client.js.map +1 -0
  384. package/server/dist/utils/oss/oss-client.d.ts +6 -0
  385. package/server/dist/utils/oss/oss-client.js +10 -0
  386. package/server/dist/utils/oss/oss-client.js.map +1 -0
  387. package/server/dist/utils/oss.util.d.ts +13 -0
  388. package/server/dist/utils/oss.util.js +48 -0
  389. package/server/dist/utils/oss.util.js.map +1 -0
  390. package/server/dist/utils/ua.util.d.ts +9 -0
  391. package/server/dist/utils/ua.util.js +36 -0
  392. package/server/dist/utils/ua.util.js.map +1 -0
  393. package/server/dist/utils/uniqueid.util.d.ts +1 -0
  394. package/server/dist/utils/uniqueid.util.js +9 -0
  395. package/server/dist/utils/uniqueid.util.js.map +1 -0
  396. package/server/dist/utils/upload.util.d.ts +5 -0
  397. package/server/dist/utils/upload.util.js +34 -0
  398. package/server/dist/utils/upload.util.js.map +1 -0
  399. package/server/dist/utils/user.util.d.ts +1 -0
  400. package/server/dist/utils/user.util.js +18 -0
  401. package/server/dist/utils/user.util.js.map +1 -0
  402. package/server/ecosystem.config.js +18 -0
  403. package/server/package.json +146 -0
  404. package/server/public/favicon.png +0 -0
  405. package/server/public/index.html +439 -0
  406. package/server/public/swagger/custom.css +11 -0
  407. package/templates/config.default.json +12 -0
  408. package/templates/docker-compose.prod.yml +56 -0
  409. package/templates/docker-compose.yml +27 -0
  410. package/templates/env.default +11 -0
  411. package/templates/package.json +10 -0
  412. package/ui/banner.js +22 -0
  413. package/ui/interactive.js +184 -0
  414. package/ui/theme.js +25 -0
  415. package/CONTRIBUTING.md +0 -122
  416. package/client/bin/reactpress-client.js +0 -190
  417. package/scripts/build-packages.js +0 -271
  418. package/scripts/deploy.sh +0 -25
  419. package/scripts/dev.js +0 -39
  420. package/scripts/reactpress-server-old.js +0 -130
  421. package/scripts/reactpress-server.js +0 -666
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
1
  MIT License
2
-
3
- Copyright (c) [2024] [fecommunity]
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
- <div align="center">
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
- <h1>ReactPress 2.0</h1>
3
+ 零配置一键初始化与管理 ReactPress CMS & 博客服务器。内置 NestJS 服务端,无需单独克隆 [fecommunity/reactpress](https://github.com/fecommunity/reactpress)。
7
4
 
8
- <p align="center">
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
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/fecommunity/reactpress/blob/master/LICENSE)
13
- [![NPM Version](https://img.shields.io/npm/v/@fecommunity/reactpress.svg?style=flat-square)](https://www.npmjs.com/package/@fecommunity/reactpress)
14
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/fecommunity/reactpress/pulls)
15
- [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg?style=flat-square)](http://www.typescriptlang.org/)
16
- [![Next.js](https://img.shields.io/badge/Next.js-14-black?style=flat-square)](https://nextjs.org/)
17
- [![NestJS](https://img.shields.io/badge/NestJS-10-red?style=flat-square)](https://nestjs.com/)
18
- [![Deploy](https://img.shields.io/badge/Deploy-Vercel-blue?style=flat-square)](https://vercel.com/new/clone?repository-url=https://github.com/fecommunity/reactpress)
19
- [![CI](https://github.com/fecommunity/reactpress/actions/workflows/npm-publish.yml/badge.svg)](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
- [![ReactPress Poster](./public/poster.png)](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
- [![Installation](./public/install.png)](https://gaoredu.com)
63
-
64
- ### Content Management Dashboard
65
- [![Admin Dashboard](./public/admin.png)](https://gaoredu.com)
66
-
67
- ### Demo Site
68
- [![Demo](./public/demo.png)](https://gaoredu.com)
69
-
70
- ## 🚀 Quick Start
71
-
72
- ### 🏁 Installation Options
73
-
74
- #### Option 1: Unified CLI (Recommended)
75
9
  ```bash
76
- # Install ReactPress globally
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
- #### Option 2: Independent Services
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
- | Package | Description | Version |
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
- ### Templates
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
- [![Deploy with Vercel](https://vercel.com/button)](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
- # Build for production
155
- pnpm run build
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
- ## 🤝 Contributing
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
- ## ❤️ Acknowledgments
27
+ ## 常用命令
183
28
 
184
- ReactPress is inspired by and built upon the work of many amazing open-source projects:
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
- - [Next.js](https://github.com/vercel/next.js) - React framework
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
- We're grateful to the authors and contributors of these projects for their excellent work.
41
+ - Node.js 18+
42
+ - macOS / Linux / Windows
43
+ - 默认使用 Docker 运行嵌入式 MySQL;也可在 `.reactpress/config.json` 中配置外部数据库
192
44
 
193
- ## 📈 Star History
45
+ ## 许可证
194
46
 
195
- [![Star History Chart](https://api.star-history.com/svg?repos=fecommunity/reactpress&type=Date)](https://star-history.com/#fecommunity/reactpress&Date)
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');
package/bin/reactpress.js CHANGED
@@ -1,90 +1,274 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * ReactPress CLI - Main entry point for all ReactPress commands
5
- * This script allows users to run reactpress commands after installing the package globally
4
+ * ReactPress unified CLI — init, dev, build, server, docker, publish.
5
+ * Run without arguments for an interactive menu (Claude Code–style).
6
6
  */
7
7
 
8
8
  const { Command } = require('commander');
9
- const { spawn } = require('child_process');
10
9
  const path = require('path');
11
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'));
12
28
 
13
- // Create the CLI program
14
29
  const program = new Command();
15
30
 
16
- // Get the directory where this script is located
17
- const binDir = __dirname;
18
- const rootDir = path.join(binDir, '..');
31
+ program
32
+ .name('reactpress')
33
+ .description(t('cli.description'))
34
+ .version(rootPkg.version);
19
35
 
20
- // Server command
21
36
  program
22
- .command('server')
23
- .description('Manage the ReactPress server')
24
- .option('install', 'Launch the installation wizard')
25
- .option('start', 'Start the ReactPress server')
26
- .option('--pm2', 'Start server with PM2 process manager')
27
- .action((options) => {
28
- const serverScript = path.join(rootDir, 'scripts', 'reactpress-server.js');
29
-
30
- let args = [];
31
- if (options.install) {
32
- args.push('install');
33
- } else if (options.start) {
34
- args.push('start');
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;
35
50
  }
36
-
37
- if (options.pm2) {
38
- args.push('--pm2');
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);
39
76
  }
40
-
41
- const serverProcess = spawn('node', [serverScript, ...args], {
42
- stdio: 'inherit'
43
- });
44
-
45
- serverProcess.on('error', (error) => {
46
- console.error(chalk.red('[ReactPress CLI] Failed to start server:'), error);
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);
47
98
  process.exit(1);
48
- });
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() });
49
125
  });
50
126
 
51
- // Client command
52
127
  program
53
- .command('client')
54
- .description('Manage the ReactPress client')
55
- .option('--pm2', 'Start client with PM2 process manager')
56
- .action((options) => {
57
- const clientScript = path.join(rootDir, 'client', 'bin', 'reactpress-client.js');
58
-
59
- let args = [];
60
- if (options.pm2) {
61
- args.push('--pm2');
128
+ .command('build')
129
+ .description(t('cli.build.description'))
130
+ .option('-t, --target <target>', t('cli.build.target'), '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);
62
137
  }
63
-
64
- const clientProcess = spawn('node', [clientScript, ...args], {
65
- stdio: 'inherit'
66
- });
67
-
68
- clientProcess.on('error', (error) => {
69
- console.error(chalk.red('[ReactPress CLI] Failed to start client:'), error);
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);
70
205
  process.exit(1);
71
- });
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
+ }
72
229
  });
73
230
 
74
- // Set the version from package.json
75
- const packageJson = require(path.join(rootDir, 'package.json'));
76
- program.version(packageJson.version);
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
+ });
77
246
 
78
- // Configure help text
79
247
  program.on('--help', () => {
80
248
  console.log('');
81
- console.log('For more information, visit: https://github.com/fecommunity/reactpress');
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.build'));
258
+ console.log(t('cli.help.publish'));
259
+ console.log('');
82
260
  });
83
261
 
84
- // Parse the command line arguments
85
- program.parse(process.argv);
262
+ async function main() {
263
+ const argv = process.argv.slice(2);
264
+ if (argv.length === 0) {
265
+ await runInteractiveLoop();
266
+ return;
267
+ }
268
+ program.parse(process.argv);
269
+ }
86
270
 
87
- // If no command is provided, show help
88
- if (!process.argv.slice(2).length) {
89
- program.outputHelp();
90
- }
271
+ main().catch((err) => {
272
+ console.error(chalk.red('[reactpress]'), err.message || err);
273
+ process.exit(1);
274
+ });
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ export declare function createProgram(): Command;
3
+ export declare function runCli(argv?: string[]): Promise<void>;
4
+ //# sourceMappingURL=cli.d.ts.map
@@ -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"}