@stacksjs/buddy 0.58.58 → 0.58.60

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.
@@ -1,6 +1,6 @@
1
1
  import process from 'node:process'
2
2
  import { runAction } from '@stacksjs/actions'
3
- import { bgCyan, bold, intro, italic, outro, prompts } from '@stacksjs/cli'
3
+ import { bgCyan, bold, intro, italic, log, outro, prompts } from '@stacksjs/cli'
4
4
  import { config } from '@stacksjs/config'
5
5
  import { addDomain } from '@stacksjs/dns'
6
6
  import { ExitCode } from '@stacksjs/types'
@@ -64,6 +64,8 @@ export function domains(buddy: CLI) {
64
64
  .option('-p, --project', descriptions.project, { default: false })
65
65
  .option('--verbose', descriptions.verbose, { default: false })
66
66
  .action(async (domain: string, options: DomainsOptions) => {
67
+ log.debug('Running `buddy domains:purchase <domain>` ...', options)
68
+
67
69
  options.domain = domain
68
70
  const startTime = await intro('buddy domains:purchase')
69
71
  const result = await runAction(Action.DomainsPurchase, options)
@@ -103,6 +105,8 @@ export function domains(buddy: CLI) {
103
105
  .command('domains:add <domain>', descriptions.add)
104
106
  .option('--verbose', descriptions.verbose, { default: false })
105
107
  .action(async (options: DomainsOptions) => {
108
+ log.debug('Running `buddy domains:add <domain>` ...', options)
109
+
106
110
  const startTime = await intro('buddy domains:add')
107
111
  const result = await addDomain({
108
112
  ...options,
@@ -123,6 +127,8 @@ export function domains(buddy: CLI) {
123
127
  .option('--yes', descriptions.skip, { default: false })
124
128
  .option('--verbose', descriptions.verbose, { default: false })
125
129
  .action(async (options: DomainsOptions) => {
130
+ log.debug('Running `buddy domains:remove <domain>` ...', options)
131
+
126
132
  const domain = options.domain || config.app.url
127
133
  const opts = { ...options, domain }
128
134
  const startTime = await intro('buddy domains:remove')
@@ -2,12 +2,12 @@ import process from 'node:process'
2
2
  import { ExitCode } from '@stacksjs/types'
3
3
  import type { CLI, FreshOptions } from '@stacksjs/types'
4
4
  import { runAction } from '@stacksjs/actions'
5
- import { intro, outro } from '@stacksjs/cli'
5
+ import { intro, log, outro } from '@stacksjs/cli'
6
6
  import { Action } from '@stacksjs/enums'
7
7
 
8
8
  export function fresh(buddy: CLI) {
9
9
  const descriptions = {
10
- fresh: 'Reinstalls your npm dependencies',
10
+ fresh: 'Re-installs your npm dependencies',
11
11
  project: 'Target a specific project',
12
12
  verbose: 'Enable verbose output',
13
13
  }
@@ -17,6 +17,8 @@ export function fresh(buddy: CLI) {
17
17
  .option('-p, --project', descriptions.project, { default: false })
18
18
  .option('--verbose', descriptions.verbose, { default: false })
19
19
  .action(async (options: FreshOptions) => {
20
+ log.debug('Running `buddy fresh` ...', options)
21
+
20
22
  const perf = await intro('buddy fresh')
21
23
  const result = await runAction(Action.Fresh, { ...options, stdout: 'inherit' })
22
24
 
@@ -10,9 +10,8 @@ import {
10
10
  generateWebTypes,
11
11
  invoke as startGenerationProcess,
12
12
  } from '@stacksjs/actions'
13
- import { prompt } from '@stacksjs/cli'
13
+ import { log } from '@stacksjs/cli'
14
14
  import { type CLI, ExitCode, type GeneratorOptions } from '@stacksjs/types'
15
- import { isString } from '@stacksjs/validation'
16
15
 
17
16
  export function generate(buddy: CLI) {
18
17
  const descriptions = {
@@ -41,25 +40,28 @@ export function generate(buddy: CLI) {
41
40
  .option('-p, --project', descriptions.project, { default: false })
42
41
  .option('--verbose', descriptions.verbose, { default: false })
43
42
  .action(async (options: GeneratorOptions) => {
44
- if (hasNoOptions(options)) {
45
- let answers = await prompt.require()
46
- .multiselect(descriptions.select, {
47
- options: [
48
- { label: '1.) TypeScript Types', value: 'types' },
49
- { label: '2.) Library Entry Points', value: 'entries' },
50
- { label: '3.) Web Types', value: 'web-types' },
51
- { label: '4.) VS Code Custom Data', value: 'custom-data' },
52
- { label: '5.) IDE Helpers', value: 'ide-helpers' },
53
- { label: '6.) Component Meta', value: 'component-meta' },
54
- ],
55
- })
56
-
57
- if (isString(answers))
58
- answers = [answers]
59
-
60
- // creates an object out of array and sets answers to true
61
- options = (answers as Array<any>).reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
62
- }
43
+ log.debug('Running `buddy generate` ...', options)
44
+
45
+ // TODO: uncomment this
46
+ // if (hasNoOptions(options)) {
47
+ // let answers = await prompt.require()
48
+ // .multiselect(descriptions.select, {
49
+ // options: [
50
+ // { label: '1.) TypeScript Types', value: 'types' },
51
+ // { label: '2.) Library Entry Points', value: 'entries' },
52
+ // { label: '3.) Web Types', value: 'web-types' },
53
+ // { label: '4.) VS Code Custom Data', value: 'custom-data' },
54
+ // { label: '5.) IDE Helpers', value: 'ide-helpers' },
55
+ // { label: '6.) Component Meta', value: 'component-meta' },
56
+ // ],
57
+ // })
58
+ //
59
+ // if (isString(answers))
60
+ // answers = [answers]
61
+ //
62
+ // // creates an object out of array and sets answers to true
63
+ // options = (answers as Array<any>).reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
64
+ // }
63
65
 
64
66
  await startGenerationProcess(options)
65
67
 
@@ -72,6 +74,7 @@ export function generate(buddy: CLI) {
72
74
  .option('--verbose', descriptions.verbose, { default: false })
73
75
  .alias('types:generate')
74
76
  .action(async (options: GeneratorOptions) => {
77
+ log.debug('Running `buddy generate:types` ...', options)
75
78
  await generateTypes(options)
76
79
  })
77
80
 
@@ -80,6 +83,7 @@ export function generate(buddy: CLI) {
80
83
  .option('-p, --project', descriptions.project, { default: false })
81
84
  .option('--verbose', descriptions.verbose, { default: false })
82
85
  .action(async (options: GeneratorOptions) => {
86
+ log.debug('Running `buddy generate:entries` ...', options)
83
87
  await generateLibEntries(options)
84
88
  })
85
89
 
@@ -88,6 +92,7 @@ export function generate(buddy: CLI) {
88
92
  .option('-p, --project', descriptions.project, { default: false })
89
93
  .option('--verbose', descriptions.verbose, { default: false })
90
94
  .action(async (options: GeneratorOptions) => {
95
+ log.debug('Running `buddy generate:web-types` ...', options)
91
96
  await generateWebTypes(options)
92
97
  })
93
98
 
@@ -96,6 +101,7 @@ export function generate(buddy: CLI) {
96
101
  .option('-p, --project', descriptions.project, { default: false })
97
102
  .option('--verbose', descriptions.verbose, { default: false })
98
103
  .action(async (options: GeneratorOptions) => {
104
+ log.debug('Running `buddy generate:vscode-custom-data` ...', options)
99
105
  await generateVsCodeCustomData(options)
100
106
  })
101
107
 
@@ -104,6 +110,7 @@ export function generate(buddy: CLI) {
104
110
  .option('-p, --project', descriptions.project, { default: false })
105
111
  .option('--verbose', descriptions.verbose, { default: false })
106
112
  .action(async (options: GeneratorOptions) => {
113
+ log.debug('Running `buddy generate:ide-helpers` ...', options)
107
114
  await generateIdeHelpers(options)
108
115
  })
109
116
 
@@ -112,6 +119,7 @@ export function generate(buddy: CLI) {
112
119
  .option('-p, --project', descriptions.project, { default: false })
113
120
  .option('--verbose', descriptions.verbose, { default: false })
114
121
  .action(async (options: GeneratorOptions) => {
122
+ log.debug('Running `buddy generate:component-meta` ...', options)
115
123
  await generateComponentMeta(options)
116
124
  })
117
125
 
@@ -119,13 +127,15 @@ export function generate(buddy: CLI) {
119
127
  .command('generate:pkgx-config', descriptions.pkgx)
120
128
  .option('-p, --project', descriptions.project, { default: false })
121
129
  .option('--verbose', descriptions.verbose, { default: false })
122
- .action(() => {
130
+ .action((options: GeneratorOptions) => {
131
+ log.debug('Running `buddy generate:pkgx-config` ...', options)
123
132
  generatePkgxConfig()
124
133
  })
125
134
 
126
135
  buddy
127
136
  .command('generate:migrations', 'Generate Migrations')
128
- .action(() => {
137
+ .action((options: GeneratorOptions) => {
138
+ log.debug('Running `buddy generate:migrations` ...', options)
129
139
  generateMigrations()
130
140
  })
131
141
 
@@ -135,6 +145,6 @@ export function generate(buddy: CLI) {
135
145
  })
136
146
  }
137
147
 
138
- function hasNoOptions(options: GeneratorOptions) {
139
- return !options.types && !options.entries && !options.webTypes && !options.customData && !options.ideHelpers && !options.componentMeta
140
- }
148
+ // function hasNoOptions(options: GeneratorOptions) {
149
+ // return !options.types && !options.entries && !options.webTypes && !options.customData && !options.ideHelpers && !options.componentMeta
150
+ // }
@@ -4,7 +4,7 @@ import type { CLI } from '@stacksjs/types'
4
4
  import { config } from '@stacksjs/config'
5
5
 
6
6
  // import { path } from '@stacksjs/path'
7
- import { runCommandSync } from '@stacksjs/cli'
7
+ import { log, runCommandSync } from '@stacksjs/cli'
8
8
 
9
9
  // function runCommand(command: string): Promise<string> {
10
10
  // return new Promise((resolve, reject) => {
@@ -39,6 +39,8 @@ export function http(buddy: CLI) {
39
39
  .option('-p, --project', descriptions.project, { default: false })
40
40
  // .option('--verbose', descriptions.verbose, { default: false })
41
41
  .action(async (domain: string | undefined, options: HttpOptions) => {
42
+ log.debug('Running `buddy http [domain]` ...', options)
43
+
42
44
  // Convert options object to command-line options string
43
45
  const optionsString = Object.entries(options)
44
46
  .filter(([key, value]) => key !== '--' && key.length > 1 && value !== false) // filter out '--' key and short options
@@ -46,9 +48,9 @@ export function http(buddy: CLI) {
46
48
  .join(' ')
47
49
 
48
50
  const command = `http GET ${domain || config.app.url} ${optionsString}`
49
- // eslint-disable-next-line no-console
50
- console.log(`Running command: ${command}`)
51
- runCommandSync(command)
51
+
52
+ log.info(`Running command: ${command}`)
53
+ await runCommandSync(command)
52
54
 
53
55
  process.exit(ExitCode.Success)
54
56
  })
@@ -9,13 +9,11 @@ export * from './deploy'
9
9
  export * from './dev'
10
10
  export * from './domains'
11
11
  export * from './dns'
12
- export * from './example'
13
12
  export * from './fresh'
14
13
  export * from './generate'
15
14
  export * from './http'
16
15
  export * from './lint'
17
16
  export * from './list'
18
- export * from './inspire'
19
17
  export * from './install'
20
18
  export * from './key'
21
19
  export * from './make'
@@ -1,6 +1,6 @@
1
1
  import process from 'node:process'
2
2
  import type { CLI, InstallOptions } from '@stacksjs/types'
3
- import { runCommand } from '@stacksjs/cli'
3
+ import { log, runCommand } from '@stacksjs/cli'
4
4
  import { path as p } from '@stacksjs/path'
5
5
 
6
6
  export function install(buddy: CLI) {
@@ -15,6 +15,8 @@ export function install(buddy: CLI) {
15
15
  .option('-p, --project', descriptions.project, { default: false })
16
16
  .option('-v, --verbose', descriptions.verbose, { default: false })
17
17
  .action(async (options: InstallOptions) => {
18
+ log.debug('Running `buddy install` ...', options)
19
+
18
20
  await runCommand('bun install', {
19
21
  ...options,
20
22
  cwd: p.projectPath(),
@@ -16,6 +16,8 @@ export function key(buddy: CLI) {
16
16
  .option('-p, --project', descriptions.project, { default: false })
17
17
  .option('--verbose', descriptions.verbose, { default: false })
18
18
  .action(async (options: KeyOptions) => {
19
+ log.debug('Running `buddy key:generate` ...', options)
20
+
19
21
  await intro('buddy key:generate')
20
22
  const result = await runAction(Action.KeyGenerate, options)
21
23
 
@@ -18,6 +18,8 @@ export function lint(buddy: CLI) {
18
18
  .option('-p, --project', descriptions.project, { default: false })
19
19
  .option('--verbose', descriptions.verbose, { default: false })
20
20
  .action(async (options: LintOptions) => {
21
+ log.debug('Running `buddy lint` ...', options)
22
+
21
23
  const startTime = await intro('buddy lint')
22
24
  const result = await runAction(Action.Lint, options)
23
25
 
@@ -35,6 +37,8 @@ export function lint(buddy: CLI) {
35
37
  .option('-p, --project', descriptions.project, { default: false })
36
38
  .option('--verbose', descriptions.verbose, { default: false })
37
39
  .action(async (options: LintOptions) => {
40
+ log.debug('Running `buddy lint:fix` ...', options)
41
+
38
42
  log.info('Fixing lint errors...')
39
43
  const result = await runAction(Action.LintFix, { ...options })
40
44
 
@@ -1,7 +1,8 @@
1
1
  import process from 'node:process'
2
- import type { CLI } from '@stacksjs/types'
2
+ import type { CLI, CliOptions } from '@stacksjs/types'
3
3
  import { $ } from 'bun'
4
4
  import { projectPath } from '@stacksjs/path'
5
+ import { log } from 'stacks/logging'
5
6
 
6
7
  export function list(buddy: CLI) {
7
8
  const descriptions = {
@@ -14,8 +15,11 @@ export function list(buddy: CLI) {
14
15
  .command('list', descriptions.list)
15
16
  .option('-p, --project', descriptions.project, { default: false })
16
17
  .option('--verbose', descriptions.verbose, { default: false })
17
- .action(async () => {
18
+ .action(async (options: CliOptions) => {
19
+ log.debug('Running `buddy list` ...', options)
20
+
18
21
  $.cwd(projectPath())
22
+
19
23
  const test = await $`buddy --help`.text()
20
24
  const commandsSection = test.match(/Commands:.*?(?=For more info, run any command with the)/s)?.[0]
21
25
 
@@ -10,11 +10,10 @@ import {
10
10
  makePage,
11
11
  makeStack,
12
12
  } from '@stacksjs/actions'
13
- import { intro, italic, outro, prompt } from '@stacksjs/cli'
13
+ import { intro, italic, outro } from '@stacksjs/cli'
14
14
  import { log } from '@stacksjs/logging'
15
15
  import type { CLI, MakeOptions } from '@stacksjs/types'
16
16
  import { ExitCode } from '@stacksjs/types'
17
- import { isString } from '@stacksjs/validation'
18
17
 
19
18
  export function make(buddy: CLI) {
20
19
  const descriptions = {
@@ -47,6 +46,8 @@ export function make(buddy: CLI) {
47
46
  .option('-p, --project', descriptions.project, { default: false })
48
47
  .option('--verbose', descriptions.verbose, { default: false })
49
48
  .action(async (options: MakeOptions) => {
49
+ log.debug('Running `buddy make` ...', options)
50
+
50
51
  const name = buddy.args[0]
51
52
 
52
53
  if (!name) {
@@ -54,31 +55,32 @@ export function make(buddy: CLI) {
54
55
  process.exit()
55
56
  }
56
57
 
57
- if (hasNoOptions(options)) {
58
- let answers = await prompt.require()
59
- .multiselect(descriptions.select, {
60
- options: [
61
- { label: 'Page', value: 'page' },
62
- { label: 'Function', value: 'function' },
63
- { label: 'Component', value: 'component' },
64
- { label: 'Notification', value: 'notification' },
65
- { label: 'Language', value: 'language' },
66
- { label: 'Database', value: 'database' },
67
- { label: 'Migration', value: 'migration' },
68
- { label: 'Factory', value: 'factory' },
69
- { label: 'Stack', value: 'stack' },
70
- ],
71
- })
72
-
73
- if (answers !== null)
74
- process.exit(ExitCode.InvalidArgument)
75
-
76
- if (isString(answers))
77
- answers = [answers]
78
-
79
- // creates an object out of array and sets answers to true
80
- options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
81
- }
58
+ // TODO: uncomment this when prompt is ready
59
+ // if (hasNoOptions(options)) {
60
+ // let answers = await prompt.require()
61
+ // .multiselect(descriptions.select, {
62
+ // options: [
63
+ // { label: 'Page', value: 'page' },
64
+ // { label: 'Function', value: 'function' },
65
+ // { label: 'Component', value: 'component' },
66
+ // { label: 'Notification', value: 'notification' },
67
+ // { label: 'Language', value: 'language' },
68
+ // { label: 'Database', value: 'database' },
69
+ // { label: 'Migration', value: 'migration' },
70
+ // { label: 'Factory', value: 'factory' },
71
+ // { label: 'Stack', value: 'stack' },
72
+ // ],
73
+ // })
74
+ //
75
+ // if (answers !== null)
76
+ // process.exit(ExitCode.InvalidArgument)
77
+ //
78
+ // if (isString(answers))
79
+ // answers = [answers]
80
+ //
81
+ // // creates an object out of array and sets answers to true
82
+ // options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
83
+ // }
82
84
 
83
85
  await invoke(options)
84
86
 
@@ -91,6 +93,8 @@ export function make(buddy: CLI) {
91
93
  .option('-p, --project', descriptions.project, { default: false })
92
94
  .option('--verbose', descriptions.verbose, { default: false })
93
95
  .action(async (options: MakeOptions) => {
96
+ log.debug('Running `buddy make:component` ...', options)
97
+
94
98
  const name = buddy.args[0] || options.name
95
99
  options.name = name
96
100
 
@@ -108,6 +112,8 @@ export function make(buddy: CLI) {
108
112
  .option('-p, --project', descriptions.project, { default: false })
109
113
  .option('--verbose', descriptions.verbose, { default: false })
110
114
  .action((options: MakeOptions) => {
115
+ log.debug('Running `buddy make:database` ...', options)
116
+
111
117
  const name = buddy.args[0] || options.name
112
118
  options.name = name
113
119
 
@@ -125,6 +131,8 @@ export function make(buddy: CLI) {
125
131
  .option('-p, --project', descriptions.project, { default: false })
126
132
  .option('--verbose', descriptions.verbose, { default: false })
127
133
  .action((options: MakeOptions) => {
134
+ log.debug('Running `buddy make:factory` ...', options)
135
+
128
136
  const name = buddy.args[0] || options.name
129
137
  options.name = name
130
138
 
@@ -143,6 +151,8 @@ export function make(buddy: CLI) {
143
151
  .option('-p, --project', descriptions.project, { default: false })
144
152
  .option('--verbose', descriptions.verbose, { default: false })
145
153
  .action(async (options: MakeOptions) => {
154
+ log.debug('Running `buddy make:view` ...', options)
155
+
146
156
  const name = buddy.args[0] || options.name
147
157
  options.name = name
148
158
 
@@ -160,6 +170,8 @@ export function make(buddy: CLI) {
160
170
  .option('-p, --project', descriptions.project, { default: false })
161
171
  .option('--verbose', descriptions.verbose, { default: false })
162
172
  .action(async (options: MakeOptions) => {
173
+ log.debug('Running `buddy make:function` ...', options)
174
+
163
175
  await makeFunction(options)
164
176
  })
165
177
 
@@ -169,6 +181,8 @@ export function make(buddy: CLI) {
169
181
  .option('-p, --project', descriptions.project, { default: false })
170
182
  .option('--verbose', descriptions.verbose, { default: false })
171
183
  .action(async (options: MakeOptions) => {
184
+ log.debug('Running `buddy make:lang` ...', options)
185
+
172
186
  const name = buddy.args[0] || options.name
173
187
  options.name = name
174
188
 
@@ -189,6 +203,8 @@ export function make(buddy: CLI) {
189
203
  .option('-p, --project', descriptions.project, { default: false })
190
204
  .option('--verbose', descriptions.verbose, { default: false })
191
205
  .action(async (options: MakeOptions) => {
206
+ log.debug('Running `buddy make:notification` ...', options)
207
+
192
208
  const perf = await intro('buddy make:notification')
193
209
 
194
210
  const name = buddy.args[0] || options.name
@@ -216,6 +232,8 @@ export function make(buddy: CLI) {
216
232
  .option('-p, --project', descriptions.project, { default: false })
217
233
  .option('--verbose', descriptions.verbose, { default: false })
218
234
  .action((options: MakeOptions) => {
235
+ log.debug('Running `buddy make:stack` ...', options)
236
+
219
237
  const name = buddy.args[0] || options.name
220
238
  options.name = name
221
239
 
@@ -231,6 +249,8 @@ export function make(buddy: CLI) {
231
249
  .command('make:model', descriptions.model)
232
250
  .option('-n, --name', 'The name of the model')
233
251
  .action(async (options: MakeOptions) => {
252
+ log.debug('Running `buddy make:model` ...', options)
253
+
234
254
  const name = buddy.args[0] || options.name
235
255
  options.name = name
236
256
 
@@ -247,6 +267,8 @@ export function make(buddy: CLI) {
247
267
  .option('-n, --name', 'The name of the migration')
248
268
  .option('-e, --env', 'The environment to run the migration in', { default: 'dev' })
249
269
  .action((options: MakeOptions) => {
270
+ log.debug('Running `buddy make:migration` ...', options)
271
+
250
272
  const name = buddy.args[0] || options.name
251
273
  options.name = name
252
274
 
@@ -264,6 +286,6 @@ export function make(buddy: CLI) {
264
286
  })
265
287
  }
266
288
 
267
- function hasNoOptions(options: MakeOptions) {
268
- return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.notification && !options.stack
269
- }
289
+ // function hasNoOptions(options: MakeOptions) {
290
+ // return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.notification && !options.stack
291
+ // }
@@ -2,7 +2,7 @@ import process from 'node:process'
2
2
  import { ExitCode } from '@stacksjs/types'
3
3
  import type { CLI, MigrateOptions } from '@stacksjs/types'
4
4
  import { runAction } from '@stacksjs/actions'
5
- import { intro, outro } from '@stacksjs/cli'
5
+ import { intro, log, outro } from '@stacksjs/cli'
6
6
  import { Action } from '@stacksjs/enums'
7
7
 
8
8
  export function migrate(buddy: CLI) {
@@ -18,6 +18,8 @@ export function migrate(buddy: CLI) {
18
18
  .option('-p, --project', descriptions.project, { default: false })
19
19
  .option('--verbose', descriptions.verbose, { default: false })
20
20
  .action(async (options: MigrateOptions) => {
21
+ log.debug('Running `buddy migrate` ...', options)
22
+
21
23
  const perf = await intro('buddy migrate')
22
24
  const result = await runAction(Action.Migrate, { ...options })
23
25
 
@@ -37,7 +39,9 @@ export function migrate(buddy: CLI) {
37
39
  .option('-p, --project', descriptions.project, { default: false })
38
40
  .option('--verbose', descriptions.verbose, { default: false })
39
41
  .action(async (options: MigrateOptions) => {
40
- const perf = await intro('buddy migrate')
42
+ log.debug('Running `buddy migrate:dns` ...', options)
43
+
44
+ const perf = await intro('buddy migrate:dns')
41
45
  const result = await runAction(Action.MigrateDns, { ...options })
42
46
 
43
47
  if (result.isErr()) {
@@ -2,6 +2,7 @@ import process from 'node:process'
2
2
  import type { CLI, PrepublishOptions } from '@stacksjs/types'
3
3
  import { Action } from '@stacksjs/enums'
4
4
  import { runAction } from '@stacksjs/actions'
5
+ import { log } from 'stacks/logging'
5
6
 
6
7
  export function prepublish(buddy: CLI) {
7
8
  const descriptions = {
@@ -15,6 +16,8 @@ export function prepublish(buddy: CLI) {
15
16
  .option('-p, --project', descriptions.project, { default: false })
16
17
  .option('--verbose', descriptions.verbose, { default: false })
17
18
  .action(async (options: PrepublishOptions) => {
19
+ log.debug('Running `buddy prepublish` ...', options)
20
+
18
21
  await runAction(Action.Prepublish, options)
19
22
  })
20
23
 
@@ -8,24 +8,34 @@ import { runAction } from '@stacksjs/actions'
8
8
  const descriptions = {
9
9
  release: 'Release a new version of your libraries/packages',
10
10
  project: 'Target a specific project',
11
+ dryRun: 'Run the release without actually releasing',
11
12
  verbose: 'Enable verbose output',
12
13
  }
13
14
 
14
15
  export function release(buddy: CLI) {
15
16
  buddy
16
17
  .command('release', descriptions.release)
18
+ .option('--dry-run', descriptions.dryRun, { default: false })
17
19
  .option('-p, --project', descriptions.project, { default: false })
18
20
  .option('--verbose', descriptions.verbose, { default: false })
19
21
  .action(async (options: ReleaseOptions) => {
22
+ log.debug('Running `buddy release` ...', options)
23
+
24
+ if (options.dryRun)
25
+ log.warn('Dry run enabled. No changes will be made or committed.')
26
+
20
27
  const startTime = await intro('buddy release')
21
- const result = await runAction(Action.Release, { ...options, stdin: 'inherit' })
28
+ const result = await runAction(Action.Release, {
29
+ stdin: 'inherit',
30
+ ...options,
31
+ })
22
32
 
23
33
  if (result.isErr()) {
24
34
  log.error('Failed to release', result.error)
25
35
  process.exit(ExitCode.FatalError)
26
36
  }
27
37
 
28
- await outro('Triggered your CI/CD release workflow', { startTime, useSeconds: true })
38
+ await outro('Triggered CI/CD Release Workflow', { startTime, useSeconds: true })
29
39
  })
30
40
 
31
41
  buddy.on('release:*', () => {
@@ -2,7 +2,7 @@ import process from 'node:process'
2
2
  import { ExitCode } from '@stacksjs/types'
3
3
  import type { CLI, SeedOptions } from '@stacksjs/types'
4
4
  import { runAction } from '@stacksjs/actions'
5
- import { intro, outro } from '@stacksjs/cli'
5
+ import { intro, log, outro } from '@stacksjs/cli'
6
6
  import { Action } from '@stacksjs/enums'
7
7
 
8
8
  export function seed(buddy: CLI) {
@@ -17,6 +17,8 @@ export function seed(buddy: CLI) {
17
17
  .option('-p, --project', descriptions.project, { default: false })
18
18
  .option('--verbose', descriptions.verbose, { default: false })
19
19
  .action(async (options: SeedOptions) => {
20
+ log.debug('Running `buddy seed` ...', options)
21
+
20
22
  const perf = await intro('buddy seed')
21
23
  const result = await runAction(Action.Seed, options)
22
24
 
@@ -22,6 +22,8 @@ export function setup(buddy: CLI) {
22
22
  .option('-p, --project', descriptions.project, { default: false })
23
23
  .option('--verbose', descriptions.verbose, { default: false })
24
24
  .action(async (options: CliOptions) => {
25
+ log.debug('Running `buddy setup` ...', options)
26
+
25
27
  if (!await isPkgxInstalled())
26
28
  await installPkgx()
27
29
 
@@ -35,6 +37,8 @@ export function setup(buddy: CLI) {
35
37
  .command('setup:oh-my-zsh', descriptions.ohMyZsh) // if triggered multiple times, it will update the plugin
36
38
  .option('--verbose', descriptions.verbose, { default: false })
37
39
  .action(async (_options?: CliOptions) => {
40
+ log.debug('Running `buddy setup:oh-my-zsh` ...', _options)
41
+
38
42
  const homePath = (await $`echo $HOME`.text()).trim()
39
43
  const zshrcPath = p.join(homePath, '.zshrc')
40
44
  const pluginPath = p.frameworkPath('core/zsh-buddy/buddy.plugin.zsh')
@@ -50,7 +54,11 @@ export function setup(buddy: CLI) {
50
54
 
51
55
  if (match) {
52
56
  // 1. Find the plugins line
53
- const plugins = match[1].split(' ')
57
+ const plugins = match[1]?.split(' ')
58
+ if (!plugins) {
59
+ log.error('Maybe the plugins line in your .zshrc file could not be found? If this continues being an issue, please reach out to us on Discord.')
60
+ process.exit(ExitCode.FatalError)
61
+ }
54
62
 
55
63
  // 2. Add buddy to the list of plugins if it's not already there
56
64
  if (!plugins.includes('buddy')) {
@@ -72,18 +80,18 @@ export function setup(buddy: CLI) {
72
80
  log.success('Copied buddy zsh plugin')
73
81
  }
74
82
  else {
75
- log.info('buddy is already integrated in your shell, updating...')
83
+ log.info('Buddy is already integrated in your shell, ensuring it is updated...')
76
84
  await runCommand(`cp -rf ${pluginPath} ${customPath}`)
77
85
  // await runCommand(`source ${customPath}/buddy.plugin.zsh`)
78
- log.success('Updated buddy zsh plugin')
86
+ log.success('Updated buddy zsh plugin to latest version')
79
87
  }
80
88
  }
81
89
 
82
- log.success('Oh My Zsh setup complete')
83
- log.info('To see changes reflect, you may need to:')
84
- // if on vscode show the message
85
- // log.info('⌘⇧P workbench.action.reloadWindow')
86
- // else show the message
90
+ log.success('Oh My Zsh Setup Complete')
91
+ log.info('To see changes reflect, you may need to open a new terminal window')
92
+ // if using the vscode terminal, show the message
93
+ if (process.env.TERM_PROGRAM === 'vscode')
94
+ log.info('⌘⇧P terminal.create.new.terminal')
87
95
  })
88
96
 
89
97
  buddy.on('setup:*', () => {