@fecommunity/reactpress 2.0.0-beta-4-beta.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) 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 +273 -0
  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 +29 -0
  103. package/lib/db-backup.js +46 -0
  104. package/lib/dev-banner.js +40 -0
  105. package/lib/dev.js +134 -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 +559 -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/reactpress-publish.js → lib/publish.js} +26 -19
  116. package/lib/root.js +31 -0
  117. package/lib/spawn.js +91 -0
  118. package/lib/status.js +108 -0
  119. package/package.json +36 -70
  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 +105 -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 +32 -0
  162. package/server/dist/modules/article/article.controller.js +242 -0
  163. package/server/dist/modules/article/article.controller.js.map +1 -0
  164. package/server/dist/modules/article/article.entity.d.ts +24 -0
  165. package/server/dist/modules/article/article.entity.js +133 -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 +42 -0
  169. package/server/dist/modules/article/article.module.js.map +1 -0
  170. package/server/dist/modules/article/article.service.d.ts +38 -0
  171. package/server/dist/modules/article/article.service.js +357 -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 +128 -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 +30 -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 +39 -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 +90 -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 +39 -0
  217. package/server/dist/modules/comment/comment.module.js.map +1 -0
  218. package/server/dist/modules/comment/comment.service.d.ts +26 -0
  219. package/server/dist/modules/comment/comment.service.js +182 -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 +144 -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 +98 -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 +83 -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 +104 -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 +115 -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 +152 -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 +16966 -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 +49 -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 +168 -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/reactpress-cli.js +0 -90
  418. package/scripts/reactpress-deploy.sh +0 -47
  419. package/scripts/reactpress-dev.js +0 -39
  420. package/scripts/reactpress.js +0 -90
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsDrF"}
@@ -0,0 +1,54 @@
1
+ import ora from 'ora';
2
+ import { getConfigValue, listConfigKeys, loadConfig, saveConfig, setConfigValue, syncEnvFromConfig, } from '../services/config.js';
3
+ import { resolveProjectRoot, restartServer } from '../services/server.js';
4
+ import { isReactPressProject } from '../services/config.js';
5
+ import { logger } from '../utils/logger.js';
6
+ export async function runConfigCommand(options) {
7
+ const projectRoot = await resolveProjectRoot();
8
+ if (!(await isReactPressProject(projectRoot))) {
9
+ logger.error('当前目录不是 ReactPress 项目。');
10
+ return 1;
11
+ }
12
+ const config = await loadConfig(projectRoot);
13
+ if (options.list) {
14
+ logger.title('配置项');
15
+ for (const key of listConfigKeys(config)) {
16
+ logger.dim(`${key} = ${getConfigValue(config, key)}`);
17
+ }
18
+ return 0;
19
+ }
20
+ if (!options.key) {
21
+ logger.error('请指定配置键,例如: reactpress-cli config server.port 3003');
22
+ logger.dim('使用 --list 查看所有配置项');
23
+ return 1;
24
+ }
25
+ if (options.value === undefined) {
26
+ try {
27
+ logger.info(`${options.key} = ${getConfigValue(config, options.key)}`);
28
+ return 0;
29
+ }
30
+ catch (error) {
31
+ logger.error(error instanceof Error ? error.message : String(error));
32
+ return 1;
33
+ }
34
+ }
35
+ const updated = setConfigValue(config, options.key, options.value);
36
+ await saveConfig(projectRoot, updated);
37
+ await syncEnvFromConfig(projectRoot, updated);
38
+ logger.success(`已更新 ${options.key} = ${options.value}`);
39
+ if (options.apply) {
40
+ const spinner = ora({ text: '正在重启以使配置生效…', color: 'cyan' }).start();
41
+ const result = await restartServer(projectRoot);
42
+ if (result.ok) {
43
+ spinner.succeed('配置已应用');
44
+ logger.success(result.message ?? '完成');
45
+ return 0;
46
+ }
47
+ spinner.fail('重启失败');
48
+ logger.warn(result.message ?? '请手动运行 reactpress-cli restart');
49
+ return 1;
50
+ }
51
+ logger.dim('运行 reactpress-cli restart 或 config --apply 使配置生效');
52
+ return 0;
53
+ }
54
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EACL,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAS5C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA6B;IAClE,MAAM,WAAW,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAE/C,IAAI,CAAC,CAAC,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC;IAE7C,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,CAAC,KAAK,CAAC,KAA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,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QACpE,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACzB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;YACvC,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,8BAA8B,CAAC,CAAC;QAC9D,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAC/D,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface InitCommandOptions {
2
+ directory?: string;
3
+ force?: boolean;
4
+ }
5
+ export declare function runInitCommand(options: InitCommandOptions): Promise<number>;
6
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BjF"}
@@ -0,0 +1,33 @@
1
+ import { resolve } from 'node:path';
2
+ import ora from 'ora';
3
+ import { initProject } from '../services/init.js';
4
+ import { logger } from '../utils/logger.js';
5
+ export async function runInitCommand(options) {
6
+ const targetDir = resolve(process.cwd(), options.directory ?? '.');
7
+ const spinner = ora({
8
+ text: '正在初始化 ReactPress 项目…',
9
+ color: 'cyan',
10
+ }).start();
11
+ try {
12
+ const result = await initProject({
13
+ directory: targetDir,
14
+ force: options.force,
15
+ });
16
+ if (result.ok) {
17
+ spinner.succeed('初始化完成');
18
+ logger.success(result.message ?? '完成');
19
+ logger.dim(`项目目录: ${result.projectRoot}`);
20
+ logger.dim('下一步: reactpress-cli start');
21
+ return 0;
22
+ }
23
+ spinner.fail('初始化失败');
24
+ logger.error(result.message ?? '未知错误');
25
+ return 1;
26
+ }
27
+ catch (error) {
28
+ spinner.fail('初始化失败');
29
+ logger.error(error instanceof Error ? error.message : String(error));
30
+ return 1;
31
+ }
32
+ }
33
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAO5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA2B;IAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,SAAS,IAAI,GAAG,CAAC,CAAC;IAEnE,MAAM,OAAO,GAAG,GAAG,CAAC;QAClB,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,MAAM;KACd,CAAC,CAAC,KAAK,EAAE,CAAC;IAEX,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC;YAC/B,SAAS,EAAE,SAAS;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACzB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;YACvC,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;YAC1C,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACxC,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;QACvC,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function runRestartCommand(): Promise<number>;
2
+ //# sourceMappingURL=restart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart.d.ts","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAKA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAyBzD"}
@@ -0,0 +1,29 @@
1
+ import ora from 'ora';
2
+ import { resolveProjectRoot, restartServer } from '../services/server.js';
3
+ import { isReactPressProject } from '../services/config.js';
4
+ import { logger } from '../utils/logger.js';
5
+ export async function runRestartCommand() {
6
+ const projectRoot = await resolveProjectRoot();
7
+ if (!(await isReactPressProject(projectRoot))) {
8
+ logger.error('当前目录不是 ReactPress 项目。');
9
+ return 1;
10
+ }
11
+ const spinner = ora({ text: '正在重启服务…', color: 'cyan' }).start();
12
+ try {
13
+ const result = await restartServer(projectRoot);
14
+ if (result.ok) {
15
+ spinner.succeed('重启完成');
16
+ logger.success(result.message ?? '完成');
17
+ return 0;
18
+ }
19
+ spinner.fail('重启失败');
20
+ logger.error(result.message ?? '未知错误');
21
+ return 1;
22
+ }
23
+ catch (error) {
24
+ spinner.fail('重启失败');
25
+ logger.error(error instanceof Error ? error.message : String(error));
26
+ return 1;
27
+ }
28
+ }
29
+ //# sourceMappingURL=restart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart.js","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,WAAW,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAE/C,IAAI,CAAC,CAAC,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IAEhE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;YACvC,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;QACvC,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function runStartCommand(): Promise<number>;
2
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAKA,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CA0BvD"}
@@ -0,0 +1,31 @@
1
+ import ora from 'ora';
2
+ import { resolveProjectRoot, startServer } from '../services/server.js';
3
+ import { isReactPressProject } from '../services/config.js';
4
+ import { logger } from '../utils/logger.js';
5
+ export async function runStartCommand() {
6
+ const projectRoot = await resolveProjectRoot();
7
+ if (!(await isReactPressProject(projectRoot))) {
8
+ logger.error('当前目录不是 ReactPress 项目。请先运行 reactpress-cli init。');
9
+ return 1;
10
+ }
11
+ const spinner = ora({ text: '正在准备数据库与服务…', color: 'cyan' }).start();
12
+ try {
13
+ const result = await startServer(projectRoot);
14
+ if (result.ok) {
15
+ spinner.succeed('服务已启动');
16
+ logger.success(result.message ?? '完成');
17
+ if (result.pid)
18
+ logger.dim(`PID: ${result.pid}`);
19
+ return 0;
20
+ }
21
+ spinner.fail('启动失败');
22
+ logger.error(result.message ?? '未知错误');
23
+ return 1;
24
+ }
25
+ catch (error) {
26
+ spinner.fail('启动失败');
27
+ logger.error(error instanceof Error ? error.message : String(error));
28
+ return 1;
29
+ }
30
+ }
31
+ //# sourceMappingURL=start.js.map
@@ -0,0 +1 @@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AAC,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function runStatusCommand(): Promise<number>;
2
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAKA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAyBxD"}
@@ -0,0 +1,20 @@
1
+ import { resolveProjectRoot, getServerStatus } from '../services/server.js';
2
+ import { isReactPressProject } from '../services/config.js';
3
+ import { logger } from '../utils/logger.js';
4
+ import chalk from 'chalk';
5
+ export async function runStatusCommand() {
6
+ const projectRoot = await resolveProjectRoot();
7
+ if (!(await isReactPressProject(projectRoot))) {
8
+ logger.error('当前目录不是 ReactPress 项目。');
9
+ return 1;
10
+ }
11
+ const status = await getServerStatus(projectRoot);
12
+ logger.title('服务状态');
13
+ logger.dim(`项目: ${projectRoot}`);
14
+ logger.dim(`服务: ${status.running ? chalk.green('运行中') : chalk.gray('已停止')}${status.pid ? ` (PID ${status.pid})` : ''}`);
15
+ if (status.url)
16
+ logger.dim(`地址: ${status.url}`);
17
+ logger.dim(`数据库: ${status.databaseReady ? chalk.green('就绪') : chalk.yellow('未就绪')} (${status.databaseMode})`);
18
+ return 0;
19
+ }
20
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,WAAW,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAE/C,IAAI,CAAC,CAAC,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC;IAElD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,CAAC,GAAG,CAAC,OAAO,WAAW,EAAE,CAAC,CAAC;IACjC,MAAM,CAAC,GAAG,CACR,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAC5D,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EACxC,EAAE,CACH,CAAC;IACF,IAAI,MAAM,CAAC,GAAG;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,CACR,QACE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAC/D,KAAK,MAAM,CAAC,YAAY,GAAG,CAC5B,CAAC;IAEF,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface StopCommandOptions {
2
+ database?: boolean;
3
+ }
4
+ export declare function runStopCommand(options: StopCommandOptions): Promise<number>;
5
+ //# sourceMappingURL=stop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stop.d.ts","sourceRoot":"","sources":["../../src/commands/stop.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBjF"}
@@ -0,0 +1,29 @@
1
+ import ora from 'ora';
2
+ import { resolveProjectRoot, stopServer } from '../services/server.js';
3
+ import { isReactPressProject } from '../services/config.js';
4
+ import { logger } from '../utils/logger.js';
5
+ export async function runStopCommand(options) {
6
+ const projectRoot = await resolveProjectRoot();
7
+ if (!(await isReactPressProject(projectRoot))) {
8
+ logger.error('当前目录不是 ReactPress 项目。');
9
+ return 1;
10
+ }
11
+ const spinner = ora({ text: '正在停止服务…', color: 'cyan' }).start();
12
+ try {
13
+ const result = await stopServer(projectRoot, { stopDatabase: options.database });
14
+ if (result.ok) {
15
+ spinner.succeed('已停止');
16
+ logger.success(result.message ?? '完成');
17
+ return 0;
18
+ }
19
+ spinner.fail('停止失败');
20
+ logger.error(result.message ?? '未知错误');
21
+ return 1;
22
+ }
23
+ catch (error) {
24
+ spinner.fail('停止失败');
25
+ logger.error(error instanceof Error ? error.message : String(error));
26
+ return 1;
27
+ }
28
+ }
29
+ //# sourceMappingURL=stop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/commands/stop.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAM5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA2B;IAC9D,MAAM,WAAW,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAE/C,IAAI,CAAC,CAAC,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IAEhE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjF,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;YACvC,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;QACvC,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
package/dist/i18n.js ADDED
@@ -0,0 +1,8 @@
1
+ import { createRequire } from 'node:module';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const require = createRequire(import.meta.url);
6
+ const { t, getLocale, setLocale } = require(join(dirname(fileURLToPath(import.meta.url)), '..', 'lib', 'i18n', 'index.js'));
7
+
8
+ export { t, getLocale, setLocale };
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from './cli.js';
3
+ runCli().catch((error) => {
4
+ console.error('[ReactPress CLI] Fatal:', error);
5
+ process.exit(1);
6
+ });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACvB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,11 @@
1
+ import type { EnvMap, ReactPressConfig } from '../types/config.js';
2
+ export declare function loadConfig(projectRoot: string): Promise<ReactPressConfig>;
3
+ export declare function saveConfig(projectRoot: string, config: ReactPressConfig): Promise<void>;
4
+ export declare function loadEnvFile(envPath: string): Promise<EnvMap>;
5
+ export declare function writeEnvFile(envPath: string, map: EnvMap): Promise<void>;
6
+ export declare function syncEnvFromConfig(projectRoot: string, config: ReactPressConfig): Promise<void>;
7
+ export declare function setConfigValue(config: ReactPressConfig, keyPath: string, value: string): ReactPressConfig;
8
+ export declare function getConfigValue(config: ReactPressConfig, keyPath: string): string;
9
+ export declare function listConfigKeys(obj: Record<string, unknown>, prefix?: string): string[];
10
+ export declare function isReactPressProject(projectRoot: string): Promise<boolean>;
11
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAM/E;AAED,wBAAsB,UAAU,CAC9B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWlE;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9E;AAED,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAkBlB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAahF;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,MAAM,SAAK,GACV,MAAM,EAAE,CAWV;AAED,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG/E"}
@@ -0,0 +1,102 @@
1
+ import fs from 'fs-extra';
2
+ import { getProjectPaths } from '../utils/paths.js';
3
+ export async function loadConfig(projectRoot) {
4
+ const { configPath } = getProjectPaths(projectRoot);
5
+ if (!(await fs.pathExists(configPath))) {
6
+ throw new Error('未找到 ReactPress 项目。请先运行 reactpress-cli init 初始化。');
7
+ }
8
+ return fs.readJson(configPath);
9
+ }
10
+ export async function saveConfig(projectRoot, config) {
11
+ const { configPath, reactpressDir } = getProjectPaths(projectRoot);
12
+ await fs.ensureDir(reactpressDir);
13
+ await fs.writeJson(configPath, config, { spaces: 2 });
14
+ }
15
+ export async function loadEnvFile(envPath) {
16
+ const content = await fs.readFile(envPath, 'utf8');
17
+ const map = {};
18
+ for (const line of content.split('\n')) {
19
+ const trimmed = line.trim();
20
+ if (!trimmed || trimmed.startsWith('#'))
21
+ continue;
22
+ const eq = trimmed.indexOf('=');
23
+ if (eq === -1)
24
+ continue;
25
+ map[trimmed.slice(0, eq)] = trimmed.slice(eq + 1);
26
+ }
27
+ return map;
28
+ }
29
+ export async function writeEnvFile(envPath, map) {
30
+ const lines = [
31
+ '# ReactPress — managed by reactpress-cli',
32
+ ...Object.entries(map).map(([k, v]) => `${k}=${v}`),
33
+ '',
34
+ ];
35
+ await fs.writeFile(envPath, lines.join('\n'), 'utf8');
36
+ }
37
+ export async function syncEnvFromConfig(projectRoot, config) {
38
+ const { envPath } = getProjectPaths(projectRoot);
39
+ const existing = (await fs.pathExists(envPath))
40
+ ? await loadEnvFile(envPath)
41
+ : {};
42
+ const merged = {
43
+ ...existing,
44
+ DB_HOST: config.database.host ?? existing.DB_HOST ?? '127.0.0.1',
45
+ DB_PORT: String(config.database.port ?? existing.DB_PORT ?? 3306),
46
+ DB_USER: config.database.user ?? existing.DB_USER ?? 'reactpress',
47
+ DB_PASSWD: config.database.password ?? existing.DB_PASSWD ?? 'reactpress',
48
+ DB_DATABASE: config.database.database ?? existing.DB_DATABASE ?? 'reactpress',
49
+ SERVER_PORT: String(config.server.port),
50
+ CLIENT_SITE_URL: config.server.clientUrl,
51
+ SERVER_SITE_URL: config.server.serverUrl,
52
+ };
53
+ await writeEnvFile(envPath, merged);
54
+ }
55
+ export function setConfigValue(config, keyPath, value) {
56
+ const parts = keyPath.split('.');
57
+ const clone = structuredClone(config);
58
+ let cursor = clone;
59
+ for (let i = 0; i < parts.length - 1; i++) {
60
+ const part = parts[i];
61
+ if (typeof cursor[part] !== 'object' || cursor[part] === null) {
62
+ cursor[part] = {};
63
+ }
64
+ cursor = cursor[part];
65
+ }
66
+ const last = parts[parts.length - 1];
67
+ const numericKeys = new Set(['port', 'version']);
68
+ cursor[last] = numericKeys.has(last) ? Number(value) : value;
69
+ return clone;
70
+ }
71
+ export function getConfigValue(config, keyPath) {
72
+ const parts = keyPath.split('.');
73
+ let cursor = config;
74
+ for (const part of parts) {
75
+ if (typeof cursor !== 'object' || cursor === null) {
76
+ throw new Error(`配置项不存在: ${keyPath}`);
77
+ }
78
+ cursor = cursor[part];
79
+ }
80
+ if (cursor === undefined) {
81
+ throw new Error(`配置项不存在: ${keyPath}`);
82
+ }
83
+ return String(cursor);
84
+ }
85
+ export function listConfigKeys(obj, prefix = '') {
86
+ const keys = [];
87
+ for (const [key, value] of Object.entries(obj)) {
88
+ const path = prefix ? `${prefix}.${key}` : key;
89
+ if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
90
+ keys.push(...listConfigKeys(value, path));
91
+ }
92
+ else {
93
+ keys.push(path);
94
+ }
95
+ }
96
+ return keys;
97
+ }
98
+ export async function isReactPressProject(projectRoot) {
99
+ const { configPath } = getProjectPaths(projectRoot);
100
+ return fs.pathExists(configPath);
101
+ }
102
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAG1B,OAAO,EAAe,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,WAAmB;IAClD,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI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,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { ReactPressConfig } from '../types/config.js';
2
+ declare const DEFAULT_CREDS: {
3
+ host: string;
4
+ port: number;
5
+ user: string;
6
+ password: string;
7
+ database: string;
8
+ };
9
+ export declare function getDatabaseCredentials(projectRoot: string): Promise<typeof DEFAULT_CREDS>;
10
+ export type DatabaseCredentials = {
11
+ host: string;
12
+ port: number;
13
+ user: string;
14
+ password: string;
15
+ database: string;
16
+ };
17
+ export type ConnectionTester = (creds: DatabaseCredentials) => Promise<boolean>;
18
+ /** @internal test hook */
19
+ export declare function setConnectionTesterForTests(tester: ConnectionTester | null): void;
20
+ export declare function testDatabaseConnection(creds: DatabaseCredentials): Promise<boolean>;
21
+ export declare function waitForDatabase(creds: typeof DEFAULT_CREDS, maxAttempts?: number, intervalMs?: number): Promise<boolean>;
22
+ /** 解析 `docker port <name> 3306/tcp` 输出的宿主机端口 */
23
+ export declare function parseDockerPublishedPort(output: string): number | null;
24
+ /** 若嵌入式库容器已在运行,返回其映射的宿主机端口 */
25
+ export declare function getContainerPublishedHostPort(containerName: string, containerPort?: number): Promise<number | null>;
26
+ /** 为嵌入式 Docker MySQL 选择未被占用的宿主机端口,并写回 config / .env */
27
+ export declare function ensureDatabaseHostPort(projectRoot: string, forcePort?: number, configOverride?: ReactPressConfig): Promise<{
28
+ port: number;
29
+ changed: boolean;
30
+ previousPort: number;
31
+ }>;
32
+ export declare function startEmbeddedDatabase(projectRoot: string, config: ReactPressConfig): Promise<{
33
+ ok: boolean;
34
+ message?: string;
35
+ }>;
36
+ export declare function stopEmbeddedDatabase(projectRoot: string, config: ReactPressConfig): Promise<void>;
37
+ export declare function ensureDatabase(projectRoot: string, config: ReactPressConfig): Promise<{
38
+ ok: boolean;
39
+ message?: string;
40
+ }>;
41
+ export declare function isDatabaseReady(projectRoot: string): Promise<boolean>;
42
+ export {};
43
+ //# sourceMappingURL=database.d.ts.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