@stacksjs/buddy 0.65.0 → 0.67.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 (106) hide show
  1. package/dist/{chunk-agapayce.js → chunk-3whxjf1k.js} +1 -4
  2. package/dist/chunk-42swmjjw.js +2 -0
  3. package/dist/chunk-564c63vr.js +2 -0
  4. package/dist/chunk-5wxk7vka.js +1 -0
  5. package/dist/chunk-6cscdnf5.js +2 -0
  6. package/dist/chunk-898dh3kh.js +8 -0
  7. package/dist/chunk-9g2p5d3j.js +2 -0
  8. package/dist/chunk-bpa4071y.js +2 -0
  9. package/dist/chunk-cbtnhpqk.js +2 -0
  10. package/dist/chunk-f18wwa85.js +827 -0
  11. package/dist/chunk-g767h9jq.js +3 -0
  12. package/dist/chunk-hgzxtrgw.js +9 -0
  13. package/dist/chunk-hqv9y9k2.js +6 -0
  14. package/dist/chunk-jfs19hhz.js +2 -0
  15. package/dist/chunk-ncwfzcsm.js +2 -0
  16. package/dist/chunk-pfb4369d.js +2 -0
  17. package/dist/chunk-sgm5999j.js +12 -0
  18. package/dist/chunk-we57sm1m.js +2 -0
  19. package/dist/chunk-wps8bq6b.js +2 -0
  20. package/dist/chunk-y2g00ayp.js +2 -0
  21. package/dist/chunk-ycyg22fp.js +2 -0
  22. package/dist/cli.js +1 -4
  23. package/dist/index.js +1 -4
  24. package/dist/stacks +0 -0
  25. package/package.json +48 -49
  26. package/dist/chunk-1bcxd9nx.js +0 -5
  27. package/dist/chunk-1bcxd9nx.js.map +0 -17
  28. package/dist/chunk-3gvx3tap.js +0 -5
  29. package/dist/chunk-3gvx3tap.js.map +0 -9
  30. package/dist/chunk-5mkzknp4.js +0 -5
  31. package/dist/chunk-5mkzknp4.js.map +0 -32
  32. package/dist/chunk-a3d48jzd.js +0 -15
  33. package/dist/chunk-a3d48jzd.js.map +0 -164
  34. package/dist/chunk-a6ba4vgs.js +0 -5
  35. package/dist/chunk-a6ba4vgs.js.map +0 -11
  36. package/dist/chunk-agapayce.js.map +0 -15
  37. package/dist/chunk-b9d377d9.js +0 -5
  38. package/dist/chunk-b9d377d9.js.map +0 -26
  39. package/dist/chunk-bh61bx6h.js +0 -4
  40. package/dist/chunk-bh61bx6h.js.map +0 -23
  41. package/dist/chunk-fqrjh7j8.js +0 -5
  42. package/dist/chunk-fqrjh7j8.js.map +0 -10
  43. package/dist/chunk-jkt9jxar.js +0 -9
  44. package/dist/chunk-jkt9jxar.js.map +0 -13
  45. package/dist/chunk-k1q2z202.js +0 -4
  46. package/dist/chunk-k1q2z202.js.map +0 -16
  47. package/dist/chunk-mmjggjd5.js +0 -849
  48. package/dist/chunk-mmjggjd5.js.map +0 -240
  49. package/dist/chunk-mxwvrbdh.js +0 -6
  50. package/dist/chunk-mxwvrbdh.js.map +0 -59
  51. package/dist/chunk-n55kahn5.js +0 -5
  52. package/dist/chunk-n55kahn5.js.map +0 -12
  53. package/dist/chunk-pbpgcz3v.js +0 -5
  54. package/dist/chunk-pbpgcz3v.js.map +0 -46
  55. package/dist/chunk-sadghty0.js +0 -5
  56. package/dist/chunk-sadghty0.js.map +0 -20
  57. package/dist/chunk-smzpmhmp.js +0 -11
  58. package/dist/chunk-smzpmhmp.js.map +0 -10
  59. package/dist/chunk-w4zypt02.js +0 -5
  60. package/dist/chunk-w4zypt02.js.map +0 -23
  61. package/dist/chunk-ywfsnx7v.js +0 -5
  62. package/dist/chunk-ywfsnx7v.js.map +0 -22
  63. package/dist/chunk-yxs8vtg9.js +0 -5
  64. package/dist/chunk-yxs8vtg9.js.map +0 -10
  65. package/dist/chunk-z7609s4h.js +0 -12
  66. package/dist/chunk-z7609s4h.js.map +0 -11
  67. package/dist/cli.js.map +0 -10
  68. package/dist/index.js.map +0 -9
  69. package/src/cli.ts +0 -105
  70. package/src/commands/add.ts +0 -71
  71. package/src/commands/build.ts +0 -299
  72. package/src/commands/changelog.ts +0 -52
  73. package/src/commands/clean.ts +0 -46
  74. package/src/commands/cloud.ts +0 -553
  75. package/src/commands/commit.ts +0 -26
  76. package/src/commands/configure.ts +0 -84
  77. package/src/commands/create.ts +0 -143
  78. package/src/commands/deploy.ts +0 -194
  79. package/src/commands/dev.ts +0 -292
  80. package/src/commands/dns.ts +0 -86
  81. package/src/commands/domains.ts +0 -255
  82. package/src/commands/fresh.ts +0 -48
  83. package/src/commands/generate.ts +0 -202
  84. package/src/commands/http.ts +0 -57
  85. package/src/commands/index.ts +0 -33
  86. package/src/commands/install.ts +0 -30
  87. package/src/commands/key.ts +0 -36
  88. package/src/commands/lint.ts +0 -54
  89. package/src/commands/list.ts +0 -42
  90. package/src/commands/make.ts +0 -352
  91. package/src/commands/migrate.ts +0 -105
  92. package/src/commands/outdated.ts +0 -31
  93. package/src/commands/ports.ts +0 -188
  94. package/src/commands/prepublish.ts +0 -28
  95. package/src/commands/projects.ts +0 -54
  96. package/src/commands/release.ts +0 -50
  97. package/src/commands/route.ts +0 -39
  98. package/src/commands/seed.ts +0 -47
  99. package/src/commands/setup.ts +0 -145
  100. package/src/commands/test.ts +0 -214
  101. package/src/commands/tinker.ts +0 -42
  102. package/src/commands/types.ts +0 -35
  103. package/src/commands/upgrade.ts +0 -200
  104. package/src/commands/version.ts +0 -29
  105. package/src/custom-cli.ts +0 -35
  106. package/src/index.ts +0 -1
@@ -1,143 +0,0 @@
1
- import type { CLI, CreateOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { bold, cyan, dim, intro, log, runCommand } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
- import { resolve } from '@stacksjs/path'
7
- import { isFolder } from '@stacksjs/storage'
8
- import { ExitCode } from '@stacksjs/types'
9
- import { useOnline } from '@stacksjs/utils'
10
-
11
- export function create(buddy: CLI): void {
12
- const descriptions = {
13
- name: 'The name of the project',
14
- command: 'Create a new Stacks project',
15
- ui: 'Are you building a UI?',
16
- components: 'Are you building UI components?',
17
- webComponents: 'Automagically built optimized custom elements/web components?',
18
- vue: 'Automagically built a Vue component library?',
19
- views: 'How about views?',
20
- functions: 'Are you developing functions/composables?',
21
- api: 'Are you building an API?',
22
- database: 'Do you need a database?',
23
- notifications: 'Do you need notifications? e.g. email, SMS, push or chat notifications',
24
- cache: 'Do you need caching?',
25
- email: 'Do you need email?',
26
- project: 'Target a specific project',
27
- verbose: 'Enable verbose output',
28
- }
29
-
30
- buddy
31
- .command('new [name]', descriptions.command)
32
- .alias('create [name]')
33
- .option('-n, --name [name]', descriptions.name, { default: false })
34
- .option('-u, --ui', descriptions.ui, { default: true }) // if no, disregard remainder of questions wrt UI
35
- .option('-c, --components', descriptions.components, { default: true }) // if no, -v and -w would be false
36
- .option('-w, --web-components', descriptions.webComponents, { default: true })
37
- .option('-v, --vue', descriptions.vue, { default: true })
38
- .option('-p, --views', descriptions.views, { default: true }) // i.e. `buddy dev`
39
- .option('-f, --functions', descriptions.functions, { default: true }) // if no, API would be false
40
- .option('-a, --api', descriptions.api, { default: true }) // APIs need an HTTP server & assumes functions is true
41
- .option('-d, --database', descriptions.database, { default: true })
42
- .option('-ca, --cache', descriptions.cache, { default: false })
43
- .option('-e, --email', descriptions.email, { default: false })
44
- .option('-p, --project [project]', descriptions.project, { default: false })
45
- .option('--verbose', descriptions.verbose, { default: false })
46
- // .option('--auth', 'Scaffold an authentication?', { default: true })
47
- .action(async (name, options: CreateOptions) => {
48
- log.debug('Running `buddy new <name>` ...', options)
49
-
50
- const startTime = await intro('stacks new')
51
-
52
- name = name ?? options.name
53
- const path = resolve(process.cwd(), name)
54
-
55
- isFolderCheck(path)
56
- onlineCheck()
57
-
58
- const result = await download(name, path, options)
59
-
60
- if (result.isErr()) {
61
- log.error(result.error)
62
- process.exit(ExitCode.FatalError)
63
- }
64
-
65
- await ensureEnv(path, options)
66
- await install(path, options)
67
-
68
- if (startTime) {
69
- const time = performance.now() - startTime
70
- log.success(dim(`[${time.toFixed(2)}ms] Completed`))
71
- }
72
-
73
- log.info(bold('Welcome to the Stacks Framework! ⚛️'))
74
- log.info('To learn more, visit https://stacksjs.org')
75
-
76
- process.exit(ExitCode.Success)
77
- })
78
-
79
- buddy.on('new:*', () => {
80
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
81
- process.exit(1)
82
- })
83
- }
84
-
85
- function isFolderCheck(path: string) {
86
- if (isFolder(path)) {
87
- log.error(`Path ${path} already exists`)
88
- process.exit(ExitCode.FatalError)
89
- }
90
- }
91
-
92
- function onlineCheck() {
93
- const online = useOnline()
94
- if (!online) {
95
- log.info('It appears you are disconnected from the internet.')
96
- log.info('The Stacks setup requires a brief internet connection for setup.')
97
- log.info('For instance, it installs your dependencies from.')
98
- process.exit(ExitCode.FatalError)
99
- }
100
- }
101
-
102
- async function download(name: string, path: string, options: CreateOptions) {
103
- log.info('Setting up your stack.')
104
- const result = await runCommand(`bunx --bun giget stacks ${name}`, options)
105
- log.success(`Successfully scaffolded your project at ${cyan(path)}`)
106
-
107
- return result
108
- }
109
-
110
- async function ensureEnv(path: string, options: CreateOptions) {
111
- log.info('Ensuring your environment is ready...')
112
- await runCommand('pkgx --update ', { ...options, cwd: path })
113
- log.success('Environment is ready')
114
- }
115
-
116
- async function install(path: string, options: CreateOptions) {
117
- log.info('Installing & setting up Stacks')
118
- let result = await runCommand('bun install', { ...options, cwd: path })
119
-
120
- if (result?.isErr()) {
121
- log.error(result.error)
122
- process.exit()
123
- }
124
-
125
- result = await runCommand('cp .env.example .env', { ...options, cwd: path })
126
-
127
- if (result?.isErr()) {
128
- log.error(result.error)
129
- process.exit(ExitCode.FatalError)
130
- }
131
-
132
- await runAction(Action.KeyGenerate, { ...options, cwd: path })
133
-
134
- // TODO: we should ask quite a few questions here, similar how we do in `buddy new my-project`, so we can generate a custom pkgx.yaml file
135
-
136
- result = await runCommand('git init', { ...options, cwd: path }) // do we need this? or does giget do this already?
137
- if (result.isErr()) {
138
- log.error(result.error)
139
- process.exit(ExitCode.FatalError)
140
- }
141
-
142
- log.success('Installed & set-up 🚀')
143
- }
@@ -1,194 +0,0 @@
1
- import type { CLI, DeployOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { intro, italic, log, outro, prompts, runCommand } from '@stacksjs/cli'
5
- import { app } from '@stacksjs/config'
6
- import { addDomain, hasUserDomainBeenAddedToCloud } from '@stacksjs/dns'
7
- import { Action } from '@stacksjs/enums'
8
- import { path as p } from '@stacksjs/path'
9
- import { ExitCode } from '@stacksjs/types'
10
- import { $ } from 'bun'
11
-
12
- export function deploy(buddy: CLI): void {
13
- const descriptions = {
14
- deploy: 'Deploy your project',
15
- project: 'Target a specific project',
16
- production: 'Deploy to production',
17
- development: 'Deploy to development',
18
- staging: 'Deploy to staging',
19
- yes: 'Confirm all prompts by default',
20
- domain: 'Specify a domain to deploy to',
21
- verbose: 'Enable verbose output',
22
- }
23
-
24
- buddy
25
- .command('deploy [env]', descriptions.deploy)
26
- .option('--domain', descriptions.domain, { default: undefined })
27
- .option('-p, --project [project]', descriptions.project, { default: false })
28
- .option('--prod', descriptions.production, { default: true })
29
- .option('--dev', descriptions.development, { default: false })
30
- .option('--yes', descriptions.yes, { default: false })
31
- .option('--staging', descriptions.staging, { default: false })
32
- .option('--verbose', descriptions.verbose, { default: false })
33
- .action(async (env: string | undefined, options: DeployOptions) => {
34
- log.debug('Running `buddy deploy` ...', options)
35
-
36
- const startTime = await intro('buddy deploy')
37
- const domain = options.domain || app.url
38
-
39
- if ((options.prod || env === 'production' || env === 'prod') && !options.yes)
40
- await confirmProductionDeployment()
41
-
42
- if (!domain) {
43
- log.info('No domain found in your .env or ./config/app.ts')
44
- log.info('Please ensure your domain is properly configured.')
45
- log.info('For more info, check out the docs or join our Discord.')
46
- process.exit(ExitCode.FatalError)
47
- }
48
-
49
- log.info(`Deploying to ${italic(domain)}`)
50
-
51
- await checkIfAwsIsConfigured()
52
- await checkIfAwsIsBootstrapped()
53
-
54
- options.domain = await configureDomain(domain, options, startTime)
55
-
56
- const result = await runAction(Action.Deploy, options)
57
-
58
- if (result.isErr()) {
59
- await outro(
60
- 'While running the `buddy deploy`, there was an issue',
61
- { startTime, useSeconds: true },
62
- result.error,
63
- )
64
- process.exit(ExitCode.FatalError)
65
- }
66
-
67
- await outro('Project deployed.', { startTime, useSeconds: true })
68
- })
69
-
70
- buddy.on('deploy:*', () => {
71
- log.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
72
- process.exit(1)
73
- })
74
- }
75
-
76
- async function confirmProductionDeployment() {
77
- const { confirmed } = await prompts({
78
- type: 'confirm',
79
- name: 'confirmed',
80
- message: 'Are you sure you want to deploy to production?',
81
- })
82
-
83
- if (!confirmed) {
84
- log.info('Aborting deployment...')
85
- process.exit(ExitCode.InvalidArgument)
86
- }
87
- }
88
-
89
- async function configureDomain(domain: string, options: DeployOptions, startTime: number) {
90
- log.debug('Configuring domain...', domain)
91
- if (!domain) {
92
- log.info('We could not identify a domain to deploy to.')
93
- log.warn('Please set your .env or ./config/app.ts properly.')
94
- log.info('Alternatively, specify a domain to deploy via the `--domain` flag.')
95
- console.log('')
96
- log.info(' ➡️ Example: `buddy deploy --domain example.com`')
97
- console.log('')
98
- process.exit(ExitCode.FatalError)
99
- }
100
-
101
- // TODO: we can improve this check at some point, otherwise domains that legitimately include the word localhost will fail
102
- // TODO: add check for whether the local APP_ENV is getting deployed, if so, ask if the user meant to deploy `dev`
103
- if (domain.includes('localhost')) {
104
- log.info('You are deploying to a local environment.')
105
- log.warn(
106
- 'Please set your .env or ./config/app.ts properly. The domain we are deploying cannot be a `localhost` domain.',
107
- )
108
- log.info('Alternatively, specify a domain to deploy via the `--domain` flag.')
109
- console.log('')
110
- log.info(' ➡️ Example: `buddy deploy --domain example.com`')
111
- console.log('')
112
- process.exit(ExitCode.FatalError)
113
- }
114
-
115
- if (await hasUserDomainBeenAddedToCloud(domain)) {
116
- log.info('Domain is properly configured')
117
- log.info('Your cloud is deploying...')
118
-
119
- log.info(`${italic('This may take a while...')}`)
120
-
121
- return domain
122
- }
123
-
124
- // if the domain hasn't been added to the user's (AWS) cloud, we will add it for them
125
- // and then exit the process with prompts for the user to update their nameservers
126
- console.log('')
127
- log.info(` 👋 It appears to be your first ${italic(domain)} deployment.`)
128
- console.log('')
129
- log.info(italic('Let’s ensure it is all connected properly.'))
130
- log.info(italic('One moment...'))
131
- console.log('')
132
-
133
- const result = await addDomain({
134
- ...options,
135
- deploy: true,
136
- startTime,
137
- })
138
-
139
- if (result.isErr()) {
140
- await outro('While running the `buddy deploy`, there was an issue', { startTime, useSeconds: true }, result.error)
141
- process.exit(ExitCode.FatalError)
142
- }
143
-
144
- await outro('Added your domain.', { startTime, useSeconds: true })
145
- process.exit(ExitCode.Success)
146
- }
147
-
148
- async function checkIfAwsIsConfigured() {
149
- log.info('Ensuring AWS is configured...')
150
- const result = await runCommand('buddy configure:aws', {
151
- silent: true,
152
- })
153
-
154
- if (result.isErr()) {
155
- log.error('AWS is not configured properly.', {
156
- shouldExit: false,
157
- })
158
- log.error('Please run `buddy configure:aws` to set up your AWS credentials.')
159
- }
160
-
161
- log.success('AWS is configured')
162
- }
163
-
164
- async function checkIfAwsIsBootstrapped() {
165
- try {
166
- log.info('Ensuring AWS is bootstrapped...')
167
- // const toolkitName = 'stacks-toolkit'
168
- await runCommand('aws cloudformation describe-stacks --stack-name stacks-toolkit', { silent: true })
169
- // await $`aws cloudformation describe-stacks --stack-name stacks-toolkit`.quiet()
170
- log.success('AWS is bootstrapped')
171
-
172
- return true
173
- }
174
- catch (err: any) {
175
- log.debug(`Not yet bootstrapped. Failed with code ${err.exitCode}`)
176
- log.debug(err.stdout.toString())
177
- log.debug(err.stderr.toString())
178
-
179
- log.info('AWS is not bootstrapped yet')
180
- log.info('Bootstrapping. This may take a few moments...')
181
-
182
- try {
183
- $.cwd(p.frameworkCloudPath())
184
- const result = await $`bun run bootstrap`
185
- console.log(result)
186
- return true
187
- }
188
- catch (error) {
189
- log.error('Failed to bootstrap AWS')
190
- console.error(error)
191
- process.exit(ExitCode.FatalError)
192
- }
193
- }
194
- }
@@ -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
- }