@stacksjs/buddy 0.66.0 → 0.68.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 (296) hide show
  1. package/dist/add.d.ts +4 -0
  2. package/dist/build.d.ts +4 -0
  3. package/dist/changelog.d.ts +3 -0
  4. package/dist/chunk-06g79v9j.js +2 -0
  5. package/dist/chunk-08bm2xax.js +2 -0
  6. package/dist/chunk-0enrsn65.js +978 -0
  7. package/dist/chunk-0m218zhk.js +2 -0
  8. package/dist/chunk-0q0jn0kk.js +6 -0
  9. package/dist/chunk-0yyhz107.js +2 -0
  10. package/dist/chunk-11vhe2za.js +2 -0
  11. package/dist/chunk-13143jmy.js +3 -0
  12. package/dist/chunk-1agj4qty.js +2 -0
  13. package/dist/chunk-1c4yywmn.js +9 -0
  14. package/dist/chunk-1e2f0z80.js +2 -0
  15. package/dist/chunk-1v13dkfw.js +2 -0
  16. package/dist/chunk-20e0mpcw.js +9 -0
  17. package/dist/chunk-25nxsybw.js +2 -0
  18. package/dist/chunk-27ksm11g.js +2 -0
  19. package/dist/chunk-2mhj5ght.js +2 -0
  20. package/dist/chunk-2wrs9p57.js +1 -0
  21. package/dist/chunk-2yj4j69j.js +2 -0
  22. package/dist/chunk-2ymn50ck.js +2 -0
  23. package/dist/chunk-3vjfkr7v.js +978 -0
  24. package/dist/{chunk-3zx3yk1m.js → chunk-3wpw5xgd.js} +1 -4
  25. package/dist/chunk-3y0gapf6.js +2 -0
  26. package/dist/chunk-4rb5r88h.js +978 -0
  27. package/dist/chunk-4wb68jfr.js +2 -0
  28. package/dist/chunk-5ewcj9vd.js +2 -0
  29. package/dist/chunk-5fm9mfqs.js +2 -0
  30. package/dist/chunk-5jhkn5by.js +2 -0
  31. package/dist/chunk-5m9xts4v.js +2 -0
  32. package/dist/chunk-6sqy7049.js +2 -0
  33. package/dist/chunk-6yazdvb4.js +2 -0
  34. package/dist/chunk-746p83dw.js +2 -0
  35. package/dist/chunk-76g7tr80.js +2 -0
  36. package/dist/chunk-7fz1p8p3.js +10 -0
  37. package/dist/chunk-814adsn3.js +2 -0
  38. package/dist/chunk-831wk0b3.js +2 -0
  39. package/dist/chunk-833tanrb.js +2 -0
  40. package/dist/chunk-8cx90pvv.js +2 -0
  41. package/dist/chunk-8gx9at51.js +1 -0
  42. package/dist/chunk-91pnyybg.js +9 -0
  43. package/dist/chunk-99syj1p0.js +2 -0
  44. package/dist/chunk-9bxh78vd.js +5 -0
  45. package/dist/chunk-9jaqey2q.js +2 -0
  46. package/dist/chunk-9tyaew40.js +2 -0
  47. package/dist/chunk-9zcyq5gh.js +2 -0
  48. package/dist/chunk-a4g1e1n0.js +2 -0
  49. package/dist/chunk-a6g2jk1y.js +2 -0
  50. package/dist/chunk-aaqd43t5.js +2 -0
  51. package/dist/chunk-adswb3gq.js +2 -0
  52. package/dist/chunk-atnw2cq3.js +2 -0
  53. package/dist/chunk-avdharmq.js +2 -0
  54. package/dist/chunk-b13gbfg3.js +2 -0
  55. package/dist/chunk-b3wr7cpk.js +2 -0
  56. package/dist/chunk-bngyck4v.js +2 -0
  57. package/dist/chunk-brb5zthb.js +1 -0
  58. package/dist/chunk-bx2vf8g7.js +5 -0
  59. package/dist/chunk-c343n0yt.js +2 -0
  60. package/dist/chunk-cdwpqzrw.js +2 -0
  61. package/dist/chunk-cm7bwdk9.js +2 -0
  62. package/dist/chunk-cs5k02gt.js +1 -0
  63. package/dist/chunk-cv8f2v27.js +2 -0
  64. package/dist/chunk-d2dbhn2h.js +2 -0
  65. package/dist/chunk-d3awsfqm.js +9 -0
  66. package/dist/chunk-d9q17hb8.js +2 -0
  67. package/dist/chunk-dw62d69f.js +2 -0
  68. package/dist/chunk-e8p8v7ca.js +978 -0
  69. package/dist/chunk-ehhrhkwe.js +9 -0
  70. package/dist/chunk-enhf12a1.js +2 -0
  71. package/dist/chunk-f0ksrase.js +8 -0
  72. package/dist/chunk-f2d9w3nr.js +2 -0
  73. package/dist/chunk-f3y73e4b.js +6 -0
  74. package/dist/chunk-fe3xb8z9.js +2 -0
  75. package/dist/chunk-fg5gh4dn.js +2 -0
  76. package/dist/chunk-fh4rw8kr.js +5 -0
  77. package/dist/chunk-fxsv4p5c.js +8 -0
  78. package/dist/chunk-gg80s18j.js +2 -0
  79. package/dist/chunk-h5saw32v.js +2 -0
  80. package/dist/chunk-ha75r57f.js +8 -0
  81. package/dist/chunk-hgrs6wcy.js +2 -0
  82. package/dist/chunk-hrsat16n.js +8 -0
  83. package/dist/chunk-hxy5t7tm.js +10 -0
  84. package/dist/chunk-hzfqtj82.js +2 -0
  85. package/dist/chunk-j2n86dsz.js +2 -0
  86. package/dist/chunk-jg68fsnk.js +10 -0
  87. package/dist/chunk-jhvjhf1j.js +2 -0
  88. package/dist/chunk-jr4naxsv.js +2 -0
  89. package/dist/chunk-jtax0mpm.js +2 -0
  90. package/dist/chunk-k59kbbvm.js +2 -0
  91. package/dist/chunk-kanz993c.js +2 -0
  92. package/dist/chunk-kg9abatp.js +2 -0
  93. package/dist/chunk-kvghsjg7.js +5 -0
  94. package/dist/chunk-ky8p46ae.js +5 -0
  95. package/dist/chunk-kzm498bh.js +2 -0
  96. package/dist/chunk-m4gwjnfh.js +6 -0
  97. package/dist/chunk-msv6dcc2.js +2 -0
  98. package/dist/chunk-mxdajhb4.js +10 -0
  99. package/dist/chunk-mxzjn2gs.js +978 -0
  100. package/dist/chunk-n1bqkqk7.js +10 -0
  101. package/dist/chunk-njtyervf.js +1 -0
  102. package/dist/chunk-nx1598yr.js +2 -0
  103. package/dist/chunk-p18kqenr.js +1 -0
  104. package/dist/chunk-p23aswbf.js +2 -0
  105. package/dist/chunk-p55ntqj0.js +2 -0
  106. package/dist/chunk-p5va3trj.js +2 -0
  107. package/dist/chunk-p88bsqtc.js +10 -0
  108. package/dist/chunk-p9z7f8c8.js +2 -0
  109. package/dist/chunk-ppkzf21q.js +8 -0
  110. package/dist/chunk-prqq5zw2.js +2 -0
  111. package/dist/chunk-pv6hp18q.js +10 -0
  112. package/dist/chunk-q9ycfthp.js +2 -0
  113. package/dist/chunk-qhcx6dmf.js +2 -0
  114. package/dist/chunk-qma4ysd8.js +9 -0
  115. package/dist/chunk-qqp394c2.js +2 -0
  116. package/dist/chunk-ra5sfgg4.js +2 -0
  117. package/dist/chunk-rfd43z7p.js +5 -0
  118. package/dist/chunk-s2n3hw0a.js +2 -0
  119. package/dist/chunk-sm7vvfqf.js +2 -0
  120. package/dist/chunk-sqbdav33.js +2 -0
  121. package/dist/chunk-sy4d4hnx.js +2 -0
  122. package/dist/chunk-t0b356bb.js +978 -0
  123. package/dist/chunk-t9wdnzz4.js +6 -0
  124. package/dist/chunk-v25g7h01.js +2 -0
  125. package/dist/chunk-v7zy7xda.js +1 -0
  126. package/dist/chunk-vg4vfkzk.js +6 -0
  127. package/dist/chunk-vgcre8jy.js +2 -0
  128. package/dist/chunk-vqyngnj0.js +9 -0
  129. package/dist/chunk-w17d2rbd.js +6 -0
  130. package/dist/chunk-x22v9kvb.js +2 -0
  131. package/dist/chunk-xacjs4ar.js +6 -0
  132. package/dist/chunk-xmdbxa8w.js +1 -0
  133. package/dist/chunk-xy6hjazn.js +978 -0
  134. package/dist/chunk-y0m35t3m.js +2 -0
  135. package/dist/chunk-y1tre8v8.js +8 -0
  136. package/dist/chunk-y50mc7dt.js +2 -0
  137. package/dist/chunk-y93ke5m6.js +2 -0
  138. package/dist/chunk-yktee4wv.js +1 -0
  139. package/dist/chunk-yvmyw2r2.js +2 -0
  140. package/dist/chunk-z1h35hsa.js +2 -0
  141. package/dist/chunk-z6xydw90.js +2 -0
  142. package/dist/chunk-zak32nab.js +2 -0
  143. package/dist/clean.d.ts +3 -0
  144. package/dist/cli.d.ts +4 -1
  145. package/dist/cli.js +1 -4
  146. package/dist/cloud.d.ts +3 -0
  147. package/dist/commit.d.ts +3 -0
  148. package/dist/configure.d.ts +4 -0
  149. package/dist/create.d.ts +8 -0
  150. package/dist/custom-cli.d.ts +1 -1
  151. package/dist/deploy.d.ts +7 -0
  152. package/dist/{commands/dev.d.ts → dev.d.ts} +3 -1
  153. package/dist/dns.d.ts +18 -0
  154. package/dist/domains.d.ts +3 -0
  155. package/dist/fresh.d.ts +3 -0
  156. package/dist/generate.d.ts +3 -0
  157. package/dist/http.d.ts +6 -0
  158. package/dist/index.d.ts +1 -1
  159. package/dist/index.js +1 -4
  160. package/dist/install.d.ts +3 -0
  161. package/dist/key.d.ts +3 -0
  162. package/dist/lint.d.ts +3 -0
  163. package/dist/list.d.ts +3 -0
  164. package/dist/make.d.ts +1 -0
  165. package/dist/migrate.d.ts +3 -0
  166. package/dist/outdated.d.ts +3 -0
  167. package/dist/ports.d.ts +7 -0
  168. package/dist/prepublish.d.ts +3 -0
  169. package/dist/projects.d.ts +3 -0
  170. package/dist/release.d.ts +9 -0
  171. package/dist/route.d.ts +3 -0
  172. package/dist/saas.d.ts +3 -0
  173. package/dist/seed.d.ts +3 -0
  174. package/dist/setup.d.ts +8 -0
  175. package/dist/stacks +0 -0
  176. package/dist/test.d.ts +3 -0
  177. package/dist/tinker.d.ts +3 -0
  178. package/dist/types.d.ts +3 -0
  179. package/dist/upgrade.d.ts +4 -0
  180. package/dist/version.d.ts +3 -0
  181. package/package.json +48 -49
  182. package/dist/chunk-3cfvbq6w.js +0 -5
  183. package/dist/chunk-3cfvbq6w.js.map +0 -32
  184. package/dist/chunk-3v3h2zkp.js +0 -5
  185. package/dist/chunk-3v3h2zkp.js.map +0 -46
  186. package/dist/chunk-3zx3yk1m.js.map +0 -15
  187. package/dist/chunk-8a487snn.js +0 -5
  188. package/dist/chunk-8a487snn.js.map +0 -9
  189. package/dist/chunk-9kkf5maz.js +0 -5
  190. package/dist/chunk-9kkf5maz.js.map +0 -23
  191. package/dist/chunk-9qba8jdt.js +0 -12
  192. package/dist/chunk-9qba8jdt.js.map +0 -11
  193. package/dist/chunk-cvpb67bs.js +0 -5
  194. package/dist/chunk-cvpb67bs.js.map +0 -10
  195. package/dist/chunk-eqwfdbyk.js +0 -5
  196. package/dist/chunk-eqwfdbyk.js.map +0 -17
  197. package/dist/chunk-f41k7dpa.js +0 -5
  198. package/dist/chunk-f41k7dpa.js.map +0 -11
  199. package/dist/chunk-fx1zxxxa.js +0 -9
  200. package/dist/chunk-fx1zxxxa.js.map +0 -13
  201. package/dist/chunk-get5gzkc.js +0 -11
  202. package/dist/chunk-get5gzkc.js.map +0 -10
  203. package/dist/chunk-m43npkjw.js +0 -5
  204. package/dist/chunk-m43npkjw.js.map +0 -12
  205. package/dist/chunk-mrrgcavv.js +0 -831
  206. package/dist/chunk-mrrgcavv.js.map +0 -240
  207. package/dist/chunk-n5y0mrsg.js +0 -15
  208. package/dist/chunk-n5y0mrsg.js.map +0 -173
  209. package/dist/chunk-qebxvzqz.js +0 -5
  210. package/dist/chunk-qebxvzqz.js.map +0 -26
  211. package/dist/chunk-qj2v5psd.js +0 -5
  212. package/dist/chunk-qj2v5psd.js.map +0 -20
  213. package/dist/chunk-rh4brnzh.js +0 -5
  214. package/dist/chunk-rh4brnzh.js.map +0 -16
  215. package/dist/chunk-w2vwjv6k.js +0 -6
  216. package/dist/chunk-w2vwjv6k.js.map +0 -57
  217. package/dist/chunk-w81rbh65.js +0 -5
  218. package/dist/chunk-w81rbh65.js.map +0 -10
  219. package/dist/chunk-wayp5kn2.js +0 -5
  220. package/dist/chunk-wayp5kn2.js.map +0 -22
  221. package/dist/chunk-x5c5ngpb.js +0 -4
  222. package/dist/chunk-x5c5ngpb.js.map +0 -23
  223. package/dist/cli.js.map +0 -10
  224. package/dist/commands/add.d.ts +0 -2
  225. package/dist/commands/build.d.ts +0 -2
  226. package/dist/commands/changelog.d.ts +0 -2
  227. package/dist/commands/clean.d.ts +0 -2
  228. package/dist/commands/cloud.d.ts +0 -2
  229. package/dist/commands/commit.d.ts +0 -2
  230. package/dist/commands/configure.d.ts +0 -2
  231. package/dist/commands/create.d.ts +0 -2
  232. package/dist/commands/deploy.d.ts +0 -2
  233. package/dist/commands/dns.d.ts +0 -2
  234. package/dist/commands/domains.d.ts +0 -2
  235. package/dist/commands/fresh.d.ts +0 -2
  236. package/dist/commands/generate.d.ts +0 -2
  237. package/dist/commands/http.d.ts +0 -2
  238. package/dist/commands/index.d.ts +0 -33
  239. package/dist/commands/install.d.ts +0 -2
  240. package/dist/commands/key.d.ts +0 -2
  241. package/dist/commands/lint.d.ts +0 -2
  242. package/dist/commands/list.d.ts +0 -2
  243. package/dist/commands/make.d.ts +0 -2
  244. package/dist/commands/migrate.d.ts +0 -2
  245. package/dist/commands/outdated.d.ts +0 -2
  246. package/dist/commands/ports.d.ts +0 -2
  247. package/dist/commands/prepublish.d.ts +0 -2
  248. package/dist/commands/projects.d.ts +0 -2
  249. package/dist/commands/release.d.ts +0 -2
  250. package/dist/commands/route.d.ts +0 -2
  251. package/dist/commands/seed.d.ts +0 -2
  252. package/dist/commands/setup.d.ts +0 -4
  253. package/dist/commands/test.d.ts +0 -2
  254. package/dist/commands/tinker.d.ts +0 -2
  255. package/dist/commands/types.d.ts +0 -2
  256. package/dist/commands/upgrade.d.ts +0 -2
  257. package/dist/commands/version.d.ts +0 -2
  258. package/dist/index.js.map +0 -9
  259. package/src/cli.ts +0 -105
  260. package/src/commands/add.ts +0 -71
  261. package/src/commands/build.ts +0 -299
  262. package/src/commands/changelog.ts +0 -52
  263. package/src/commands/clean.ts +0 -46
  264. package/src/commands/cloud.ts +0 -553
  265. package/src/commands/commit.ts +0 -26
  266. package/src/commands/configure.ts +0 -84
  267. package/src/commands/create.ts +0 -143
  268. package/src/commands/deploy.ts +0 -194
  269. package/src/commands/dev.ts +0 -292
  270. package/src/commands/dns.ts +0 -86
  271. package/src/commands/domains.ts +0 -255
  272. package/src/commands/fresh.ts +0 -48
  273. package/src/commands/generate.ts +0 -202
  274. package/src/commands/http.ts +0 -57
  275. package/src/commands/index.ts +0 -33
  276. package/src/commands/install.ts +0 -30
  277. package/src/commands/key.ts +0 -36
  278. package/src/commands/lint.ts +0 -54
  279. package/src/commands/list.ts +0 -42
  280. package/src/commands/make.ts +0 -352
  281. package/src/commands/migrate.ts +0 -105
  282. package/src/commands/outdated.ts +0 -31
  283. package/src/commands/ports.ts +0 -188
  284. package/src/commands/prepublish.ts +0 -28
  285. package/src/commands/projects.ts +0 -54
  286. package/src/commands/release.ts +0 -47
  287. package/src/commands/route.ts +0 -39
  288. package/src/commands/seed.ts +0 -47
  289. package/src/commands/setup.ts +0 -145
  290. package/src/commands/test.ts +0 -214
  291. package/src/commands/tinker.ts +0 -42
  292. package/src/commands/types.ts +0 -35
  293. package/src/commands/upgrade.ts +0 -200
  294. package/src/commands/version.ts +0 -29
  295. package/src/custom-cli.ts +0 -35
  296. package/src/index.ts +0 -1
@@ -1,214 +0,0 @@
1
- import type { CLI, TestOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { intro, log, outro } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
- import { projectPath } from '@stacksjs/path'
7
-
8
- export function test(buddy: CLI): void {
9
- const descriptions = {
10
- command: 'Runs your test suite',
11
- types: 'Typechecks your codebase',
12
- coverage: 'Generates a test coverage report',
13
- ui: 'Runs your test suite in the browser',
14
- unit: 'Runs your unit tests',
15
- feature: 'Runs your feature tests',
16
- showReport: 'Show the test report',
17
- project: 'Target a specific project',
18
- verbose: 'Enable verbose output',
19
- }
20
-
21
- buddy
22
- .command('test', descriptions.command)
23
- .option('-f, --feature', descriptions.feature, { default: false })
24
- .option('-u, --unit', descriptions.unit, { default: false })
25
- // .option('--ui', descriptions.ui, { default: false })
26
- .option('-p, --project [project]', descriptions.project, { default: false })
27
- .option('--verbose', descriptions.verbose, { default: true })
28
- .action(async (options: TestOptions) => {
29
- const perf = await intro('buddy test')
30
-
31
- if (options.feature && options.unit) {
32
- const result = await runAction(Action.Test, {
33
- ...options,
34
- cwd: projectPath(),
35
- })
36
-
37
- if (result.isErr()) {
38
- await outro(
39
- 'While running `buddy test`, there was an issue',
40
- { startTime: perf, useSeconds: true },
41
- result.error,
42
- )
43
- process.exit()
44
- }
45
- }
46
-
47
- if (options.feature && !options.unit) {
48
- log.info('Running Feature tests...')
49
-
50
- const result = await runAction(Action.TestFeature, {
51
- ...options,
52
- cwd: projectPath(),
53
- })
54
-
55
- if (result.isErr()) {
56
- await outro(
57
- 'While running `buddy test`, there was an issue',
58
- { startTime: perf, useSeconds: true },
59
- result.error,
60
- )
61
- process.exit()
62
- }
63
- }
64
-
65
- if (!options.feature && options.unit) {
66
- log.info('Running Unit tests...')
67
-
68
- const result = await runAction(Action.TestUnit, {
69
- ...options,
70
- cwd: projectPath(),
71
- })
72
-
73
- if (result.isErr()) {
74
- await outro(
75
- 'While running `buddy test`, there was an issue',
76
- { startTime: perf, useSeconds: true },
77
- result.error,
78
- )
79
- process.exit()
80
- }
81
- }
82
-
83
- if (!options.feature && !options.unit) {
84
- const result = await runAction(Action.Test, {
85
- ...options,
86
- cwd: projectPath(),
87
- })
88
-
89
- if (result.isErr()) {
90
- await outro(
91
- 'While running `buddy test`, there was an issue',
92
- { startTime: perf, useSeconds: true },
93
- result.error,
94
- )
95
- process.exit()
96
- }
97
- }
98
-
99
- await outro('Finished running tests', {
100
- startTime: perf,
101
- useSeconds: true,
102
- })
103
- })
104
-
105
- buddy
106
- .command('test:unit', descriptions.unit)
107
- .option('--verbose', descriptions.verbose, { default: false })
108
- .action(async (options: TestOptions) => {
109
- const perf = await intro('buddy test:unit')
110
- const result = await runAction(Action.TestUnit, {
111
- ...options,
112
- verbose: true,
113
- cwd: projectPath(),
114
- })
115
-
116
- if (result.isErr()) {
117
- await outro(
118
- 'While running `buddy test:unit`, there was an issue',
119
- { startTime: perf, useSeconds: true },
120
- result.error,
121
- )
122
- process.exit()
123
- }
124
-
125
- await outro('Finished running unit tests', {
126
- startTime: perf,
127
- useSeconds: true,
128
- })
129
- })
130
-
131
- buddy
132
- .command('test:feature', descriptions.feature)
133
- .option('--verbose', descriptions.verbose, { default: false })
134
- .action(async (options: TestOptions) => {
135
- const perf = await intro('buddy test:feature')
136
- const result = await runAction(Action.TestFeature, {
137
- ...options,
138
- verbose: true,
139
- cwd: projectPath(),
140
- })
141
-
142
- if (result.isErr()) {
143
- await outro(
144
- 'While running `buddy test:feature`, there was an issue',
145
- { startTime: perf, useSeconds: true },
146
- result.error,
147
- )
148
- process.exit()
149
- }
150
-
151
- await outro('Finished running feature tests', {
152
- startTime: perf,
153
- useSeconds: true,
154
- })
155
- })
156
-
157
- buddy
158
- .command('test:ui', descriptions.command)
159
- .option('--verbose', descriptions.verbose, { default: false })
160
- .action(async (options: TestOptions) => {
161
- const perf = await intro('buddy test:ui')
162
- const result = await runAction(Action.TestUi, {
163
- ...options,
164
- verbose: true,
165
- cwd: projectPath(),
166
- })
167
-
168
- if (result.isErr()) {
169
- await outro(
170
- 'While running `buddy test:ui`, there was an issue',
171
- { startTime: perf, useSeconds: true },
172
- result.error,
173
- )
174
- process.exit()
175
- }
176
-
177
- await outro('Finished running tests in the browser', {
178
- startTime: perf,
179
- useSeconds: true,
180
- })
181
- })
182
-
183
- buddy
184
- .command('test:types', descriptions.types)
185
- .alias('typecheck')
186
- .option('--verbose', descriptions.verbose, { default: false })
187
- .action(async (options: TestOptions) => {
188
- const perf = await intro('buddy test:types')
189
- const result = await runAction(Action.Typecheck, {
190
- ...options,
191
- verbose: true,
192
- cwd: projectPath(),
193
- })
194
-
195
- if (result.isErr()) {
196
- await outro(
197
- 'While running `buddy test:types`, there was an issue',
198
- { startTime: perf, useSeconds: true },
199
- result.error,
200
- )
201
- process.exit()
202
- }
203
-
204
- await outro('Finished running typecheck', {
205
- startTime: perf,
206
- useSeconds: true,
207
- })
208
- })
209
-
210
- buddy.on('test:*', () => {
211
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
212
- process.exit(1)
213
- })
214
- }
@@ -1,42 +0,0 @@
1
- import type { CLI, TinkerOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { intro, log, outro, runCommand } from '@stacksjs/cli'
4
- import { ExitCode } from '@stacksjs/types'
5
-
6
- export function tinker(buddy: CLI): void {
7
- const descriptions = {
8
- tinker: 'Tinker with your code',
9
- project: 'Target a specific project',
10
- verbose: 'Enable verbose output',
11
- }
12
-
13
- buddy
14
- .command('tinker', descriptions.tinker)
15
- .option('-p, --project [project]', descriptions.project, { default: false })
16
- .option('--verbose', descriptions.verbose, { default: false })
17
- .action(async (options: TinkerOptions) => {
18
- log.debug('Running `buddy tinker` ...', options)
19
-
20
- const perf = await intro('buddy tinker')
21
- const result = await runCommand('bun repl', {
22
- stdin: 'inherit',
23
- })
24
-
25
- if (result.isErr()) {
26
- await outro(
27
- 'While running the tinker command, there was an issue',
28
- { startTime: perf, useSeconds: true },
29
- result.error || undefined,
30
- )
31
- process.exit()
32
- }
33
-
34
- await outro('Tinker mode exited.', { startTime: perf, useSeconds: true })
35
- process.exit(ExitCode.Success)
36
- })
37
-
38
- buddy.on('tinker:*', () => {
39
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
40
- process.exit(1)
41
- })
42
- }
@@ -1,35 +0,0 @@
1
- import type { CLI, CliOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { generateTypes } from '@stacksjs/actions'
4
- import { log } from '@stacksjs/logging'
5
-
6
- export function types(buddy: CLI): void {
7
- const descriptions = {
8
- generate: 'Generate the types of & for your library/libraries',
9
- fix: 'wip',
10
- project: 'Target a specific project',
11
- verbose: 'Enable verbose output',
12
- }
13
-
14
- buddy
15
- .command('types:generate', descriptions.generate)
16
- .option('-p, --project [project]', descriptions.project, { default: false })
17
- .option('--verbose', descriptions.verbose, { default: false })
18
- .action(async (options: CliOptions) => {
19
- log.debug('Running `buddy types:generate` ...', options)
20
- await generateTypes()
21
- })
22
-
23
- buddy
24
- .command('types:fix', descriptions.fix)
25
- .option('-p, --project [project]', descriptions.project, { default: false })
26
- .option('--verbose', descriptions.verbose, { default: false })
27
- .action(async () => {
28
- // await fixTypes()
29
- })
30
-
31
- buddy.on('types:*', () => {
32
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
33
- process.exit(1)
34
- })
35
- }
@@ -1,200 +0,0 @@
1
- import type { CLI, UpgradeOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { intro, log, outro, prompts } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
- import { ExitCode } from '@stacksjs/types'
7
- import { isString } from '@stacksjs/validation'
8
-
9
- export function upgrade(buddy: CLI): void {
10
- const descriptions = {
11
- command: 'Upgrade dependencies, framework, package manager, JS/TS runtime',
12
- framework: 'Upgrade the Stacks framework',
13
- dependencies: 'Upgrade your dependencies (pkgx.yaml & package.json)',
14
- bun: 'Upgrade Bun to the latest version',
15
- shell: 'Upgrade the to the latest shell integration (currently only supports Oh My Zsh)',
16
- binary:
17
- 'Upgrade the `stacks` binary to the latest version. Please note, the binary is moved to the `~/.stacks/bin` directory',
18
- all: 'Upgrade Node, package manager, project dependencies, and framework',
19
- force: 'Overwrite possible local updates with remote framework updates',
20
- select: 'What are you trying to upgrade?',
21
- project: 'Target a specific project',
22
- verbose: 'Enable verbose output',
23
- }
24
-
25
- buddy
26
- .command('upgrade', descriptions.command)
27
- .option('-d, --dependencies', descriptions.dependencies, { default: false })
28
- .option('-b, --bun', descriptions.bun, { default: false })
29
- .option('-a, --all', descriptions.all, { default: false })
30
- .option('-f, --force', descriptions.force, { default: false })
31
- .option('--framework', descriptions.framework, { default: false })
32
- .option('-p, --project [project]', descriptions.project, { default: false })
33
- .option('-s, --shell', descriptions.shell, { default: false })
34
- .option('-b, --binary', descriptions.binary, { default: false })
35
- // .option('--canary', descriptions.canary, { default: false })
36
- .option('--verbose', descriptions.verbose, { default: false })
37
- .alias('update')
38
- .example('buddy upgrade -a --verbose')
39
- .action(async (options: UpgradeOptions) => {
40
- log.debug('Running `buddy upgrade` ...', options)
41
-
42
- const perf = await intro('buddy upgrade')
43
-
44
- if (hasNoOptions(options)) {
45
- const answers = await prompts({
46
- type: 'multiselect',
47
- name: 'value',
48
- message: descriptions.select,
49
- choices: [
50
- { value: 'dependencies', title: 'Dependencies' },
51
- { value: 'framework', title: 'Framework' },
52
- { value: 'bun', title: 'Bun' },
53
- { value: 'shell', title: 'Shell' },
54
- { value: 'binary', title: 'Binary' },
55
- ],
56
- })
57
-
58
- let answersValue = answers.value
59
-
60
- if (answersValue !== null)
61
- process.exit(ExitCode.InvalidArgument)
62
-
63
- if (isString(answersValue))
64
- answersValue = [answersValue]
65
-
66
- // creates an object out of array and sets answers to true
67
- options = answersValue.reduce((a: any, v: any) => {
68
- a[v] = true
69
- return a
70
- }, {})
71
- }
72
-
73
- const result = await runAction(Action.Upgrade, options)
74
-
75
- if (result.isErr()) {
76
- await outro(
77
- 'While running the buddy:upgrade command, there was an issue',
78
- { startTime: perf, useSeconds: true },
79
- result.error,
80
- )
81
- process.exit()
82
- }
83
-
84
- await outro('Upgrade complete.', { startTime: perf, useSeconds: true })
85
- process.exit()
86
- })
87
-
88
- buddy
89
- .command('upgrade:framework', descriptions.framework)
90
- .option('-p, --project [project]', descriptions.project, { default: false })
91
- .option('--verbose', descriptions.verbose, { default: false })
92
- .example('buddy upgrade:framework --verbose')
93
- .action(async (options: UpgradeOptions) => {
94
- log.debug('Running `buddy upgrade:framework` ...', options)
95
-
96
- // const perf = await intro('buddy update:framework')
97
- await runAction(Action.Upgrade, options)
98
- })
99
-
100
- buddy
101
- .command('upgrade:dependencies', descriptions.dependencies)
102
- .option('-p, --project [project]', descriptions.project, { default: false })
103
- .option('--verbose', descriptions.verbose, { default: false })
104
- .alias('upgrade:deps')
105
- .example('buddy upgrade:dependencies --verbose')
106
- .action(async (options: UpgradeOptions) => {
107
- log.debug('Running `buddy upgrade:dependencies` ...', options)
108
- await runAction(Action.Upgrade, options)
109
- })
110
-
111
- buddy
112
- .command('upgrade:bun', descriptions.bun)
113
- .option('-p, --project [project]', descriptions.project, { default: false })
114
- .option('--verbose', descriptions.verbose, { default: false })
115
- .action(async (options: UpgradeOptions) => {
116
- log.debug('Running `buddy upgrade:bun` ...', options)
117
- const perf = await intro('buddy upgrade:bun')
118
- const result = await runAction(Action.UpgradeBun, options)
119
-
120
- if (result.isErr()) {
121
- await outro(
122
- 'While running the buddy upgrade:bun command, there was an issue',
123
- { startTime: perf, useSeconds: true },
124
- result.error,
125
- ) // FIXME: should not have to cast
126
- process.exit()
127
- }
128
-
129
- process.exit(ExitCode.Success)
130
- })
131
-
132
- buddy
133
- .command('upgrade:all', descriptions.all)
134
- .option('-p, --project [project]', descriptions.project, { default: false })
135
- .option('--verbose', descriptions.verbose, { default: false })
136
- .action(async (options: UpgradeOptions) => {
137
- log.debug('Running `buddy upgrade:all` ...', options)
138
- await runAction(Action.Upgrade, options)
139
- })
140
-
141
- buddy
142
- .command('upgrade:shell', descriptions.shell)
143
- .option('--verbose', descriptions.verbose, { default: false })
144
- .example('buddy upgrade:shell')
145
- .action(async (options: UpgradeOptions) => {
146
- log.debug('Running `buddy upgrade:shell` ...', options)
147
-
148
- const perf = await intro('buddy upgrade:shell')
149
- const result = await runAction(Action.UpgradeShell, options)
150
-
151
- if (result.isErr()) {
152
- await outro(
153
- 'While running the buddy upgrade:shell command, there was an issue',
154
- { startTime: perf, useSeconds: true },
155
- result.error,
156
- ) // FIXME: should not have to cast
157
- process.exit()
158
- }
159
-
160
- process.exit(ExitCode.Success)
161
- })
162
-
163
- buddy
164
- .command('upgrade:binary', descriptions.binary)
165
- .option('--verbose', descriptions.verbose, { default: false })
166
- .example('buddy upgrade:binary')
167
- .action(async (options: UpgradeOptions) => {
168
- if (process.getuid && process.getuid() !== 0) {
169
- log.warn('To upgrade the binary, you need to run this command with sudo, or as root.')
170
- process.exit(0) // Exit with an error code
171
- }
172
-
173
- log.debug('Running `buddy upgrade:binary` ...', options)
174
-
175
- const perf = await intro('buddy upgrade:binary')
176
- const result = await runAction(Action.UpgradeBinary, options)
177
-
178
- if (result.isErr()) {
179
- await outro(
180
- 'While running the buddy upgrade:binary command, there was an issue',
181
- { startTime: perf, useSeconds: true },
182
- result.error,
183
- ) // FIXME: should not have to cast
184
- process.exit()
185
- }
186
-
187
- process.exit(ExitCode.Success)
188
- })
189
-
190
- buddy.on('upgrade:*', () => {
191
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
192
- process.exit(1)
193
- })
194
- }
195
-
196
- function hasNoOptions(options: UpgradeOptions) {
197
- return (
198
- !options.framework && !options.dependencies && !options.bun && !options.shell && !options.binary && !options.all
199
- )
200
- }
@@ -1,29 +0,0 @@
1
- import type { CLI } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { bold, dim, green, intro, log } from '@stacksjs/cli'
4
- import { storage } from '@stacksjs/storage'
5
-
6
- export function version(buddy: CLI): void {
7
- const descriptions = {
8
- version: 'Retrieving Stacks build version',
9
- }
10
-
11
- buddy.command('version', descriptions.version).action(async () => {
12
- log.debug('Running `buddy version` ...')
13
- await intro('buddy version')
14
-
15
- const pkg = await storage.readPackageJson('./package.json')
16
- const bunVersion = 'wip'
17
- const stacksVersion = pkg.version
18
-
19
- log.info(green(bold('@stacksjs/ ')) + dim(` ${stacksVersion}`))
20
- log.info(green(bold('Bun: ')) + dim(` ${bunVersion}`))
21
-
22
- // redis (or other cache/s), mysql (or other database/s),
23
- })
24
-
25
- buddy.on('version:*', () => {
26
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
27
- process.exit(1)
28
- })
29
- }
package/src/custom-cli.ts DELETED
@@ -1,35 +0,0 @@
1
- import process from 'node:process'
2
- import { cli } from '@stacksjs/cli'
3
- import { config } from '@stacksjs/config'
4
- import { handleError } from '@stacksjs/error-handling'
5
- import { path as p } from '@stacksjs/path'
6
- import { fs } from '@stacksjs/storage'
7
-
8
- // setup global error handlers
9
- process.on('uncaughtException', handleError)
10
- process.on('unhandledRejection', handleError)
11
-
12
- async function main() {
13
- const buddy = cli(config.cli.name)
14
-
15
- if (!fs.existsSync(p.projectPath(config.cli.command)))
16
- fs.writeFileSync(p.projectPath(config.cli.command), `import('./storage/framework/core/buddy/src/custom-cli')`)
17
-
18
- // dynamically import and register commands from ./app/Commands/*
19
- const commandsDir = p.appPath('Commands')
20
- const commandFiles = fs.readdirSync(commandsDir).filter((file: string) => file.endsWith('.ts'))
21
-
22
- for (const file of commandFiles) {
23
- const commandPath = `${commandsDir}/${file}`
24
- const dynamicImport = await import(commandPath)
25
-
26
- // Correctly use the default export function
27
- if (typeof dynamicImport.default === 'function')
28
- dynamicImport.default(buddy)
29
- else console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
30
- }
31
-
32
- buddy.parse()
33
- }
34
-
35
- await main()
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './commands'