stacks 0.59.11 → 0.61.1

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 (40) hide show
  1. package/README.md +0 -1
  2. package/buddy/README.md +0 -1
  3. package/buddy/bin/cli.ts +9 -17
  4. package/buddy/build.ts +1 -12
  5. package/buddy/package.json +1 -1
  6. package/buddy/src/cli.ts +17 -13
  7. package/buddy/src/commands/add.ts +5 -6
  8. package/buddy/src/commands/build.ts +55 -34
  9. package/buddy/src/commands/changelog.ts +13 -6
  10. package/buddy/src/commands/clean.ts +13 -5
  11. package/buddy/src/commands/cloud.ts +91 -30
  12. package/buddy/src/commands/commit.ts +2 -2
  13. package/buddy/src/commands/configure.ts +7 -7
  14. package/buddy/src/commands/create.ts +14 -10
  15. package/buddy/src/commands/deploy.ts +15 -10
  16. package/buddy/src/commands/dev.ts +53 -53
  17. package/buddy/src/commands/dns.ts +5 -5
  18. package/buddy/src/commands/domains.ts +132 -41
  19. package/buddy/src/commands/fresh.ts +16 -6
  20. package/buddy/src/commands/generate.ts +14 -16
  21. package/buddy/src/commands/http.ts +2 -2
  22. package/buddy/src/commands/install.ts +2 -2
  23. package/buddy/src/commands/key.ts +3 -3
  24. package/buddy/src/commands/lint.ts +4 -4
  25. package/buddy/src/commands/list.ts +3 -4
  26. package/buddy/src/commands/make.ts +101 -65
  27. package/buddy/src/commands/migrate.ts +52 -9
  28. package/buddy/src/commands/ports.ts +35 -37
  29. package/buddy/src/commands/prepublish.ts +3 -3
  30. package/buddy/src/commands/projects.ts +5 -11
  31. package/buddy/src/commands/release.ts +8 -6
  32. package/buddy/src/commands/seed.ts +12 -5
  33. package/buddy/src/commands/setup.ts +10 -11
  34. package/buddy/src/commands/test.ts +97 -30
  35. package/buddy/src/commands/tinker.ts +10 -6
  36. package/buddy/src/commands/types.ts +3 -3
  37. package/buddy/src/commands/upgrade.ts +49 -29
  38. package/buddy/src/commands/version.ts +11 -13
  39. package/buddy/src/custom-cli.ts +5 -7
  40. package/package.json +7 -89
package/README.md CHANGED
@@ -153,7 +153,6 @@ buddy make:model Car # bootstraps a Car model
153
153
  buddy make:database cars # creates a cars database
154
154
  buddy make:migration create_cars_table # creates a cars migration file
155
155
  buddy make:factory cars # creates a Car factory file
156
- buddy make:seed cars # creates a Car seed file
157
156
  buddy make:table cars # bootstraps a cars data table
158
157
  buddy make:notification welcome-email # bootstraps a welcome-email notification
159
158
  buddy make:lang de # bootstraps a lang/de.yml language file
package/buddy/README.md CHANGED
@@ -153,7 +153,6 @@ buddy make:model Car # bootstraps a Car model
153
153
  buddy make:database cars # creates a cars database
154
154
  buddy make:migration create_cars_table # creates a cars migration file
155
155
  buddy make:factory cars # creates a Car factory file
156
- buddy make:seed cars # creates a Car seed file
157
156
  buddy make:table cars # bootstraps a cars data table
158
157
  buddy make:notification welcome-email # bootstraps a welcome-email notification
159
158
  buddy make:lang de # bootstraps a lang/de.yml language file
package/buddy/bin/cli.ts CHANGED
@@ -1,6 +1,6 @@
1
- import process from 'node:process'
2
1
  import { existsSync, readdirSync, statSync } from 'node:fs'
3
2
  import { join } from 'node:path'
3
+ import process from 'node:process'
4
4
  import { $ } from 'bun'
5
5
  import { cac } from 'cac'
6
6
  import { version } from '../package.json'
@@ -13,14 +13,14 @@ cli
13
13
  .action(() => {
14
14
  const buddyCli = 'buddy'
15
15
 
16
- if (existsSync(buddyCli))
17
- $`${buddyCli} ${process.argv.slice(2).join(' ')}`
16
+ if (existsSync(buddyCli)) $`${buddyCli} ${process.argv.slice(2).join(' ')}`
18
17
 
19
18
  let currentDir = process.cwd()
20
19
  let found = false
21
20
 
22
21
  while (currentDir !== '/') {
23
- if (existsSync(`${currentDir}/storage/framework/core/buddy`)) { // if the buddy directory exists, we know we are in a stacks project
22
+ if (existsSync(`${currentDir}/storage/framework/core/buddy`)) {
23
+ // if the buddy directory exists, we know we are in a stacks project
24
24
  found = true
25
25
  break
26
26
  }
@@ -44,7 +44,6 @@ cli
44
44
 
45
45
  while (queue.length) {
46
46
  const currentPath = queue.shift()
47
- // eslint-disable-next-line no-console
48
47
  console.log(`Checking ${currentPath}...`)
49
48
  const directoryContents = readdirSync(currentPath)
50
49
 
@@ -53,8 +52,7 @@ cli
53
52
  const isDirectory = statSync(contentPath).isDirectory()
54
53
 
55
54
  if (isDirectory) {
56
- if (contentPath.includes(target))
57
- return contentPath // Found the target directory
55
+ if (contentPath.includes(target)) return contentPath // Found the target directory
58
56
 
59
57
  queue.push(contentPath)
60
58
  }
@@ -67,23 +65,17 @@ cli
67
65
  const projectPath = findProjectPath('/', `${project}/storage/framework/core/buddy/`)
68
66
 
69
67
  if (projectPath) {
70
- // eslint-disable-next-line no-console
71
68
  console.log(`Project found at ${projectPath}.`)
72
- // eslint-disable-next-line no-console
73
69
  console.log(`Run 'cd ${projectPath}' to navigate to the project directory.`)
74
70
  // $`cd ${projectPath}`
75
- }
76
- else {
71
+ } else {
77
72
  console.error('Project directory not found.')
78
73
  }
79
74
  })
80
75
 
81
- cli
82
- .command('version', 'Show the version of the Stacks CLI')
83
- .action(() => {
84
- // eslint-disable-next-line no-console
85
- console.log(version)
86
- })
76
+ cli.command('version', 'Show the version of the Stacks CLI').action(() => {
77
+ console.log(version)
78
+ })
87
79
 
88
80
  cli.version(version)
89
81
  cli.help()
package/buddy/build.ts CHANGED
@@ -1,10 +1,5 @@
1
- import dts from 'bun-plugin-dts-auto'
2
-
3
1
  await Bun.build({
4
- entrypoints: [
5
- './src/index.ts',
6
- './src/cli.ts',
7
- ],
2
+ entrypoints: ['./src/index.ts', './src/cli.ts'],
8
3
 
9
4
  outdir: './dist',
10
5
  format: 'esm',
@@ -29,10 +24,4 @@ await Bun.build({
29
24
  '@aws-sdk/client-route-53',
30
25
  'bun',
31
26
  ],
32
-
33
- plugins: [
34
- dts({
35
- cwd: import.meta.dir,
36
- }),
37
- ],
38
27
  })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
- "version": "0.59.11",
4
+ "version": "0.61.1",
5
5
  "description": "Meet Buddy. The Stacks runtime.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
package/buddy/src/cli.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import process from 'node:process'
2
+ import { runAction } from '@stacksjs/actions'
2
3
  import type { CAC } from '@stacksjs/cli'
3
4
  import { cli, log } from '@stacksjs/cli'
4
- import { ensureProjectIsInitialized } from '@stacksjs/utils'
5
+ import { Action } from '@stacksjs/enums'
5
6
  import { path as p } from '@stacksjs/path'
6
7
  import { fs } from '@stacksjs/storage'
8
+ import { ensureProjectIsInitialized } from '@stacksjs/utils'
7
9
  import * as cmd from './commands'
8
10
 
9
11
  // setup global error handlers
@@ -30,11 +32,15 @@ async function main() {
30
32
  const isAppKeySet = await ensureProjectIsInitialized()
31
33
  if (isAppKeySet) {
32
34
  log.debug('Project is initialized')
33
- }
34
- else {
35
- log.warn('Your `APP_KEY` is not yet')
36
- // TODO: add prompt to set the key
37
- process.exit(1)
35
+ } else {
36
+ log.info('Your `APP_KEY` is not yet set')
37
+ log.info('Generating application key...')
38
+ const result = await runAction(Action.KeyGenerate)
39
+
40
+ if (result.isErr()) {
41
+ log.error('Failed to set random application key.', result.error)
42
+ process.exit()
43
+ }
38
44
  }
39
45
 
40
46
  cmd.build(buddy)
@@ -61,6 +67,7 @@ async function main() {
61
67
  cmd.seed(buddy)
62
68
  cmd.setup(buddy)
63
69
  cmd.test(buddy)
70
+ cmd.tinker(buddy)
64
71
  cmd.version(buddy)
65
72
  cmd.prepublish(buddy)
66
73
  cmd.upgrade(buddy)
@@ -77,20 +84,17 @@ await main()
77
84
  async function dynamicImports(buddy: CAC) {
78
85
  // dynamically import and register commands from ./app/Commands/*
79
86
  const commandsDir = p.appPath('Commands')
80
- const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
87
+ const commandFiles = fs.readdirSync(commandsDir).filter((file) => file.endsWith('.ts'))
81
88
 
82
89
  for (const file of commandFiles) {
83
90
  const commandPath = `${commandsDir}/${file}`
84
91
  const dynamicImport = await import(commandPath)
85
92
 
86
93
  // Correctly use the default export function
87
- if (typeof dynamicImport.default === 'function')
88
- dynamicImport.default(buddy)
89
- else
90
- console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
94
+ if (typeof dynamicImport.default === 'function') dynamicImport.default(buddy)
95
+ else console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
91
96
  }
92
97
 
93
98
  const listenerImport = await import(p.listenersPath('Console.ts'))
94
- if (typeof listenerImport.default === 'function')
95
- listenerImport.default(buddy)
99
+ if (typeof listenerImport.default === 'function') listenerImport.default(buddy)
96
100
  }
@@ -1,8 +1,8 @@
1
1
  import process from 'node:process'
2
- import type { AddOptions, BuildOptions, CLI } from '@stacksjs/types'
3
- import { ExitCode } from '@stacksjs/types'
4
2
  import { runAdd } from '@stacksjs/actions'
5
3
  import { log } from '@stacksjs/logging'
4
+ import type { AddOptions, BuildOptions, CLI } from '@stacksjs/types'
5
+ import { ExitCode } from '@stacksjs/types'
6
6
 
7
7
  export function add(buddy: CLI) {
8
8
  const descriptions = {
@@ -20,7 +20,7 @@ export function add(buddy: CLI) {
20
20
  .option('-t, --table', descriptions.table, { default: false })
21
21
  .option('-c, --calendar', descriptions.calendar, { default: false })
22
22
  .option('-a, --all', descriptions.all, { default: false })
23
- .option('-p, --project', descriptions.project, { default: false })
23
+ .option('-p, --project [project]', descriptions.project, { default: false })
24
24
  .option('--verbose', descriptions.verbose, { default: false })
25
25
  .action(async (options: BuildOptions) => {
26
26
  log.debug('Running `buddy add`...', options)
@@ -33,7 +33,6 @@ export function add(buddy: CLI) {
33
33
  // { label: 'Table', value: 'table' },
34
34
  // ],
35
35
  // })
36
-
37
36
  // // creates an object out of array and sets answers to true
38
37
  // options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
39
38
  }
@@ -46,7 +45,7 @@ export function add(buddy: CLI) {
46
45
  buddy
47
46
  .command('add:table', descriptions.table)
48
47
  .option('-t, --table', descriptions.table, { default: true })
49
- .option('-p, --project', descriptions.project, { default: false })
48
+ .option('-p, --project [project]', descriptions.project, { default: false })
50
49
  .option('--verbose', descriptions.verbose, { default: false })
51
50
  .action(async (options: BuildOptions) => {
52
51
  await runAdd(options)
@@ -55,7 +54,7 @@ export function add(buddy: CLI) {
55
54
  buddy
56
55
  .command('add:calendar', descriptions.calendar)
57
56
  .option('-t, --calendar', descriptions.calendar, { default: true })
58
- .option('-p, --project', descriptions.project, { default: false })
57
+ .option('-p, --project [project]', descriptions.project, { default: false })
59
58
  .option('--verbose', descriptions.verbose, { default: false })
60
59
  .action(async (options: BuildOptions) => {
61
60
  await runAdd(options)
@@ -1,9 +1,10 @@
1
1
  import process from 'node:process'
2
2
  import { runAction } from '@stacksjs/actions'
3
3
  import { intro, log, outro } from '@stacksjs/cli'
4
+ import { Action } from '@stacksjs/enums'
4
5
  import type { BuildOptions, CLI } from '@stacksjs/types'
5
6
  import { ExitCode } from '@stacksjs/types'
6
- import { Action } from '@stacksjs/enums'
7
+ import { isString } from '@stacksjs/validation'
7
8
 
8
9
  export function build(buddy: CLI) {
9
10
  const descriptions = {
@@ -36,7 +37,7 @@ export function build(buddy: CLI) {
36
37
  .option('-d, --docs', descriptions.docs)
37
38
  .option('-b, --buddy', descriptions.buddy, { default: false })
38
39
  .option('-s, --stacks', descriptions.framework, { default: false })
39
- .option('-p, --project', descriptions.project, { default: false })
40
+ .option('-p, --project [project]', descriptions.project, { default: false })
40
41
  .option('--server', descriptions.server, { default: false })
41
42
  .option('--verbose', descriptions.verbose, { default: false })
42
43
  .action(async (server: string | undefined, options: BuildOptions) => {
@@ -79,26 +80,26 @@ export function build(buddy: CLI) {
79
80
 
80
81
  // TODO: uncomment this when prompt is available
81
82
  if (hasNoOptions(options)) {
82
- let answers = await log.prompt.require()
83
- .multiselect(descriptions.select, {
84
- options: [
85
- { label: 'Components', value: 'components' },
86
- // { label: 'Vue Components', value: 'vue-components' },
87
- { label: 'Web Components', value: 'web-components' },
88
- { label: 'Functions', value: 'functions' },
89
- { label: 'Views', value: 'views' },
90
- { label: 'Documentation', value: 'docs' },
91
- ],
92
- })
83
+ let answers = await log.prompt.require().multiselect(descriptions.select, {
84
+ options: [
85
+ { label: 'Components', value: 'components' },
86
+ // { label: 'Vue Components', value: 'vue-components' },
87
+ { label: 'Web Components', value: 'web-components' },
88
+ { label: 'Functions', value: 'functions' },
89
+ { label: 'Views', value: 'views' },
90
+ { label: 'Documentation', value: 'docs' },
91
+ ],
92
+ })
93
93
 
94
- if (answers !== null)
95
- process.exit(ExitCode.InvalidArgument)
94
+ if (answers !== null) process.exit(ExitCode.InvalidArgument)
96
95
 
97
- if (isString(answers))
98
- answers = [answers]
96
+ if (isString(answers)) answers = [answers]
99
97
 
100
98
  // creates an object out of array and sets answers to true
101
- options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
99
+ options = answers.reduce((a: any, v: any) => {
100
+ a[v] = true
101
+ return a
102
+ }, {})
102
103
  }
103
104
 
104
105
  await runAction(Action.BuildStacks, options)
@@ -110,7 +111,7 @@ export function build(buddy: CLI) {
110
111
  .command('build:components', 'Automagically build component libraries for production use & npm/CDN distribution')
111
112
  .alias('prod:components')
112
113
  .option('-c, --components', descriptions.components, { default: true })
113
- .option('-p, --project', descriptions.project, { default: false })
114
+ .option('-p, --project [project]', descriptions.project, { default: false })
114
115
  .option('--verbose', descriptions.verbose, { default: false })
115
116
  .action(async (options: BuildOptions) => {
116
117
  log.debug('Running `buddy build:components` ...', options)
@@ -121,7 +122,7 @@ export function build(buddy: CLI) {
121
122
  .command('build:cli', descriptions.cli)
122
123
  .alias('prod:cli')
123
124
  .option('-b, --buddy', descriptions.buddy, { default: true })
124
- .option('-p, --project', descriptions.project, { default: false })
125
+ .option('-p, --project [project]', descriptions.project, { default: false })
125
126
  .option('--verbose', descriptions.verbose, { default: false })
126
127
  .action(async (options: BuildOptions) => {
127
128
  log.debug('Running `buddy build:cli` ...', options)
@@ -132,7 +133,7 @@ export function build(buddy: CLI) {
132
133
  .command('build:server', descriptions.server)
133
134
  .alias('prod:server')
134
135
  .alias('build:docker')
135
- .option('-p, --project', descriptions.project, { default: false })
136
+ .option('-p, --project [project]', descriptions.project, { default: false })
136
137
  .option('--verbose', descriptions.verbose, { default: false })
137
138
  .action(async (options: BuildOptions) => {
138
139
  log.debug('Running `buddy build:server` ...', options)
@@ -142,7 +143,7 @@ export function build(buddy: CLI) {
142
143
  buddy
143
144
  .command('build:functions', 'Automagically build function library for npm/CDN distribution')
144
145
  .option('-f, --functions', descriptions.functions, { default: true })
145
- .option('-p, --project', descriptions.project, { default: false })
146
+ .option('-p, --project [project]', descriptions.project, { default: false })
146
147
  .option('--verbose', descriptions.verbose, { default: false })
147
148
  .action(async (options: BuildOptions) => {
148
149
  log.debug('Running `buddy `build:functions` ...', options)
@@ -154,8 +155,10 @@ export function build(buddy: CLI) {
154
155
  .alias('build:vue')
155
156
  .alias('prod:vue-components')
156
157
  .alias('prod:vue')
157
- .option('-v, --vue-components', descriptions.vueComponents, { default: true })
158
- .option('-p, --project', descriptions.project, { default: false })
158
+ .option('-v, --vue-components', descriptions.vueComponents, {
159
+ default: true,
160
+ })
161
+ .option('-p, --project [project]', descriptions.project, { default: false })
159
162
  .option('--verbose', descriptions.verbose, { default: false })
160
163
  .alias('build:vue')
161
164
  .action(async (options: BuildOptions) => {
@@ -168,8 +171,10 @@ export function build(buddy: CLI) {
168
171
  .alias('build:wc')
169
172
  .alias('prod:web-components')
170
173
  .alias('prod:wc')
171
- .option('-w, --web-components', descriptions.webComponents, { default: true })
172
- .option('-p, --project', descriptions.project, { default: false })
174
+ .option('-w, --web-components', descriptions.webComponents, {
175
+ default: true,
176
+ })
177
+ .option('-p, --project [project]', descriptions.project, { default: false })
173
178
  .option('--verbose', descriptions.verbose, { default: false })
174
179
  .action(async (options: BuildOptions) => {
175
180
  log.debug('Running `buddy build:web-components` ...', options)
@@ -182,7 +187,7 @@ export function build(buddy: CLI) {
182
187
  .alias('build:documentation')
183
188
  .alias('prod:documentation')
184
189
  .option('-d, --docs', descriptions.docs, { default: true })
185
- .option('-p, --project', descriptions.project, { default: false })
190
+ .option('-p, --project [project]', descriptions.project, { default: false })
186
191
  .option('--verbose', descriptions.verbose, { default: false })
187
192
  .action(async (options: BuildOptions) => {
188
193
  log.debug('Running `buddy build:docs` ...', options)
@@ -191,7 +196,7 @@ export function build(buddy: CLI) {
191
196
 
192
197
  buddy
193
198
  .command('build:core', 'Automagically build the Stacks core.')
194
- .option('-p, --project', descriptions.project, { default: false })
199
+ .option('-p, --project [project]', descriptions.project, { default: false })
195
200
  .option('--verbose', descriptions.verbose, { default: false })
196
201
  .action(async (options: BuildOptions) => {
197
202
  log.debug('Running `buddy build:core` ...', options)
@@ -204,13 +209,16 @@ export function build(buddy: CLI) {
204
209
  process.exit()
205
210
  }
206
211
 
207
- await outro('Core packages built successfully', { startTime, useSeconds: true })
212
+ await outro('Core packages built successfully', {
213
+ startTime,
214
+ useSeconds: true,
215
+ })
208
216
  })
209
217
 
210
218
  buddy
211
219
  .command('build:desktop', descriptions.desktop)
212
220
  .alias('prod:desktop')
213
- .option('-p, --project', descriptions.project, { default: false })
221
+ .option('-p, --project [project]', descriptions.project, { default: false })
214
222
  .option('--verbose', descriptions.verbose, { default: false })
215
223
  .action(async (options: BuildOptions) => {
216
224
  log.debug('Running `buddy build:desktop` ...', options)
@@ -219,11 +227,14 @@ export function build(buddy: CLI) {
219
227
  const result = await runAction(Action.BuildDesktop, options)
220
228
 
221
229
  if (result.isErr()) {
222
- await outro('While running the build:desktop command, there was an issue', { startTime: perf, useSeconds: true }, result.error)
230
+ await outro(
231
+ 'While running the build:desktop command, there was an issue',
232
+ { startTime: perf, useSeconds: true },
233
+ result.error,
234
+ )
223
235
  process.exit()
224
236
  }
225
237
 
226
- // eslint-disable-next-line no-console
227
238
  console.log('')
228
239
  await outro('Exited', { startTime: perf, useSeconds: true })
229
240
  process.exit(ExitCode.Success)
@@ -232,7 +243,7 @@ export function build(buddy: CLI) {
232
243
  buddy
233
244
  .command('build:stacks', 'Build the Stacks framework.')
234
245
  .option('-s, --stacks', descriptions.framework, { default: true })
235
- .option('-p, --project', descriptions.project, { default: false })
246
+ .option('-p, --project [project]', descriptions.project, { default: false })
236
247
  .option('--verbose', descriptions.verbose, { default: false })
237
248
  .action(async (options: BuildOptions) => {
238
249
  log.debug('Running `buddy build:stacks` ...', options)
@@ -255,5 +266,15 @@ export function build(buddy: CLI) {
255
266
  }
256
267
 
257
268
  function hasNoOptions(options: BuildOptions) {
258
- return !options.components && !options.vueComponents && !options.webComponents && !options.elements && !options.functions && !options.views && !options.docs && !options.stacks && !options.buddy
269
+ return (
270
+ !options.components &&
271
+ !options.vueComponents &&
272
+ !options.webComponents &&
273
+ !options.elements &&
274
+ !options.functions &&
275
+ !options.views &&
276
+ !options.docs &&
277
+ !options.stacks &&
278
+ !options.buddy
279
+ )
259
280
  }
@@ -1,8 +1,8 @@
1
1
  import process from 'node:process'
2
- import type { CLI, FreshOptions } from '@stacksjs/types'
3
2
  import { runAction } from '@stacksjs/actions'
4
3
  import { intro, log, outro } from '@stacksjs/cli'
5
4
  import { Action } from '@stacksjs/enums'
5
+ import type { CLI, FreshOptions } from '@stacksjs/types'
6
6
 
7
7
  export function changelog(buddy: CLI) {
8
8
  const descriptions = {
@@ -19,7 +19,7 @@ export function changelog(buddy: CLI) {
19
19
  .command('changelog', descriptions.changelog)
20
20
  .option('-q, --quiet', descriptions.quiet, { default: false })
21
21
  .option('-d, --dry-run', descriptions.dryRun, { default: false })
22
- .option('-p, --project', descriptions.project, { default: false })
22
+ .option('-p, --project [project]', descriptions.project, { default: false })
23
23
  .option('--verbose', descriptions.verbose, { default: false })
24
24
  .action(async (options: FreshOptions) => {
25
25
  log.debug('Running `buddy changelog` ...', options)
@@ -28,17 +28,24 @@ export function changelog(buddy: CLI) {
28
28
  const result = await runAction(Action.Changelog, options)
29
29
 
30
30
  if (result.isErr()) {
31
- await outro('While running the changelog command, there was an issue', { ...options, startTime: perf, useSeconds: true }, result.error)
31
+ await outro(
32
+ 'While running the changelog command, there was an issue',
33
+ { ...options, startTime: perf, useSeconds: true },
34
+ result.error,
35
+ )
32
36
  process.exit()
33
37
  }
34
38
 
35
- await outro('Generated CHANGELOG.md', { ...options, startTime: perf, useSeconds: true, type: 'success' })
39
+ await outro('Generated CHANGELOG.md', {
40
+ ...options,
41
+ startTime: perf,
42
+ useSeconds: true,
43
+ type: 'success',
44
+ })
36
45
  })
37
46
 
38
47
  buddy.on('changelog:*', () => {
39
- // eslint-disable-next-line no-console
40
48
  console.log('Invalid command: %s', buddy.args.join(' '))
41
- // eslint-disable-next-line no-console
42
49
  console.log('See --help for a list of available commands.')
43
50
  process.exit(1)
44
51
  })
@@ -1,9 +1,9 @@
1
1
  import process from 'node:process'
2
- import { ExitCode } from '@stacksjs/types'
3
- import type { CLI, CleanOptions } from '@stacksjs/types'
4
2
  import { runAction } from '@stacksjs/actions'
5
3
  import { intro, log, outro } from '@stacksjs/cli'
6
4
  import { Action } from '@stacksjs/enums'
5
+ import { ExitCode } from '@stacksjs/types'
6
+ import type { CLI, CleanOptions } from '@stacksjs/types'
7
7
 
8
8
  export function clean(buddy: CLI) {
9
9
  const descriptions = {
@@ -14,7 +14,7 @@ export function clean(buddy: CLI) {
14
14
 
15
15
  buddy
16
16
  .command('clean', descriptions.clean)
17
- .option('-p, --project', descriptions.project, { default: false })
17
+ .option('-p, --project [project]', descriptions.project, { default: false })
18
18
  .option('--verbose', descriptions.verbose, { default: false })
19
19
  .action(async (options: CleanOptions) => {
20
20
  log.debug('Running `buddy clean` ...', options)
@@ -23,11 +23,19 @@ export function clean(buddy: CLI) {
23
23
  const result = await runAction(Action.Clean, options)
24
24
 
25
25
  if (result.isErr()) {
26
- await outro('While running the clean command, there was an issue', { startTime: perf, useSeconds: true }, result.error)
26
+ await outro(
27
+ 'While running the clean command, there was an issue',
28
+ { startTime: perf, useSeconds: true },
29
+ result.error,
30
+ )
27
31
  process.exit(ExitCode.FatalError)
28
32
  }
29
33
 
30
- await outro('Cleaned up', { startTime: perf, useSeconds: true, message: 'Cleaned up' })
34
+ await outro('Cleaned up', {
35
+ startTime: perf,
36
+ useSeconds: true,
37
+ message: 'Cleaned up',
38
+ })
31
39
  process.exit(ExitCode.Success)
32
40
  })
33
41