@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,30 +0,0 @@
1
- import type { CLI, InstallOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { log, runCommand } from '@stacksjs/cli'
4
- import { path as p } from '@stacksjs/path'
5
-
6
- export function install(buddy: CLI): void {
7
- const descriptions = {
8
- install: 'Install your dependencies',
9
- project: 'Target a specific project',
10
- verbose: 'Enable verbose output',
11
- }
12
-
13
- buddy
14
- .command('install', descriptions.install)
15
- .option('-p, --project [project]', descriptions.project, { default: false })
16
- .option('-v, --verbose', descriptions.verbose, { default: false })
17
- .action(async (options: InstallOptions) => {
18
- log.debug('Running `buddy install` ...', options)
19
-
20
- await runCommand('bun install', {
21
- ...options,
22
- cwd: p.projectPath(),
23
- })
24
- })
25
-
26
- buddy.on('install:*', () => {
27
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
28
- process.exit(1)
29
- })
30
- }
@@ -1,36 +0,0 @@
1
- import type { CLI, KeyOptions } 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
-
7
- export function key(buddy: CLI): void {
8
- const descriptions = {
9
- command: 'Generate & set the application key.',
10
- project: 'Target a specific project',
11
- verbose: 'Enable verbose output',
12
- }
13
-
14
- buddy
15
- .command('key:generate', descriptions.command)
16
- .option('-p, --project [project]', descriptions.project, { default: false })
17
- .option('--verbose', descriptions.verbose, { default: false })
18
- .action(async (options: KeyOptions) => {
19
- log.debug('Running `buddy key:generate` ...', options)
20
-
21
- await intro('buddy key:generate')
22
- const result = await runAction(Action.KeyGenerate, options)
23
-
24
- if (result.isErr()) {
25
- log.error('Failed to set random application key.', result.error)
26
- process.exit()
27
- }
28
-
29
- await outro('Random application key set.')
30
- })
31
-
32
- buddy.on('key:*', () => {
33
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
34
- process.exit(1)
35
- })
36
- }
@@ -1,54 +0,0 @@
1
- import type { CLI, LintOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { intro, log, outro, runCommand } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
-
7
- export function lint(buddy: CLI): void {
8
- const descriptions = {
9
- lint: 'Automagically lints your project codebase',
10
- lintFix: 'Automagically fixes all lint errors',
11
- project: 'Target a specific project',
12
- verbose: 'Enable verbose output',
13
- }
14
-
15
- buddy
16
- .command('lint', descriptions.lint)
17
- .option('-f, --fix', descriptions.lintFix, { default: false })
18
- .option('-p, --project [project]', descriptions.project, { default: false })
19
- .option('--verbose', descriptions.verbose, { default: false })
20
- .action(async (options: LintOptions) => {
21
- log.debug('Running `buddy lint` ...', options)
22
-
23
- const startTime = await intro('buddy lint')
24
-
25
- if (options.fix)
26
- await runAction(Action.LintFix, { ...options })
27
- else await runCommand('bunx --bun eslint .')
28
-
29
- await outro('Linted your project', { startTime, useSeconds: true })
30
- })
31
-
32
- buddy
33
- .command('lint:fix', descriptions.lintFix)
34
- .option('-p, --project [project]', descriptions.project, { default: false })
35
- .option('--verbose', descriptions.verbose, { default: false })
36
- .action(async (options: LintOptions) => {
37
- log.debug('Running `buddy lint:fix` ...', options)
38
-
39
- log.info('Fixing lint errors...')
40
- const result = await runAction(Action.LintFix, { ...options })
41
-
42
- if (result.isErr()) {
43
- log.error('There was an error lint fixing your code.', result.error)
44
- process.exit()
45
- }
46
-
47
- log.success('Fixed lint errors')
48
- })
49
-
50
- buddy.on('lint:*', () => {
51
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
52
- process.exit(1)
53
- })
54
- }
@@ -1,42 +0,0 @@
1
- import type { CLI, CliOptions } from '@stacksjs/types'
2
- import { $ } from 'bun'
3
- import process from 'node:process'
4
- import { log } from '@stacksjs/logging'
5
- import { projectPath } from '@stacksjs/path'
6
-
7
- export function list(buddy: CLI): void {
8
- const descriptions = {
9
- list: 'List all of the project-specific Buddy commands',
10
- project: 'Target a specific project',
11
- verbose: 'Enable verbose output',
12
- }
13
-
14
- buddy
15
- .command('list', descriptions.list)
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 list` ...', options)
20
-
21
- $.cwd(projectPath())
22
-
23
- const test = await $`buddy --help`.text()
24
- const commandsSection = test.match(/Commands:.*?(?=For more info, run any command with the)/s)?.[0]
25
-
26
- if (commandsSection) {
27
- const cleanedCommands = commandsSection
28
- .replace('Commands:', '') // Remove "Commands:"
29
- .replace(/^\s+/gm, '') // Trim leading whitespace from the start of each line
30
-
31
- console.log(cleanedCommands)
32
- return
33
- }
34
-
35
- console.error('#1 - Please reach out to our Discord for helper: https://discord.gg/stacksjs')
36
- })
37
-
38
- buddy.on('list:*', () => {
39
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
40
- process.exit(1)
41
- })
42
- }
@@ -1,352 +0,0 @@
1
- import type { CLI, MakeOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import {
4
- createModel,
5
- createNotification,
6
- invoke,
7
- makeAction,
8
- makeComponent,
9
- makeDatabase,
10
- makeFunction,
11
- makeLanguage,
12
- makePage,
13
- makeStack,
14
- } from '@stacksjs/actions'
15
- import { intro, italic, outro, runCommand } from '@stacksjs/cli'
16
- import { localUrl } from '@stacksjs/config'
17
- import { log } from '@stacksjs/logging'
18
- import { path as p } from '@stacksjs/path'
19
- import { ExitCode } from '@stacksjs/types'
20
-
21
- export function make(buddy: CLI): void {
22
- const descriptions = {
23
- action: 'Create a new action',
24
- model: 'Create a new model',
25
- component: 'Create a new component',
26
- page: 'Create a new page',
27
- function: 'Create a new function',
28
- language: 'Create a new language',
29
- database: 'Create a new database',
30
- migration: 'Create a new migration',
31
- factory: 'Create a new factory',
32
- notification: 'Create a new notification',
33
- name: 'The name of the action',
34
- stack: 'Create a new stack',
35
- certificate: 'Create a new SSL Certificate',
36
- select: 'What are you trying to make?',
37
- project: 'Target a specific project',
38
- verbose: 'Enable verbose output',
39
- }
40
-
41
- buddy
42
- .command('make', 'The make command')
43
- .option('-a, --action [action]', descriptions.action, { default: false })
44
- .option('-m, --model [model]', descriptions.model, { default: false })
45
- .option('-c, --component [component]', descriptions.component, { default: false })
46
- .option('-p, --page [page]', descriptions.page, { default: false })
47
- .option('-f, --function [function]', descriptions.function, { default: false })
48
- .option('-l, --language [language]', descriptions.language, { default: false })
49
- .option('-d, --database [database]', descriptions.database, { default: false })
50
- .option('-m, --migration [migration]', descriptions.migration, { default: false })
51
- .option('-f, --factory [factory]', descriptions.factory, { default: false })
52
- .option('-n, --notification [notification]', descriptions.notification, { default: false })
53
- .option('-s, --stack [stack]', descriptions.stack, { default: false })
54
- .option('--verbose', descriptions.verbose, { default: false })
55
- .action(async (options: MakeOptions) => {
56
- log.debug('Running `buddy make` ...', options)
57
-
58
- const name = buddy.args[0]
59
-
60
- if (!name) {
61
- log.error('You need to specify a name. Read more about the documentation here.')
62
- process.exit()
63
- }
64
-
65
- // TODO: uncomment this when prompt is ready
66
- // if (hasNoOptions(options)) {
67
- // let answers = await prompt.require()
68
- // .multiselect(descriptions.select, {
69
- // options: [
70
- // { label: 'Page', value: 'page' },
71
- // { label: 'Function', value: 'function' },
72
- // { label: 'Component', value: 'component' },
73
- // { label: 'Notification', value: 'notification' },
74
- // { label: 'Language', value: 'language' },
75
- // { label: 'Database', value: 'database' },
76
- // { label: 'Migration', value: 'migration' },
77
- // { label: 'Factory', value: 'factory' },
78
- // { label: 'Stack', value: 'stack' },
79
- // ],
80
- // })
81
- //
82
- // if (answers !== null)
83
- // process.exit(ExitCode.InvalidArgument)
84
- //
85
- // if (isString(answers))
86
- // answers = [answers]
87
- //
88
- // // creates an object out of array and sets answers to true
89
- // options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
90
- // }
91
-
92
- await invoke(options)
93
-
94
- process.exit(ExitCode.Success)
95
- })
96
-
97
- buddy
98
- .command('make:component [name]', descriptions.component)
99
- .option('-n, --name [name]', descriptions.name, { default: false })
100
- .option('-p, --project [project]', descriptions.project, { default: false })
101
- .option('--verbose', descriptions.verbose, { default: false })
102
- .action(async (name: string, options: MakeOptions) => {
103
- log.debug('Running `buddy make:component` ...', options)
104
-
105
- name = name ?? options.name
106
- options.name = name
107
-
108
- if (!name) {
109
- log.error('You need to specify a name. Read more about the documentation here.')
110
- process.exit()
111
- }
112
-
113
- await makeComponent(options)
114
- })
115
-
116
- buddy
117
- .command('make:database [name]', descriptions.database)
118
- .option('-n, --name [name]', descriptions.name, { default: false })
119
- .option('-p, --project [project]', descriptions.project, { default: false })
120
- .option('--verbose', descriptions.verbose, { default: false })
121
- .action((name: string, options: MakeOptions) => {
122
- log.debug('Running `buddy make:database` ...', options)
123
-
124
- name = name ?? options.name
125
- options.name = name
126
-
127
- if (!name) {
128
- log.error('You need to specify a database name via the `--name` option, or as the command’s argument.')
129
- log.info('Example: `buddy make:database my-cool-database`')
130
- log.info('Or: `buddy make:database --name=my-cool-database`')
131
- log.info('Read more about the documentation here: https://stacksjs.org/docs/make/database')
132
- process.exit()
133
- }
134
-
135
- makeDatabase(options)
136
- })
137
-
138
- buddy
139
- .command('make:factory [name]', descriptions.factory)
140
- .option('-n, --name [name]', descriptions.name, { default: false })
141
- .option('-p, --project [project]', descriptions.project, { default: false })
142
- .option('--verbose', descriptions.verbose, { default: false })
143
- .action((name: string, options: MakeOptions) => {
144
- log.debug('Running `buddy make:factory` ...', options)
145
-
146
- name = name ?? options.name
147
- options.name = name
148
-
149
- if (!name) {
150
- log.error('You need to specify a name. Read more about the documentation here.')
151
- process.exit()
152
- }
153
-
154
- // makeFactory(options)
155
- })
156
-
157
- buddy
158
- .command('make:view [name]', descriptions.page)
159
- .alias('make:page [name]')
160
- .option('-n, --name [name]', descriptions.name, { default: false })
161
- .option('-p, --project [project]', descriptions.project, { default: false })
162
- .option('--verbose', descriptions.verbose, { default: false })
163
- .action(async (name: string, options: MakeOptions) => {
164
- log.debug('Running `buddy make:view` ...', options)
165
-
166
- name = name ?? options.name
167
- options.name = name
168
-
169
- if (!name) {
170
- log.error('You need to specify a name. Read more about the documentation here.')
171
- process.exit()
172
- }
173
-
174
- await makePage(options)
175
- })
176
-
177
- buddy
178
- .command('make:function [name]', descriptions.function)
179
- .option('-n, --name [name]', descriptions.name, { default: false })
180
- .option('-p, --project [project]', descriptions.project, { default: false })
181
- .option('--verbose', descriptions.verbose, { default: false })
182
- .action(async (options: MakeOptions) => {
183
- log.debug('Running `buddy make:function` ...', options)
184
-
185
- await makeFunction(options)
186
- })
187
-
188
- buddy
189
- .command('make:lang [name]', descriptions.language)
190
- .option('-n, --name [name]', descriptions.name, { default: false })
191
- .option('-p, --project [project]', descriptions.project, { default: false })
192
- .option('--verbose', descriptions.verbose, { default: false })
193
- .action(async (name: string, options: MakeOptions) => {
194
- log.debug('Running `buddy make:lang` ...', options)
195
-
196
- name = name ?? options.name
197
- options.name = name
198
-
199
- if (!name) {
200
- log.error('You need to specify a name. Read more about the documentation here.')
201
- process.exit()
202
- }
203
-
204
- await makeLanguage(options)
205
- })
206
-
207
- buddy
208
- .command('make:notification [name]', descriptions.notification)
209
- .option('-n, --name [name]', descriptions.name, { default: false })
210
- .option('-e, --email', 'Is it an email notification?', { default: true })
211
- .option('-c, --chat', 'Is it a chat notification?', { default: false })
212
- .option('-s, --sms', 'Is it a SMS notification?', { default: false })
213
- .option('-p, --project [project]', descriptions.project, { default: false })
214
- .option('--verbose', descriptions.verbose, { default: false })
215
- .action(async (name: string, options: MakeOptions) => {
216
- log.debug('Running `buddy make:notification` ...', options)
217
-
218
- const perf = await intro('buddy make:notification')
219
-
220
- name = name ?? options.name
221
- options.name = name
222
-
223
- if (!name) {
224
- log.error('You need to specify a name. Read more about the documentation here.')
225
- process.exit()
226
- }
227
-
228
- const result = await createNotification(options)
229
-
230
- if (!result) {
231
- await outro('While running the make:notification command, there was an issue', {
232
- startTime: perf,
233
- useSeconds: true,
234
- })
235
- process.exit()
236
- }
237
-
238
- await outro(`Created your ${italic(name)} notification.`, {
239
- startTime: perf,
240
- useSeconds: true,
241
- })
242
- process.exit(ExitCode.Success)
243
- })
244
-
245
- buddy
246
- .command('make:stack [name]', descriptions.stack)
247
- .option('-n, --name [name]', descriptions.name, { default: false })
248
- .option('-p, --project [project]', descriptions.project, { default: false })
249
- .option('--verbose', descriptions.verbose, { default: false })
250
- .action((name: string, options: MakeOptions) => {
251
- log.debug('Running `buddy make:stack` ...', options)
252
-
253
- name = name ?? options.name
254
- options.name = name
255
-
256
- if (!name) {
257
- log.error('You need to specify a name. Read more about the documentation here.')
258
- process.exit()
259
- }
260
-
261
- makeStack(options)
262
- })
263
-
264
- buddy
265
- .command('make:action [name]', descriptions.action)
266
- .option('-n, --name [name]', descriptions.name, { default: false })
267
- .option('-p, --project [project]', descriptions.project, { default: false })
268
- .option('--verbose', descriptions.verbose, { default: false })
269
- .action(async (name: string, options: MakeOptions) => {
270
- log.info('Running `buddy make:action` ...')
271
- log.debug('Running `buddy make:action` ...', name, options)
272
-
273
- name = name ?? options.name
274
- options.name = name
275
-
276
- if (!name) {
277
- log.error('You need to specify a name. Read more about the documentation here.')
278
- process.exit()
279
- }
280
-
281
- await makeAction(options)
282
- })
283
-
284
- buddy
285
- .command('make:model [name]', descriptions.model)
286
- .option('-n, --name [name]', descriptions.name, { default: false })
287
- .option('-p, --project [project]', descriptions.project, { default: false })
288
- .option('--verbose', descriptions.verbose, { default: false })
289
- .action(async (name: string, options: MakeOptions) => {
290
- log.debug('Running `buddy make:model` ...', options)
291
-
292
- name = name ?? options.name
293
- options.name = name
294
-
295
- if (!name) {
296
- log.error('You need to specify a model name')
297
- process.exit()
298
- }
299
-
300
- await createModel(options)
301
- })
302
-
303
- buddy
304
- .command('make:migration [name]', descriptions.migration)
305
- .option('-n, --name [name]', descriptions.name, { default: false })
306
- .option('-p, --project [project]', descriptions.project, { default: false })
307
- .option('--verbose', descriptions.verbose, { default: false })
308
- .action((name: string, options: MakeOptions) => {
309
- log.debug('Running `buddy make:migration` ...', options)
310
-
311
- name = name ?? options.name
312
- options.name = name
313
-
314
- if (!name) {
315
- log.error('You need to specify a migration name')
316
- process.exit()
317
- }
318
-
319
- // log.info(path)
320
- })
321
-
322
- buddy
323
- .command('make:certificate', descriptions.certificate)
324
- .alias('make:cert')
325
- .example('buddy make:certificate')
326
- .action(async (options: MakeOptions) => {
327
- log.debug('Running `buddy make:certificate` ...', options)
328
-
329
- const domain = await localUrl()
330
-
331
- log.info(`Creating SSL certificate...`)
332
- await runCommand(`tlsx ${domain}`, {
333
- cwd: p.storagePath('keys'),
334
- })
335
- log.success('Certificate created')
336
-
337
- log.info(`Installing SSL certificate...`)
338
- await runCommand(`tlsx -install`, {
339
- cwd: p.storagePath('keys'),
340
- })
341
- log.success('Certificate installed')
342
- })
343
-
344
- buddy.on('make:*', () => {
345
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
346
- process.exit(1)
347
- })
348
- }
349
-
350
- // function hasNoOptions(options: MakeOptions) {
351
- // return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.notification && !options.stack
352
- // }
@@ -1,105 +0,0 @@
1
- import type { CLI, MigrateOptions } 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 { ExitCode } from '@stacksjs/types'
7
-
8
- export function migrate(buddy: CLI): void {
9
- const descriptions = {
10
- migrate: 'Migrates your database',
11
- dns: 'Writes the DNS records for a domain to ./config/dns.ts',
12
- project: 'Target a specific project',
13
- verbose: 'Enable verbose output',
14
- }
15
-
16
- buddy
17
- .command('migrate', descriptions.migrate)
18
- .option('-d, --diff', 'Show the SQL that would be run', { default: false })
19
- .option('-p, --project [project]', descriptions.project, { default: false })
20
- .option('--verbose', descriptions.verbose, { default: false })
21
- .action(async (options: MigrateOptions) => {
22
- log.debug('Running `buddy migrate` ...', options)
23
-
24
- const perf = await intro('buddy migrate')
25
- const result = await runAction(Action.Migrate, options)
26
-
27
- if (result.isErr()) {
28
- await outro(
29
- 'While running the migrate command, there was an issue',
30
- { startTime: perf, useSeconds: true },
31
- result.error,
32
- )
33
- process.exit()
34
- }
35
-
36
- const APP_ENV = process.env.APP_ENV || 'local'
37
-
38
- await outro(`Migrated your ${APP_ENV} database.`, {
39
- startTime: perf,
40
- useSeconds: true,
41
- })
42
- process.exit(ExitCode.Success)
43
- })
44
-
45
- buddy
46
- .command('migrate:fresh', descriptions.migrate)
47
- .option('-d, --diff', 'Show the SQL that would be run', { default: false })
48
- .option('-p, --project [project]', descriptions.project, { default: false })
49
- .option('--verbose', descriptions.verbose, { default: false })
50
- .action(async (options: MigrateOptions) => {
51
- log.debug('Running `buddy migrate:fresh` ...', options)
52
-
53
- const perf = await intro('buddy migrate:fresh')
54
- const result = await runAction(Action.MigrateFresh, options)
55
-
56
- if (result.isErr()) {
57
- await outro(
58
- 'While running the migrate:fresh command, there was an issue',
59
- { startTime: perf, useSeconds: true },
60
- result.error,
61
- )
62
- process.exit()
63
- }
64
-
65
- await outro(`All tables dropped successfully & migrated successfully`, {
66
- startTime: perf,
67
- useSeconds: true,
68
- })
69
-
70
- process.exit(ExitCode.Success)
71
- })
72
-
73
- buddy
74
- .command('migrate:dns', descriptions.migrate)
75
- .option('-p, --project [project]', descriptions.project, { default: false })
76
- .option('--verbose', descriptions.verbose, { default: false })
77
- .action(async (options: MigrateOptions) => {
78
- log.debug('Running `buddy migrate:dns` ...', options)
79
-
80
- const perf = await intro('buddy migrate:dns')
81
- const result = await runAction(Action.MigrateDns, { ...options })
82
-
83
- if (result.isErr()) {
84
- await outro(
85
- 'While running the migrate:dns command, there was an issue',
86
- { startTime: perf, useSeconds: true },
87
- result.error,
88
- )
89
- process.exit()
90
- }
91
-
92
- const APP_URL = process.env.APP_URL || 'undefined'
93
-
94
- await outro(`Migrated your ${APP_URL} DNS.`, {
95
- startTime: perf,
96
- useSeconds: true,
97
- })
98
- process.exit(ExitCode.Success)
99
- })
100
-
101
- buddy.on('migrate:*', () => {
102
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
103
- process.exit(1)
104
- })
105
- }
@@ -1,31 +0,0 @@
1
- import type { CLI } from '@stacksjs/types'
2
- import { $ } from 'bun'
3
- import process from 'node:process'
4
- import { log } from '@stacksjs/logging'
5
- import { projectPath } from '@stacksjs/path'
6
-
7
- export function outdated(buddy: CLI): void {
8
- const descriptions = {
9
- outdated: 'List all the outdated project dependencies',
10
- project: 'Target a specific project',
11
- verbose: 'Enable verbose output',
12
- }
13
-
14
- buddy
15
- .command('outdated', descriptions.outdated)
16
- .option('-p, --project [project]', descriptions.project, { default: false })
17
- .option('--verbose', descriptions.verbose, { default: false })
18
- .action(async () => {
19
- log.debug('Running `buddy outdated` ...')
20
-
21
- $.cwd(projectPath())
22
-
23
- const response = await $`bun outdated`.text()
24
- console.log(response)
25
- })
26
-
27
- buddy.on('outdated:*', () => {
28
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
29
- process.exit(1)
30
- })
31
- }