stacks 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 (45) hide show
  1. package/package.json +54 -49
  2. package/buddy/README.md +0 -396
  3. package/buddy/art/social.jpg +0 -0
  4. package/buddy/bin/cli.ts +0 -85
  5. package/buddy/build.ts +0 -43
  6. package/buddy/package.json +0 -129
  7. package/buddy/src/cli.ts +0 -105
  8. package/buddy/src/commands/add.ts +0 -71
  9. package/buddy/src/commands/build.ts +0 -299
  10. package/buddy/src/commands/changelog.ts +0 -52
  11. package/buddy/src/commands/clean.ts +0 -46
  12. package/buddy/src/commands/cloud.ts +0 -553
  13. package/buddy/src/commands/commit.ts +0 -26
  14. package/buddy/src/commands/configure.ts +0 -84
  15. package/buddy/src/commands/create.ts +0 -143
  16. package/buddy/src/commands/deploy.ts +0 -194
  17. package/buddy/src/commands/dev.ts +0 -292
  18. package/buddy/src/commands/dns.ts +0 -86
  19. package/buddy/src/commands/domains.ts +0 -255
  20. package/buddy/src/commands/fresh.ts +0 -48
  21. package/buddy/src/commands/generate.ts +0 -202
  22. package/buddy/src/commands/http.ts +0 -57
  23. package/buddy/src/commands/index.ts +0 -33
  24. package/buddy/src/commands/install.ts +0 -30
  25. package/buddy/src/commands/key.ts +0 -36
  26. package/buddy/src/commands/lint.ts +0 -54
  27. package/buddy/src/commands/list.ts +0 -42
  28. package/buddy/src/commands/make.ts +0 -352
  29. package/buddy/src/commands/migrate.ts +0 -105
  30. package/buddy/src/commands/outdated.ts +0 -31
  31. package/buddy/src/commands/ports.ts +0 -188
  32. package/buddy/src/commands/prepublish.ts +0 -28
  33. package/buddy/src/commands/projects.ts +0 -54
  34. package/buddy/src/commands/release.ts +0 -47
  35. package/buddy/src/commands/route.ts +0 -39
  36. package/buddy/src/commands/seed.ts +0 -47
  37. package/buddy/src/commands/setup.ts +0 -145
  38. package/buddy/src/commands/test.ts +0 -214
  39. package/buddy/src/commands/tinker.ts +0 -42
  40. package/buddy/src/commands/types.ts +0 -35
  41. package/buddy/src/commands/upgrade.ts +0 -200
  42. package/buddy/src/commands/version.ts +0 -29
  43. package/buddy/src/custom-cli.ts +0 -35
  44. package/buddy/src/index.ts +0 -1
  45. package/buddy/tsconfig.json +0 -3
@@ -1,292 +0,0 @@
1
- import type { CLI, DevOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import {
4
- runAction,
5
- runApiDevServer,
6
- runComponentsDevServer,
7
- runDashboardDevServer,
8
- runDesktopDevServer,
9
- runDocsDevServer,
10
- runFrontendDevServer,
11
- runSystemTrayDevServer,
12
- } from '@stacksjs/actions'
13
- import { intro, log, outro, prompts, runCommand } from '@stacksjs/cli'
14
- import { Action } from '@stacksjs/enums'
15
- import { libsPath } from '@stacksjs/path'
16
- import { ExitCode } from '@stacksjs/types'
17
-
18
- export function dev(buddy: CLI): void {
19
- const descriptions = {
20
- dev: 'Start development server',
21
- frontend: 'Start the frontend development server',
22
- components: 'Start the Components development server',
23
- desktop: 'Start the Desktop App development server',
24
- dashboard: 'Start the Dashboard development server',
25
- api: 'Start the local API development server',
26
- email: 'Start the Email development server',
27
- docs: 'Start the Documentation development server',
28
- systemTray: 'Start the System Tray development server',
29
- interactive: 'Get asked which development server to start',
30
- select: 'Which development server are you trying to start?',
31
- withLocalhost: 'Include the localhost URL in the output',
32
- project: 'Target a specific project',
33
- verbose: 'Enable verbose output',
34
- }
35
-
36
- buddy
37
- .command('dev [server]', descriptions.dev) // server is optional because options can be used
38
- .option('-f, --frontend', descriptions.frontend)
39
- .option('-a, --api', descriptions.api)
40
- .option('-e, --email', descriptions.email)
41
- .option('-c, --components', descriptions.components)
42
- .option('-d, --dashboard', descriptions.dashboard)
43
- .option('-t, --desktop', descriptions.desktop)
44
- .option('-d, --docs', descriptions.docs)
45
- .option('-t, --system-tray', descriptions.systemTray)
46
- .option('-i, --interactive', descriptions.interactive, { default: false })
47
- .option('-l, --with-localhost', descriptions.withLocalhost, {
48
- default: false,
49
- })
50
- .option('-p, --project [project]', descriptions.project, { default: false })
51
- .option('--verbose', descriptions.verbose, { default: false })
52
- .action(async (server: string | undefined, options: DevOptions) => {
53
- log.debug('Running `buddy dev [server]` ...', options)
54
-
55
- const perf = await intro('buddy dev')
56
-
57
- // log.info('Ensuring web server/s running...')
58
-
59
- // // check if port 443 is open
60
- // const result = await runCommand('lsof -i :443', { silent: true })
61
-
62
- // if (result.isErr())
63
- // log.warn('While checking if port 443 is open, we noticed it may be in use')
64
-
65
- switch (server) {
66
- case 'frontend':
67
- await runFrontendDevServer(options)
68
- break
69
- case 'api':
70
- await runApiDevServer(options)
71
- break
72
- case 'components':
73
- await runComponentsDevServer(options)
74
- break
75
- case 'dashboard':
76
- await runDashboardDevServer(options)
77
- break
78
- case 'desktop':
79
- await runDesktopDevServer(options)
80
- break
81
- case 'system-tray':
82
- await runSystemTrayDevServer(options)
83
- break
84
- // case 'email':
85
- // await runEmailDevServer(options)
86
- // break
87
- case 'docs':
88
- await runDocsDevServer(options)
89
- break
90
- default:
91
- }
92
-
93
- if (wantsInteractive(options)) {
94
- const answer = await prompts({
95
- type: 'select',
96
- name: 'value',
97
- message: descriptions.select,
98
- choices: [
99
- { value: 'all', title: 'All' },
100
- { value: 'frontend', title: 'Frontend' },
101
- { value: 'api', title: 'Backend' },
102
- { value: 'dashboard', title: 'Dashboard' },
103
- { value: 'desktop', title: 'Desktop' },
104
- { value: 'email', title: 'Email' },
105
- { value: 'components', title: 'Components' },
106
- { value: 'docs', title: 'Documentation' },
107
- ],
108
- })
109
-
110
- const selectedValue: string = answer.value
111
-
112
- if (selectedValue === 'components') {
113
- await runComponentsDevServer(options)
114
- }
115
- else if (selectedValue === 'api') {
116
- await runApiDevServer(options)
117
- }
118
- else if (selectedValue === 'dashboard') {
119
- await runDashboardDevServer(options)
120
- }
121
- // else if (selectedValue === 'email')
122
- // await runEmailDevServer(options)
123
- else if (selectedValue === 'docs') {
124
- await runDocsDevServer(options)
125
- }
126
- else {
127
- log.error('Invalid option during interactive mode')
128
- process.exit(ExitCode.InvalidArgument)
129
- }
130
- }
131
- else {
132
- if (options.components)
133
- await runComponentsDevServer(options)
134
- if (options.docs)
135
- await runDocsDevServer(options)
136
- else if (options.api)
137
- await runApiDevServer(options)
138
- // else if (options.email)
139
- // await runEmailDevServer(options)
140
- }
141
-
142
- await startDevelopmentServer(options)
143
-
144
- outro('Exited', { startTime: perf, useSeconds: true })
145
- process.exit(ExitCode.Success)
146
- })
147
-
148
- buddy
149
- .command('dev:components', descriptions.components)
150
- .option('-p, --project [project]', descriptions.project, { default: false })
151
- .option('--verbose', descriptions.verbose, { default: false })
152
- .action(async (options: DevOptions) => {
153
- log.debug('Running `buddy dev:components` ...', options)
154
-
155
- const perf = await intro('buddy dev:components')
156
- const result = await runCommand('bun run dev', {
157
- cwd: libsPath('components/vue'),
158
- // silent: !options.verbose,
159
- })
160
-
161
- if (options.verbose)
162
- log.info('buddy dev:components result', result)
163
-
164
- if (result.isErr()) {
165
- await outro(
166
- 'While running the dev:components command, there was an issue',
167
- { startTime: perf, useSeconds: true },
168
- result.error,
169
- )
170
- process.exit()
171
- }
172
-
173
- console.log('')
174
- await outro('Exited', { startTime: perf, useSeconds: true })
175
- process.exit(ExitCode.Success)
176
- })
177
-
178
- buddy
179
- .command('dev:docs', descriptions.docs)
180
- .option('-p, --project [project]', descriptions.project, { default: false })
181
- .option('--verbose', descriptions.verbose, { default: false })
182
- .action(async (options: DevOptions) => {
183
- log.debug('Running `buddy dev:docs` ...', options)
184
-
185
- const perf = await intro('buddy dev:docs')
186
- const result = await runAction(Action.DevDocs, options)
187
-
188
- if (result.isErr()) {
189
- await outro(
190
- 'While running the dev:docs command, there was an issue',
191
- { startTime: perf, useSeconds: true },
192
- result.error,
193
- )
194
- process.exit()
195
- }
196
-
197
- console.log('')
198
- await outro('Exited', { startTime: perf, useSeconds: true })
199
- process.exit(ExitCode.Success)
200
- })
201
-
202
- buddy
203
- .command('dev:desktop', descriptions.desktop)
204
- .option('-p, --project [project]', descriptions.project, { default: false })
205
- .option('--verbose', descriptions.verbose, { default: false })
206
- .action(async (options: DevOptions) => {
207
- log.debug('Running `buddy dev:desktop` ...', options)
208
-
209
- const perf = await intro('buddy dev:desktop')
210
- const result = await runAction(Action.DevDesktop, options)
211
-
212
- if (result.isErr()) {
213
- await outro(
214
- 'While running the dev:desktop command, there was an issue',
215
- { startTime: perf, useSeconds: true },
216
- result.error,
217
- )
218
- process.exit()
219
- }
220
-
221
- console.log('')
222
- await outro('Exited', { startTime: perf, useSeconds: true })
223
- process.exit(ExitCode.Success)
224
- })
225
-
226
- buddy
227
- .command('dev:api', descriptions.api)
228
- .option('-p, --project [project]', descriptions.project, { default: false })
229
- .option('--verbose', descriptions.verbose, { default: false })
230
- .action(async (options: DevOptions) => {
231
- log.debug('Running `buddy dev:api` ...', options)
232
-
233
- await runApiDevServer(options)
234
- })
235
-
236
- // buddy
237
- // .command('dev:functions', descriptions.api)
238
- // .option('-p, --project [project]', descriptions.project, { default: false })//
239
- // .option('--verbose', descriptions.verbose, { default: false })
240
- // .action(async (options: DevOptions) => {
241
- // await runFunctionsDevServer(options)
242
- // })
243
-
244
- buddy
245
- .command('dev:frontend', descriptions.frontend)
246
- .alias('dev:pages')
247
- .alias('dev:views')
248
- .option('-p, --project [project]', descriptions.project, { default: false })
249
- .option('--verbose', descriptions.verbose, { default: false })
250
- .action(async (options: DevOptions) => {
251
- log.debug('Running `buddy dev:frontend` ...', options)
252
- await runFrontendDevServer(options)
253
- })
254
-
255
- buddy
256
- .command('dev:dashboard', descriptions.dashboard)
257
- .alias('dev:admin')
258
- .option('-p, --project [project]', descriptions.project, { default: false })
259
- .option('--verbose', descriptions.verbose, { default: false })
260
- .action(async (options: DevOptions) => {
261
- log.debug('Running `buddy dev:dashboard` ...', options)
262
- await runDashboardDevServer(options)
263
- })
264
-
265
- buddy
266
- .command('dev:system-tray', descriptions.systemTray)
267
- .alias('dev:tray')
268
- .option('-p, --project [project]', descriptions.project, { default: false })
269
- .option('--verbose', descriptions.verbose, { default: false })
270
- .action(async (options: DevOptions) => {
271
- log.debug('Running `buddy dev:system-tray` ...', options)
272
- await runSystemTrayDevServer(options)
273
- })
274
-
275
- buddy.on('dev:*', () => {
276
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
277
- process.exit(1)
278
- })
279
- }
280
-
281
- export async function startDevelopmentServer(options: DevOptions): Promise<void> {
282
- const result = await runAction(Action.Dev, options)
283
-
284
- if (result.isErr()) {
285
- log.error('While running the dev command, there was an issue', result.error)
286
- process.exit(ExitCode.InvalidArgument)
287
- }
288
- }
289
-
290
- function wantsInteractive(options: DevOptions) {
291
- return options.interactive
292
- }
@@ -1,86 +0,0 @@
1
- import type { CLI } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { log, runCommand } from '@stacksjs/cli'
4
- import { config } from '@stacksjs/config'
5
- import { ExitCode } from '@stacksjs/types'
6
-
7
- // import { Action } from '@stacksjs/enums'
8
- // import { runAction } from '@stacksjs/actions'
9
-
10
- interface DnsOptions {
11
- query?: string
12
- type?: string
13
- nameserver?: string
14
- class?: string
15
- udp?: boolean
16
- tcp?: boolean
17
- tls?: boolean
18
- https?: boolean
19
- short?: boolean
20
- json?: boolean
21
- pretty?: boolean
22
- p?: boolean // short for pretty
23
- verbose?: boolean
24
- }
25
-
26
- export function dns(buddy: CLI): void {
27
- const descriptions = {
28
- dns: 'Lists the DNS records for a domain',
29
- query: 'Host name or IP address to query',
30
- type: 'Type of the DNS record being queried (A, MX, NS…)',
31
- nameserver: 'Address of the nameserver to send packets to',
32
- class: 'Network class of the DNS record being queried (IN, CH, HS)',
33
- udp: 'Use the DNS protocol over UDP',
34
- tcp: 'Use the DNS protocol over TCP',
35
- tls: 'Use the DNS-over-TLS protocol',
36
- https: 'Use the DNS-over-HTTPS protocol',
37
- short: 'Short mode: display nothing but the first result',
38
- json: 'Display the output as JSON',
39
- pretty: 'Display the output as JSON in a pretty format',
40
- project: 'Target a specific project',
41
- verbose: 'Enable verbose output',
42
- }
43
-
44
- buddy
45
- .command('dns [domain]', descriptions.dns)
46
- .option('-q, --query <query>', descriptions.query)
47
- .option('-t, --type <type>', descriptions.type, { default: 'ANY' })
48
- .option('-n, --nameserver <nameserver>', descriptions.nameserver)
49
- .option('--class <class>', descriptions.nameserver)
50
- // transport options
51
- .option('-U, --udp', descriptions.udp)
52
- .option('-T, --tcp', descriptions.tcp)
53
- .option('-S, --tls', descriptions.tls)
54
- .option('-H, --https', descriptions.https)
55
- // output options
56
- .option('-1, --short', descriptions.short, { default: false })
57
- .option('-J, --json', descriptions.json, { default: false })
58
- .option('-p, --pretty', descriptions.pretty, { default: true })
59
- .option('-p, --project [project]', descriptions.project, { default: false })
60
- .option('--verbose', descriptions.verbose, { default: false })
61
- .action(async (domain: string | undefined, options: DnsOptions) => {
62
- log.debug('Running `buddy dns [domain]` ...', options)
63
- // let prettyOutput = false
64
-
65
- // if (options.json && options.pretty)
66
- // prettyOutput = true
67
-
68
- options.pretty = undefined
69
- options.p = undefined
70
-
71
- // Convert options object to command-line options string
72
- const optionsString = Object.entries(options)
73
- .filter(([key, value]) => key !== '--' && key.length > 1 && value !== false) // filter out '--' key and short options
74
- .map(([key, value]) => `--${key} ${value}`)
75
- .join(' ')
76
-
77
- await runCommand(`dog ${domain || config.app.url} ${optionsString}`)
78
-
79
- process.exit(ExitCode.Success)
80
- })
81
-
82
- buddy.on('dns:*', () => {
83
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
84
- process.exit(1)
85
- })
86
- }
@@ -1,255 +0,0 @@
1
- import type { CLI, DomainsOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { bgCyan, bold, intro, italic, log, outro, prompts } from '@stacksjs/cli'
5
- import { config } from '@stacksjs/config'
6
- import { addDomain } from '@stacksjs/dns'
7
- import { Action } from '@stacksjs/enums'
8
- import { ExitCode } from '@stacksjs/types'
9
-
10
- export function domains(buddy: CLI): void {
11
- const descriptions = {
12
- purchase: 'Purchase a domain',
13
- add: 'Add a domain to your cloud', // given you already own it with a different registrar
14
- remove: 'Remove a domain from your cloud',
15
- skip: 'Skip the confirmation prompt',
16
- project: 'Target a specific project',
17
- verbose: 'Enable verbose output',
18
- }
19
-
20
- const c = config.dns.contactInfo
21
-
22
- buddy
23
- .command('domains:purchase <domain>', descriptions.purchase)
24
- .option('--years <years>', 'Number of years to purchase the domain for', {
25
- default: 1,
26
- })
27
- .option('--privacy', 'Enable privacy protection', { default: true })
28
- .option('--auto-renew', 'Enable auto-renew', { default: true })
29
- .option('--first-name <firstName>', 'Registrant first name', {
30
- default: c?.firstName,
31
- })
32
- .option('--last-name <lastName>', 'Registrant last name', {
33
- default: c?.lastName,
34
- })
35
- .option('--organization <organization>', 'Registrant organization name', {
36
- default: c?.organizationName,
37
- })
38
- .option('--address-line1 <address>', 'Registrant address line 1', {
39
- default: c?.addressLine1,
40
- })
41
- .option('--address-line2 <address>', 'Registrant address line 2', {
42
- default: c?.addressLine2,
43
- })
44
- .option('--city <city>', 'Registrant city', { default: c?.city })
45
- .option('--state <state>', 'Registrant state', { default: c?.state })
46
- .option('--country <country>', 'Registrant country code', {
47
- default: c?.countryCode,
48
- })
49
- .option('--zip <zip>', 'Registrant zip', { default: c?.zip })
50
- .option('--phone <phone>', 'Registrant phone', { default: c?.phoneNumber })
51
- .option('--email <email>', 'Registrant email', { default: c?.email })
52
- .option('--admin-first-name <firstName>', 'Admin first name', {
53
- default: c?.admin?.firstName || c?.firstName,
54
- })
55
- .option('--admin-last-name <lastName>', 'Admin last name', {
56
- default: c?.admin?.lastName || c?.lastName,
57
- })
58
- .option('--admin-organization <organization>', 'Admin organization', {
59
- default: c?.admin?.organizationName || c?.organizationName,
60
- })
61
- .option('--admin-address-line1 <address>', 'Admin address line 1', {
62
- default: c?.admin?.addressLine1 || c?.addressLine1,
63
- })
64
- .option('--admin-address-line2 <address>', 'Admin address line 2', {
65
- default: c?.admin?.addressLine2 || c?.addressLine2,
66
- })
67
- .option('--admin-city <city>', 'Admin city', {
68
- default: c?.admin?.city || c?.city,
69
- })
70
- .option('--admin-state <state>', 'Admin state', {
71
- default: c?.admin?.state || c?.state,
72
- })
73
- .option('--admin-country <country>', 'Admin country code', {
74
- default: c?.admin?.countryCode || c?.countryCode,
75
- })
76
- .option('--admin-zip <zip>', 'Admin zip', {
77
- default: c?.admin?.zip || c?.zip,
78
- })
79
- .option('--admin-phone <phone>', 'Admin phone number', {
80
- default: c?.admin?.phoneNumber || c?.phoneNumber,
81
- })
82
- .option('--admin-email <email>', 'Admin email', {
83
- default: c?.admin?.email || c?.email,
84
- })
85
- .option('--tech-first-name <firstName>', 'Tech first name', {
86
- default: c?.tech?.firstName || c?.firstName,
87
- })
88
- .option('--tech-last-name <lastName>', 'Tech last name', {
89
- default: c?.tech?.lastName || c?.lastName,
90
- })
91
- .option('--tech-organization <organization>', 'Tech organization name', {
92
- default: c?.tech?.organizationName || c?.organizationName,
93
- })
94
- .option('--tech-address-line1 <address>', 'Tech address line 1', {
95
- default: c?.tech?.addressLine1 || c?.addressLine1,
96
- })
97
- .option('--tech-address-line2 <address>', 'Tech address line 2', {
98
- default: c?.tech?.addressLine2 || c?.addressLine2,
99
- })
100
- .option('--tech-city <city>', 'Tech city', {
101
- default: c?.tech?.city || c?.city,
102
- })
103
- .option('--tech-state <state>', 'Tech state', {
104
- default: c?.tech?.state || c?.state,
105
- })
106
- .option('--tech-country <country>', 'Tech country', {
107
- default: c?.tech?.countryCode || c?.countryCode,
108
- })
109
- .option('--tech-zip <zip>', 'Tech zip', { default: c?.tech?.zip || c?.zip })
110
- .option('--tech-phone <phone>', 'Tech phone', {
111
- default: c?.tech?.phoneNumber || c?.phoneNumber,
112
- })
113
- .option('--tech-email <email>', 'Tech email', {
114
- default: c?.tech?.email || c?.email,
115
- })
116
- .option('--privacy-admin', 'Enable privacy protection for admin', {
117
- default: c?.privacyAdmin || c?.privacy || true,
118
- })
119
- .option('--privacy-tech', 'Enable privacy protection for tech', {
120
- default: c?.privacyTech || c?.privacy || true,
121
- })
122
- .option('--privacy-registrant', 'Enable privacy protection for registrant', {
123
- default: c?.privacyRegistrant || c?.privacy || true,
124
- })
125
- .option('--contact-type <type>', 'Contact type', { default: 'person' })
126
- .option('-p, --project [project]', descriptions.project, { default: false })
127
- .option('--verbose', descriptions.verbose, { default: false })
128
- .action(async (domain: string, options: DomainsOptions) => {
129
- log.debug('Running `buddy domains:purchase <domain>` ...', options)
130
-
131
- options.domain = domain
132
- const startTime = await intro('buddy domains:purchase')
133
- const result = await runAction(Action.DomainsPurchase, options)
134
-
135
- if (result.isErr()) {
136
- await outro(
137
- 'While running the domains:purchase command, there was an issue',
138
- { startTime, useSeconds: true },
139
- result.error,
140
- )
141
- process.exit(ExitCode.FatalError)
142
- }
143
-
144
- const { confirm } = await prompts({
145
- name: 'confirm',
146
- type: 'confirm',
147
- message: `Would you like to set ${domain} as your APP_URL?`,
148
- })
149
-
150
- if (!confirm) {
151
- await outro(`Alrighty! ${italic(domain)} was added to your account.`, {
152
- startTime,
153
- useSeconds: true,
154
- type: 'success',
155
- })
156
- log.info(
157
- `Please note, you may need to validate your email address. Check your ${italic(
158
- options.registrantEmail as string,
159
- )} inbox.`,
160
- )
161
- process.exit(ExitCode.Success)
162
- }
163
-
164
- // set .env APP_URL to domain
165
- const { writeEnv } = await import('@stacksjs/env')
166
- writeEnv('APP_URL', domain)
167
-
168
- let message = `Great! ${italic(domain)} was added to your account.`
169
- message += `\n\nAnd your APP_URL has been set to ${italic(domain)}.
170
- \nPlease note, this change has not been deployed yet.
171
- \nThe next time you run ${bgCyan(italic(bold(' buddy deploy ')))}, your app will deploy to ${italic(domain)}.
172
- \n${italic(
173
- 'You may need to deploy 2-3 times for the changes to take effect. Issue tracked here: https://github.com/stacksjs/stacks/issues/685',
174
- )}`
175
-
176
- await outro(message, { startTime, useSeconds: true, type: 'info' })
177
- process.exit(ExitCode.Success)
178
- })
179
-
180
- buddy
181
- .command('domains:add <domain>', descriptions.add)
182
- .option('--verbose', descriptions.verbose, { default: false })
183
- .action(async (options: DomainsOptions) => {
184
- log.debug('Running `buddy domains:add <domain>` ...', options)
185
-
186
- const startTime = await intro('buddy domains:add')
187
- const result = await addDomain({
188
- ...options,
189
- startTime,
190
- })
191
-
192
- if (result.isErr()) {
193
- await outro(
194
- 'While running the `buddy deploy`, there was an issue',
195
- { startTime, useSeconds: true },
196
- result.error,
197
- )
198
- process.exit(ExitCode.FatalError)
199
- }
200
-
201
- await outro('Added your domain.', { startTime, useSeconds: true })
202
- process.exit(ExitCode.Success)
203
- })
204
-
205
- buddy
206
- .command('domains:remove <domain>', descriptions.remove)
207
- .option('--yes', descriptions.skip, { default: false })
208
- .option('--verbose', descriptions.verbose, { default: false })
209
- .action(async (options: DomainsOptions) => {
210
- log.debug('Running `buddy domains:remove <domain>` ...', options)
211
-
212
- const domain = options.domain || config.app.url
213
- const opts = { ...options, domain }
214
- const startTime = await intro('buddy domains:remove')
215
-
216
- if (!opts.yes) {
217
- const { confirm } = await prompts({
218
- name: 'confirm',
219
- type: 'confirm',
220
- message: `Are you sure you want to remove ${domain}?`,
221
- })
222
-
223
- if (!confirm) {
224
- await outro('Cancelled the domains:remove command', {
225
- startTime,
226
- useSeconds: true,
227
- type: 'info',
228
- })
229
- process.exit(ExitCode.Success)
230
- }
231
- }
232
-
233
- const result = await runAction(Action.DomainsRemove, opts)
234
-
235
- if (result.isErr()) {
236
- await outro(
237
- 'While running the domains:remove command, there was an issue',
238
- { startTime, useSeconds: true },
239
- result.error,
240
- )
241
- process.exit(ExitCode.FatalError)
242
- }
243
-
244
- await outro('Removed your domain DNS records.', {
245
- startTime,
246
- useSeconds: true,
247
- })
248
- process.exit(ExitCode.Success)
249
- })
250
-
251
- buddy.on('domains:*', () => {
252
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
253
- process.exit(1)
254
- })
255
- }
@@ -1,48 +0,0 @@
1
- import type { CLI, FreshOptions } 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 fresh(buddy: CLI): void {
9
- const descriptions = {
10
- fresh: 'Re-installs your npm dependencies',
11
- project: 'Target a specific project',
12
- verbose: 'Enable verbose output',
13
- }
14
-
15
- buddy
16
- .command('fresh', descriptions.fresh)
17
- .option('-p, --project [project]', descriptions.project, { default: false })
18
- .option('--verbose', descriptions.verbose, { default: false })
19
- .action(async (options: FreshOptions) => {
20
- log.debug('Running `buddy fresh` ...', options)
21
-
22
- const perf = await intro('buddy fresh')
23
- const result = await runAction(Action.Fresh, {
24
- ...options,
25
- stdout: 'inherit',
26
- })
27
-
28
- if (result.isErr()) {
29
- await outro(
30
- 'While running `buddy fresh`, there was an issue',
31
- { startTime: perf, useSeconds: true },
32
- result.error,
33
- )
34
- process.exit(ExitCode.FatalError)
35
- }
36
-
37
- await outro('Freshly reinstalled your dependencies', {
38
- startTime: perf,
39
- useSeconds: true,
40
- })
41
- process.exit(ExitCode.Success)
42
- })
43
-
44
- buddy.on('fresh:*', () => {
45
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
46
- process.exit(1)
47
- })
48
- }