@stacksjs/buddy 0.58.57 → 0.58.59
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.
- package/dist/chunk-59a9de11428ba763.js +993 -0
- package/dist/{chunk-e9c0ec1a3b7be088.js → chunk-7b24d1e3e585766e.js} +594 -563
- package/dist/cli.js +3916 -19
- package/dist/index.js +2 -5
- package/package.json +1 -1
- package/src/cli.ts +91 -17
- package/src/commands/add.ts +3 -0
- package/src/commands/build.ts +42 -27
- package/src/commands/changelog.ts +13 -6
- package/src/commands/clean.ts +3 -1
- package/src/commands/cloud.ts +14 -2
- package/src/commands/commit.ts +2 -0
- package/src/commands/configure.ts +6 -3
- package/src/commands/create.ts +3 -1
- package/src/commands/deploy.ts +3 -1
- package/src/commands/dev.ts +50 -36
- package/src/commands/dns.ts +7 -1
- package/src/commands/domains.ts +7 -1
- package/src/commands/fresh.ts +4 -2
- package/src/commands/generate.ts +36 -26
- package/src/commands/http.ts +6 -4
- package/src/commands/index.ts +0 -2
- package/src/commands/install.ts +3 -1
- package/src/commands/key.ts +2 -0
- package/src/commands/lint.ts +4 -0
- package/src/commands/list.ts +6 -2
- package/src/commands/make.ts +52 -30
- package/src/commands/migrate.ts +6 -2
- package/src/commands/prepublish.ts +3 -0
- package/src/commands/release.ts +12 -2
- package/src/commands/seed.ts +3 -1
- package/src/commands/setup.ts +16 -8
- package/src/commands/tinker.ts +3 -1
- package/src/commands/types.ts +4 -2
- package/src/commands/upgrade.ts +37 -25
- package/src/commands/version.ts +7 -0
- package/src/commands/example.ts +0 -66
- package/src/commands/inspire.ts +0 -24
package/src/commands/make.ts
CHANGED
|
@@ -10,11 +10,10 @@ import {
|
|
|
10
10
|
makePage,
|
|
11
11
|
makeStack,
|
|
12
12
|
} from '@stacksjs/actions'
|
|
13
|
-
import { intro, italic, outro
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
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
|
+
// }
|
package/src/commands/migrate.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/src/commands/release.ts
CHANGED
|
@@ -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, {
|
|
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
|
|
38
|
+
await outro('Triggered CI/CD Release Workflow', { startTime, useSeconds: true })
|
|
29
39
|
})
|
|
30
40
|
|
|
31
41
|
buddy.on('release:*', () => {
|
package/src/commands/seed.ts
CHANGED
|
@@ -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
|
|
package/src/commands/setup.ts
CHANGED
|
@@ -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]
|
|
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('
|
|
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
|
|
83
|
-
log.info('To see changes reflect, you may need to
|
|
84
|
-
// if
|
|
85
|
-
|
|
86
|
-
|
|
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:*', () => {
|
package/src/commands/tinker.ts
CHANGED
|
@@ -2,7 +2,7 @@ import process from 'node:process'
|
|
|
2
2
|
import { ExitCode } from '@stacksjs/types'
|
|
3
3
|
import type { CLI, TinkerOptions } 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 tinker(buddy: CLI) {
|
|
@@ -17,6 +17,8 @@ export function tinker(buddy: CLI) {
|
|
|
17
17
|
.option('-p, --project', descriptions.project, { default: false })
|
|
18
18
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
19
19
|
.action(async (options: TinkerOptions) => {
|
|
20
|
+
log.debug('Running `buddy tinker` ...', options)
|
|
21
|
+
|
|
20
22
|
const perf = await intro('buddy tinker')
|
|
21
23
|
const result = await runAction(Action.Tinker, options)
|
|
22
24
|
|
package/src/commands/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { generateTypes } from '@stacksjs/actions'
|
|
4
|
+
import { log } from 'stacks/logging'
|
|
4
5
|
|
|
5
6
|
export function types(buddy: CLI) {
|
|
6
7
|
const descriptions = {
|
|
@@ -14,7 +15,8 @@ export function types(buddy: CLI) {
|
|
|
14
15
|
.command('types:generate', descriptions.generate)
|
|
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 types:generate` ...', options)
|
|
18
20
|
await generateTypes()
|
|
19
21
|
})
|
|
20
22
|
|
package/src/commands/upgrade.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import { runAction } from '@stacksjs/actions'
|
|
3
|
-
import { intro,
|
|
3
|
+
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
4
|
import { ExitCode } from '@stacksjs/types'
|
|
5
5
|
import type { CLI, UpgradeOptions } from '@stacksjs/types'
|
|
6
6
|
import { Action } from '@stacksjs/enums'
|
|
7
|
-
import { isString } from '@stacksjs/validation'
|
|
8
7
|
|
|
9
8
|
export function upgrade(buddy: CLI) {
|
|
10
9
|
const descriptions = {
|
|
@@ -31,28 +30,31 @@ export function upgrade(buddy: CLI) {
|
|
|
31
30
|
.alias('update')
|
|
32
31
|
.example('buddy upgrade -a --verbose')
|
|
33
32
|
.action(async (options: UpgradeOptions) => {
|
|
33
|
+
log.debug('Running `buddy upgrade` ...', options)
|
|
34
|
+
|
|
34
35
|
const perf = await intro('buddy upgrade')
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
37
|
+
// TODO: uncomment this when prompt is available
|
|
38
|
+
// if (hasNoOptions(options)) {
|
|
39
|
+
// let answers = await prompt.require()
|
|
40
|
+
// .multiselect(descriptions.select, {
|
|
41
|
+
// options: [
|
|
42
|
+
// { value: 'dependencies', label: 'Dependencies' },
|
|
43
|
+
// { value: 'framework', label: 'Framework' },
|
|
44
|
+
// { value: 'node', label: 'Node.js' },
|
|
45
|
+
// { value: 'package-manager', label: 'Package Manager' },
|
|
46
|
+
// ],
|
|
47
|
+
// })
|
|
48
|
+
//
|
|
49
|
+
// if (answers !== null)
|
|
50
|
+
// process.exit(ExitCode.InvalidArgument)
|
|
51
|
+
//
|
|
52
|
+
// if (isString(answers))
|
|
53
|
+
// answers = [answers]
|
|
54
|
+
//
|
|
55
|
+
// // creates an object out of array and sets answers to true
|
|
56
|
+
// options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
|
|
57
|
+
// }
|
|
56
58
|
|
|
57
59
|
const result = await runAction(Action.Upgrade, options)
|
|
58
60
|
|
|
@@ -71,6 +73,8 @@ export function upgrade(buddy: CLI) {
|
|
|
71
73
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
72
74
|
.example('buddy upgrade:framework --verbose')
|
|
73
75
|
.action(async (options: UpgradeOptions) => {
|
|
76
|
+
log.debug('Running `buddy upgrade:framework` ...', options)
|
|
77
|
+
|
|
74
78
|
// const perf = await intro('buddy update:framework')
|
|
75
79
|
await runAction(Action.Upgrade, options)
|
|
76
80
|
})
|
|
@@ -82,6 +86,7 @@ export function upgrade(buddy: CLI) {
|
|
|
82
86
|
.alias('upgrade:deps')
|
|
83
87
|
.example('buddy upgrade:dependencies --verbose')
|
|
84
88
|
.action(async (options: UpgradeOptions) => {
|
|
89
|
+
log.debug('Running `buddy upgrade:dependencies` ...', options)
|
|
85
90
|
await runAction(Action.Upgrade, options)
|
|
86
91
|
})
|
|
87
92
|
|
|
@@ -90,6 +95,7 @@ export function upgrade(buddy: CLI) {
|
|
|
90
95
|
.option('-p, --project', descriptions.project, { default: false })
|
|
91
96
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
92
97
|
.action(async (options: UpgradeOptions) => {
|
|
98
|
+
log.debug('Running `buddy upgrade:bun` ...', options)
|
|
93
99
|
const perf = await intro('buddy upgrade:bun')
|
|
94
100
|
const result = await runAction(Action.UpgradeBun, options)
|
|
95
101
|
|
|
@@ -106,10 +112,16 @@ export function upgrade(buddy: CLI) {
|
|
|
106
112
|
.option('-p, --project', descriptions.project, { default: false })
|
|
107
113
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
108
114
|
.action(async (options: UpgradeOptions) => {
|
|
115
|
+
log.debug('Running `buddy upgrade:all` ...', options)
|
|
109
116
|
await runAction(Action.Upgrade, options)
|
|
110
117
|
})
|
|
111
|
-
}
|
|
112
118
|
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
buddy.on('upgrade:*', () => {
|
|
120
|
+
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
121
|
+
process.exit(1)
|
|
122
|
+
})
|
|
115
123
|
}
|
|
124
|
+
|
|
125
|
+
// function hasNoOptions(options: UpgradeOptions) {
|
|
126
|
+
// return !options.framework && !options.dependencies && !options.packageManager && !options.node && !options.all
|
|
127
|
+
// }
|
package/src/commands/version.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
1
2
|
import type { CLI } from '@stacksjs/types'
|
|
2
3
|
import { bold, dim, green, intro, log } from '@stacksjs/cli'
|
|
3
4
|
import { storage } from '@stacksjs/storage'
|
|
@@ -10,6 +11,7 @@ export function version(buddy: CLI) {
|
|
|
10
11
|
buddy
|
|
11
12
|
.command('version', descriptions.version)
|
|
12
13
|
.action(async () => {
|
|
14
|
+
log.debug('Running `buddy version` ...')
|
|
13
15
|
await intro('buddy version')
|
|
14
16
|
|
|
15
17
|
const pkg = await storage.readPackageJson('./package.json')
|
|
@@ -21,4 +23,9 @@ export function version(buddy: CLI) {
|
|
|
21
23
|
|
|
22
24
|
// redis (or other cache/s), mysql (or other database/s),
|
|
23
25
|
})
|
|
26
|
+
|
|
27
|
+
buddy.on('version:*', () => {
|
|
28
|
+
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
29
|
+
process.exit(1)
|
|
30
|
+
})
|
|
24
31
|
}
|
package/src/commands/example.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { ExitCode } from '@stacksjs/types'
|
|
3
|
-
import type { CLI, ExamplesOptions } from '@stacksjs/types'
|
|
4
|
-
import { runExample } from '@stacksjs/actions'
|
|
5
|
-
|
|
6
|
-
export function example(buddy: CLI) {
|
|
7
|
-
const descriptions = {
|
|
8
|
-
example: 'Which example do you want to see?',
|
|
9
|
-
components: 'Test your libraries against your built bundle',
|
|
10
|
-
vue: 'Test your Vue component library',
|
|
11
|
-
webComponents: 'Test your web component library',
|
|
12
|
-
select: 'Which example are you trying to view?',
|
|
13
|
-
project: 'Target a specific project',
|
|
14
|
-
verbose: 'Enable verbose output',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
buddy
|
|
18
|
-
.command('example', descriptions.example)
|
|
19
|
-
.option('-c, --components', descriptions.components)
|
|
20
|
-
.option('-v, --vue', descriptions.vue)
|
|
21
|
-
.option('-w, --web-components', descriptions.webComponents)
|
|
22
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
23
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
24
|
-
.action(async (options: ExamplesOptions) => {
|
|
25
|
-
// const answer = await prompt.require()
|
|
26
|
-
// .select(descriptions.select, {
|
|
27
|
-
// options: [
|
|
28
|
-
// { value: 'components', label: 'Vue Components' },
|
|
29
|
-
// { value: 'web-components', label: 'Web Components' },
|
|
30
|
-
// ],
|
|
31
|
-
// })
|
|
32
|
-
|
|
33
|
-
// if (answer === 'components')
|
|
34
|
-
// await componentExample(options)
|
|
35
|
-
// else if (answer === 'web-components')
|
|
36
|
-
// await webComponentExample(options)
|
|
37
|
-
// else process.exit(ExitCode.InvalidArgument)
|
|
38
|
-
|
|
39
|
-
await runExample(options)
|
|
40
|
-
process.exit(ExitCode.Success)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
buddy
|
|
44
|
-
.command('example:vue', descriptions.vue)
|
|
45
|
-
.option('-v, --vue', descriptions.verbose, { default: true })
|
|
46
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
47
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
48
|
-
.alias('example:components')
|
|
49
|
-
.action(async (options: ExamplesOptions) => {
|
|
50
|
-
await runExample(options)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
buddy
|
|
54
|
-
.command('example:web-components', 'Test your Web Component library.')
|
|
55
|
-
.option('-w, --web-components', descriptions.verbose, { default: true })
|
|
56
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
57
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
58
|
-
.action(async (options: ExamplesOptions) => {
|
|
59
|
-
await runExample(options)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
buddy.on('example:*', () => {
|
|
63
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
64
|
-
process.exit(1)
|
|
65
|
-
})
|
|
66
|
-
}
|
package/src/commands/inspire.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { ExitCode } from '@stacksjs/types'
|
|
3
|
-
import type { CLI } from '@stacksjs/types'
|
|
4
|
-
import { runAction } from '@stacksjs/actions'
|
|
5
|
-
import { intro, outro } from '@stacksjs/cli'
|
|
6
|
-
import { Action } from '@stacksjs/enums'
|
|
7
|
-
|
|
8
|
-
export function inspire(buddy: CLI) {
|
|
9
|
-
buddy
|
|
10
|
-
.command('inspire', 'Inspire yourself with a random quote')
|
|
11
|
-
.option('--two', 'Show two quotes', { default: false })
|
|
12
|
-
.action(async () => {
|
|
13
|
-
const perf = await intro('buddy inspire')
|
|
14
|
-
const result = await runAction(Action.Inspire)
|
|
15
|
-
|
|
16
|
-
if (result.isErr()) {
|
|
17
|
-
await outro('While running the inspire command, there was an issue', { startTime: perf, useSeconds: true }, result.error)
|
|
18
|
-
process.exit()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await outro('Your quote is: ...', { startTime: perf, useSeconds: true })
|
|
22
|
-
process.exit(ExitCode.Success)
|
|
23
|
-
})
|
|
24
|
-
}
|