@stacksjs/buddy 0.58.58 → 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/dist/index.js
CHANGED
|
@@ -11,11 +11,9 @@ deploy,
|
|
|
11
11
|
dev,
|
|
12
12
|
dns,
|
|
13
13
|
domains,
|
|
14
|
-
example,
|
|
15
14
|
fresh,
|
|
16
15
|
generate,
|
|
17
16
|
http,
|
|
18
|
-
inspire,
|
|
19
17
|
install,
|
|
20
18
|
key,
|
|
21
19
|
lint,
|
|
@@ -33,8 +31,9 @@ tinker,
|
|
|
33
31
|
types,
|
|
34
32
|
upgrade,
|
|
35
33
|
version
|
|
36
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7b24d1e3e585766e.js";
|
|
37
35
|
import"./chunk-0455e53fab4244b1.js";
|
|
36
|
+
import"./chunk-59a9de11428ba763.js";
|
|
38
37
|
export {
|
|
39
38
|
version,
|
|
40
39
|
upgrade,
|
|
@@ -53,11 +52,9 @@ export {
|
|
|
53
52
|
lint,
|
|
54
53
|
key,
|
|
55
54
|
install,
|
|
56
|
-
inspire,
|
|
57
55
|
http,
|
|
58
56
|
generate,
|
|
59
57
|
fresh,
|
|
60
|
-
example,
|
|
61
58
|
domains,
|
|
62
59
|
dns,
|
|
63
60
|
dev,
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import { handleError } from '@stacksjs/error-handling'
|
|
3
|
-
import {
|
|
3
|
+
import { CAC } from 'cac'
|
|
4
4
|
import { ensureProjectIsInitialized } from '@stacksjs/utils'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { log } from '@stacksjs/cli'
|
|
6
|
+
import { collect } from '@stacksjs/collections'
|
|
7
7
|
import * as cmd from './commands'
|
|
8
8
|
|
|
9
9
|
// setup global error handlers
|
|
10
|
-
process.on('uncaughtException',
|
|
11
|
-
|
|
10
|
+
process.on('uncaughtException', (error: Error) => {
|
|
11
|
+
console.error('An error occurred:', error.message)
|
|
12
|
+
// handleError(error)
|
|
13
|
+
process.exit(1)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
process.on('uncaughtException', (error: Error) => {
|
|
17
|
+
console.error('An error occurred:', error.message)
|
|
18
|
+
handleError(error)
|
|
19
|
+
process.exit(1)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
// process.on('unhandledRejection', errorHandler)
|
|
23
|
+
|
|
24
|
+
// function errorHandler(error: Error) {
|
|
25
|
+
// console.error('An error occurred:', error.message)
|
|
26
|
+
// log.error(error.message)
|
|
27
|
+
// process.exit(1)
|
|
28
|
+
// }
|
|
12
29
|
|
|
13
30
|
async function main() {
|
|
14
|
-
const buddy = cli('buddy')
|
|
31
|
+
// const buddy = cli('buddy')
|
|
32
|
+
const buddy = new CAC('buddy')
|
|
15
33
|
|
|
16
34
|
// the following commands are not dependent on the project being initialized
|
|
17
35
|
cmd.setup(buddy)
|
|
@@ -47,23 +65,79 @@ async function main() {
|
|
|
47
65
|
// cmd.prepublish(buddy)
|
|
48
66
|
cmd.upgrade(buddy)
|
|
49
67
|
|
|
68
|
+
const quotes = collect([
|
|
69
|
+
'The best way to get started is to quit talking and begin doing.',
|
|
70
|
+
'The pessimist sees difficulty in every opportunity. The optimist sees opportunity in every difficulty.',
|
|
71
|
+
'Don’t let yesterday take up too much of today.',
|
|
72
|
+
'You learn more from failure than from success. Don’t let it stop you. Failure builds character.',
|
|
73
|
+
'It’s not whether you get knocked down, it’s whether you get up.',
|
|
74
|
+
'If you are working on something that you really care about, you don’t have to be pushed. The vision pulls you.',
|
|
75
|
+
'People who are crazy enough to think they can change the world, are the ones who do.',
|
|
76
|
+
'Failure will never overtake me if my determination to succeed is strong enough.',
|
|
77
|
+
'Entrepreneurs are great at dealing with uncertainty and also very good at minimizing risk. That’s the classic entrepreneur.',
|
|
78
|
+
'We may encounter many defeats but we must not be defeated.',
|
|
79
|
+
'Knowing is not enough; we must apply. Wishing is not enough; we must do.',
|
|
80
|
+
'Imagine your life is perfect in every respect; what would it look like?',
|
|
81
|
+
'We generate fears while we sit. We overcome them by action.',
|
|
82
|
+
'Whether you think you can or think you can’t, you’re right.',
|
|
83
|
+
'Security is mostly a superstition. Life is either a daring adventure or nothing.',
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
buddy
|
|
87
|
+
.command('inspire', 'Inspire yourself with a random quote')
|
|
88
|
+
.alias('insp')
|
|
89
|
+
.action(() => {
|
|
90
|
+
log.info(quotes.random())
|
|
91
|
+
log.success('Have a great dayss!')
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
buddy.on('inspire:*', () => {
|
|
95
|
+
// eslint-disable-next-line no-console
|
|
96
|
+
console.log('Invalid command:', buddy.args.join(' '))
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
98
|
+
console.log('See `--help` for a list of available commands')
|
|
99
|
+
throw new Error('Invalid command')
|
|
100
|
+
})
|
|
101
|
+
|
|
50
102
|
// dynamically import and register commands from ./app/Commands/*
|
|
51
|
-
const commandsDir = p.appPath('Commands')
|
|
52
|
-
const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
|
|
103
|
+
// const commandsDir = p.appPath('Commands')
|
|
104
|
+
// const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
|
|
105
|
+
|
|
106
|
+
// for (const file of commandFiles) {
|
|
107
|
+
// const commandPath = `${commandsDir}/${file}`
|
|
108
|
+
// const dynamicImport = await import(commandPath)
|
|
109
|
+
|
|
110
|
+
// // Correctly use the default export function
|
|
111
|
+
// if (typeof dynamicImport.default === 'function')
|
|
112
|
+
// dynamicImport.default(buddy)
|
|
113
|
+
// else
|
|
114
|
+
// console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
|
|
115
|
+
// }
|
|
116
|
+
|
|
117
|
+
// const listenerImport = await import(p.listenersPath('Console.ts'))
|
|
118
|
+
// if (typeof listenerImport.default === 'function')
|
|
119
|
+
// listenerImport.default(buddy)
|
|
53
120
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
121
|
+
// buddy.on('inspire:two', () => {
|
|
122
|
+
// // eslint-disable-next-line no-console
|
|
123
|
+
// console.log('inspiring with two quotes')
|
|
124
|
+
// // Do something
|
|
125
|
+
// })
|
|
57
126
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
127
|
+
// buddy.on('changelog:*', () => {
|
|
128
|
+
// // eslint-disable-next-line no-console
|
|
129
|
+
// console.log('changelog with two quotes')
|
|
130
|
+
// process.exit(1)
|
|
131
|
+
// // Do something
|
|
132
|
+
// })
|
|
64
133
|
|
|
134
|
+
// console.log('buddy', buddy)
|
|
135
|
+
// console.log('buddy running')
|
|
65
136
|
buddy.help()
|
|
66
137
|
buddy.parse()
|
|
138
|
+
// console.log('process.argv', process.argv)
|
|
139
|
+
// console.log('b.rawArgs', buddy.rawArgs)
|
|
140
|
+
// await buddy.runMatchedCommand()
|
|
67
141
|
}
|
|
68
142
|
|
|
69
143
|
await main()
|
package/src/commands/add.ts
CHANGED
|
@@ -2,6 +2,7 @@ import process from 'node:process'
|
|
|
2
2
|
import type { AddOptions, BuildOptions, CLI } from '@stacksjs/types'
|
|
3
3
|
import { ExitCode } from '@stacksjs/types'
|
|
4
4
|
import { runAdd } from '@stacksjs/actions'
|
|
5
|
+
import { log } from 'stacks/logging'
|
|
5
6
|
|
|
6
7
|
export function add(buddy: CLI) {
|
|
7
8
|
const descriptions = {
|
|
@@ -22,6 +23,8 @@ export function add(buddy: CLI) {
|
|
|
22
23
|
.option('-p, --project', descriptions.project, { default: false })
|
|
23
24
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
24
25
|
.action(async (options: BuildOptions) => {
|
|
26
|
+
log.debug('Running `buddy add`...', options)
|
|
27
|
+
|
|
25
28
|
if (hasNoOptions(options)) {
|
|
26
29
|
// const answers = await log.prompt(descriptions.select, {
|
|
27
30
|
// type: 'multiselect',
|
package/src/commands/build.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import { runAction } from '@stacksjs/actions'
|
|
3
|
-
import { intro, log, outro
|
|
3
|
+
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
4
|
import type { BuildOptions, CLI } from '@stacksjs/types'
|
|
5
5
|
import { ExitCode } from '@stacksjs/types'
|
|
6
6
|
import { Action } from '@stacksjs/enums'
|
|
7
|
-
import { isString } from '@stacksjs/validation'
|
|
8
7
|
|
|
9
8
|
export function build(buddy: CLI) {
|
|
10
9
|
const descriptions = {
|
|
@@ -41,6 +40,8 @@ export function build(buddy: CLI) {
|
|
|
41
40
|
.option('--server', descriptions.server, { default: false })
|
|
42
41
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
43
42
|
.action(async (server: string | undefined, options: BuildOptions) => {
|
|
43
|
+
log.debug('Running `buddy build` ...', options)
|
|
44
|
+
|
|
44
45
|
switch (server) {
|
|
45
46
|
case 'components':
|
|
46
47
|
options.components = true
|
|
@@ -76,28 +77,29 @@ export function build(buddy: CLI) {
|
|
|
76
77
|
break
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
80
|
+
// TODO: uncomment this when prompt is available
|
|
81
|
+
// if (hasNoOptions(options)) {
|
|
82
|
+
// let answers = await 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
|
+
// })
|
|
93
|
+
//
|
|
94
|
+
// if (answers !== null)
|
|
95
|
+
// process.exit(ExitCode.InvalidArgument)
|
|
96
|
+
//
|
|
97
|
+
// if (isString(answers))
|
|
98
|
+
// answers = [answers]
|
|
99
|
+
//
|
|
100
|
+
// // creates an object out of array and sets answers to true
|
|
101
|
+
// options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
|
|
102
|
+
// }
|
|
101
103
|
|
|
102
104
|
await runAction(Action.BuildStacks, options)
|
|
103
105
|
|
|
@@ -111,6 +113,7 @@ export function build(buddy: CLI) {
|
|
|
111
113
|
.option('-p, --project', descriptions.project, { default: false })
|
|
112
114
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
113
115
|
.action(async (options: BuildOptions) => {
|
|
116
|
+
log.debug('Running `buddy build:components` ...', options)
|
|
114
117
|
await runAction(Action.BuildComponentLibs, options)
|
|
115
118
|
})
|
|
116
119
|
|
|
@@ -121,6 +124,7 @@ export function build(buddy: CLI) {
|
|
|
121
124
|
.option('-p, --project', descriptions.project, { default: false })
|
|
122
125
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
123
126
|
.action(async (options: BuildOptions) => {
|
|
127
|
+
log.debug('Running `buddy build:cli` ...', options)
|
|
124
128
|
await runAction(Action.BuildCli, options)
|
|
125
129
|
})
|
|
126
130
|
|
|
@@ -131,6 +135,7 @@ export function build(buddy: CLI) {
|
|
|
131
135
|
.option('-p, --project', descriptions.project, { default: false })
|
|
132
136
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
133
137
|
.action(async (options: BuildOptions) => {
|
|
138
|
+
log.debug('Running `buddy build:server` ...', options)
|
|
134
139
|
await runAction(Action.BuildServer, options)
|
|
135
140
|
})
|
|
136
141
|
|
|
@@ -140,6 +145,7 @@ export function build(buddy: CLI) {
|
|
|
140
145
|
.option('-p, --project', descriptions.project, { default: false })
|
|
141
146
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
142
147
|
.action(async (options: BuildOptions) => {
|
|
148
|
+
log.debug('Running `buddy `build:functions` ...', options)
|
|
143
149
|
await runAction(Action.BuildFunctionLib, options)
|
|
144
150
|
})
|
|
145
151
|
|
|
@@ -153,6 +159,7 @@ export function build(buddy: CLI) {
|
|
|
153
159
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
154
160
|
.alias('build:vue')
|
|
155
161
|
.action(async (options: BuildOptions) => {
|
|
162
|
+
log.debug('Running `buddy build:vue-components` ...', options)
|
|
156
163
|
await runAction(Action.BuildVueComponentLib, options)
|
|
157
164
|
})
|
|
158
165
|
|
|
@@ -165,6 +172,7 @@ export function build(buddy: CLI) {
|
|
|
165
172
|
.option('-p, --project', descriptions.project, { default: false })
|
|
166
173
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
167
174
|
.action(async (options: BuildOptions) => {
|
|
175
|
+
log.debug('Running `buddy build:web-components` ...', options)
|
|
168
176
|
await runAction(Action.BuildWebComponentLib, options)
|
|
169
177
|
})
|
|
170
178
|
|
|
@@ -177,6 +185,7 @@ export function build(buddy: CLI) {
|
|
|
177
185
|
.option('-p, --project', descriptions.project, { default: false })
|
|
178
186
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
179
187
|
.action(async (options: BuildOptions) => {
|
|
188
|
+
log.debug('Running `buddy build:docs` ...', options)
|
|
180
189
|
await runAction(Action.BuildDocs, options)
|
|
181
190
|
})
|
|
182
191
|
|
|
@@ -185,6 +194,8 @@ export function build(buddy: CLI) {
|
|
|
185
194
|
.option('-p, --project', descriptions.project, { default: false })
|
|
186
195
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
187
196
|
.action(async (options: BuildOptions) => {
|
|
197
|
+
log.debug('Running `buddy build:core` ...', options)
|
|
198
|
+
|
|
188
199
|
const startTime = await intro('buddy build:core')
|
|
189
200
|
const result = await runAction(Action.BuildCore, options)
|
|
190
201
|
|
|
@@ -202,6 +213,8 @@ export function build(buddy: CLI) {
|
|
|
202
213
|
.option('-p, --project', descriptions.project, { default: false })
|
|
203
214
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
204
215
|
.action(async (options: BuildOptions) => {
|
|
216
|
+
log.debug('Running `buddy build:desktop` ...', options)
|
|
217
|
+
|
|
205
218
|
const perf = await intro('buddy build:desktop')
|
|
206
219
|
const result = await runAction(Action.BuildDesktop, options)
|
|
207
220
|
|
|
@@ -222,6 +235,8 @@ export function build(buddy: CLI) {
|
|
|
222
235
|
.option('-p, --project', descriptions.project, { default: false })
|
|
223
236
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
224
237
|
.action(async (options: BuildOptions) => {
|
|
238
|
+
log.debug('Running `buddy build:stacks` ...', options)
|
|
239
|
+
|
|
225
240
|
const startTime = await intro('buddy build:stacks')
|
|
226
241
|
const result = await runAction(Action.BuildStacks, options)
|
|
227
242
|
|
|
@@ -239,6 +254,6 @@ export function build(buddy: CLI) {
|
|
|
239
254
|
})
|
|
240
255
|
}
|
|
241
256
|
|
|
242
|
-
function hasNoOptions(options: BuildOptions) {
|
|
243
|
-
|
|
244
|
-
}
|
|
257
|
+
// function hasNoOptions(options: BuildOptions) {
|
|
258
|
+
// return !options.components && !options.vueComponents && !options.webComponents && !options.elements && !options.functions && !options.views && !options.docs && !options.stacks && !options.buddy
|
|
259
|
+
// }
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import type { CLI, FreshOptions } from '@stacksjs/types'
|
|
3
|
-
import { ExitCode } from '@stacksjs/types'
|
|
4
3
|
import { runAction } from '@stacksjs/actions'
|
|
5
|
-
import { intro, outro } from '@stacksjs/cli'
|
|
4
|
+
import { intro, log, outro } from '@stacksjs/cli'
|
|
6
5
|
import { Action } from '@stacksjs/enums'
|
|
7
6
|
|
|
8
7
|
export function changelog(buddy: CLI) {
|
|
9
8
|
const descriptions = {
|
|
10
9
|
changelog: 'Create a CHANGELOG.md file',
|
|
11
10
|
quiet: 'Minimal output',
|
|
11
|
+
dryRun: 'Do not write the file, just output the changes',
|
|
12
12
|
project: 'Target a specific project',
|
|
13
13
|
verbose: 'Enable verbose output',
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
// console.log('changelog', descriptions.changelog)
|
|
17
|
+
|
|
16
18
|
buddy
|
|
17
19
|
.command('changelog', descriptions.changelog)
|
|
18
|
-
.option('--quiet', descriptions.quiet, { default: false })
|
|
20
|
+
.option('-q, --quiet', descriptions.quiet, { default: false })
|
|
21
|
+
.option('-d, --dry-run', descriptions.dryRun, { default: false })
|
|
19
22
|
.option('-p, --project', descriptions.project, { default: false })
|
|
20
23
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
21
24
|
.action(async (options: FreshOptions) => {
|
|
25
|
+
log.debug('Running `buddy changelog` ...', options)
|
|
26
|
+
|
|
22
27
|
const perf = await intro('buddy changelog')
|
|
23
28
|
const result = await runAction(Action.Changelog, options)
|
|
24
29
|
|
|
@@ -27,12 +32,14 @@ export function changelog(buddy: CLI) {
|
|
|
27
32
|
process.exit()
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
await outro('Generated
|
|
31
|
-
process.exit(ExitCode.Success)
|
|
35
|
+
await outro('Generated CHANGELOG.md', { ...options, startTime: perf, useSeconds: true, type: 'success' })
|
|
32
36
|
})
|
|
33
37
|
|
|
34
38
|
buddy.on('changelog:*', () => {
|
|
35
|
-
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.log('Invalid command: %s', buddy.args.join(' '))
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
console.log('See --help for a list of available commands.')
|
|
36
43
|
process.exit(1)
|
|
37
44
|
})
|
|
38
45
|
}
|
package/src/commands/clean.ts
CHANGED
|
@@ -2,7 +2,7 @@ import process from 'node:process'
|
|
|
2
2
|
import { ExitCode } from '@stacksjs/types'
|
|
3
3
|
import type { CLI, CleanOptions } 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 clean(buddy: CLI) {
|
|
@@ -17,6 +17,8 @@ export function clean(buddy: CLI) {
|
|
|
17
17
|
.option('-p, --project', descriptions.project, { default: false })
|
|
18
18
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
19
19
|
.action(async (options: CleanOptions) => {
|
|
20
|
+
log.debug('Running `buddy clean` ...', options)
|
|
21
|
+
|
|
20
22
|
const perf = await intro('buddy clean')
|
|
21
23
|
const result = await runAction(Action.Clean, options)
|
|
22
24
|
|
package/src/commands/cloud.ts
CHANGED
|
@@ -25,6 +25,8 @@ export function cloud(buddy: CLI) {
|
|
|
25
25
|
.option('-p, --project', descriptions.project, { default: false })
|
|
26
26
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
27
27
|
.action(async (options: CloudCliOptions) => {
|
|
28
|
+
log.debug('Running `buddy cloud` ...', options)
|
|
29
|
+
|
|
28
30
|
if (options.ssh || options.connect) {
|
|
29
31
|
const startTime = performance.now()
|
|
30
32
|
const jumpBoxId = await getJumpBoxInstanceId()
|
|
@@ -53,6 +55,8 @@ export function cloud(buddy: CLI) {
|
|
|
53
55
|
.option('-p, --project', descriptions.project, { default: false })
|
|
54
56
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
55
57
|
.action(async (options: CloudCliOptions) => {
|
|
58
|
+
log.debug('Running `buddy cloud:add` ...', options)
|
|
59
|
+
|
|
56
60
|
const startTime = await intro('buddy cloud:add')
|
|
57
61
|
|
|
58
62
|
if (options.jumpBox) {
|
|
@@ -101,6 +105,8 @@ export function cloud(buddy: CLI) {
|
|
|
101
105
|
.option('-p, --project', descriptions.project, { default: false })
|
|
102
106
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
103
107
|
.action(async (options: CloudCliOptions) => {
|
|
108
|
+
log.debug('Running `buddy cloud:remove` ...', options)
|
|
109
|
+
|
|
104
110
|
const startTime = await intro('buddy cloud:remove')
|
|
105
111
|
|
|
106
112
|
if (options.jumpBox) {
|
|
@@ -183,7 +189,9 @@ export function cloud(buddy: CLI) {
|
|
|
183
189
|
.option('-p, --project', descriptions.project, { default: false })
|
|
184
190
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
185
191
|
.action(async (options: CloudCliOptions) => {
|
|
186
|
-
|
|
192
|
+
log.debug('Running `buddy cloud:optimize-cost` ...', options)
|
|
193
|
+
|
|
194
|
+
const startTime = await intro('buddy cloud:optimize-cost')
|
|
187
195
|
|
|
188
196
|
if (options.jumpBox) {
|
|
189
197
|
const { confirm } = await prompts({
|
|
@@ -197,6 +205,8 @@ export function cloud(buddy: CLI) {
|
|
|
197
205
|
process.exit(ExitCode.Success)
|
|
198
206
|
}
|
|
199
207
|
|
|
208
|
+
// at the moment, the jump-box is the only resource that is removed to optimize costs
|
|
209
|
+
// because it can be re-applied at any later time
|
|
200
210
|
await deleteJumpBox()
|
|
201
211
|
|
|
202
212
|
await outro('Your jump-box was removed & cost optimizations are applied.', { startTime, useSeconds: true })
|
|
@@ -212,7 +222,9 @@ export function cloud(buddy: CLI) {
|
|
|
212
222
|
.alias('cloud:clean-up')
|
|
213
223
|
.option('-p, --project', descriptions.project, { default: false })
|
|
214
224
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
215
|
-
.action(async () => {
|
|
225
|
+
.action(async (options: CloudCliOptions) => {
|
|
226
|
+
log.debug('Running `buddy cloud:cleanup` ...', options)
|
|
227
|
+
|
|
216
228
|
const startTime = await intro('buddy cloud:cleanup')
|
|
217
229
|
|
|
218
230
|
log.info(`Cleaning up your cloud resources will take a while to complete. Please be patient.`)
|
package/src/commands/commit.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import type { CLI, FreshOptions } from '@stacksjs/types'
|
|
3
3
|
import { runCommit } from '@stacksjs/actions'
|
|
4
|
+
import { log } from 'stacks/logging'
|
|
4
5
|
|
|
5
6
|
export function commit(buddy: CLI) {
|
|
6
7
|
const descriptions = {
|
|
@@ -14,6 +15,7 @@ export function commit(buddy: CLI) {
|
|
|
14
15
|
.option('-p, --project', descriptions.project, { default: false })
|
|
15
16
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
16
17
|
.action(async (options: FreshOptions) => {
|
|
18
|
+
log.debug('Running `buddy commit` ...', options)
|
|
17
19
|
await runCommit(options)
|
|
18
20
|
})
|
|
19
21
|
|
|
@@ -19,6 +19,8 @@ export function configure(buddy: CLI) {
|
|
|
19
19
|
.option('-p, --project', descriptions.project, { default: false })
|
|
20
20
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
21
21
|
.action(async (options?: ConfigureOptions) => {
|
|
22
|
+
log.debug('Running `buddy configure` ...', options)
|
|
23
|
+
|
|
22
24
|
if (options?.aws) {
|
|
23
25
|
await configureAws(options)
|
|
24
26
|
process.exit(ExitCode.Success)
|
|
@@ -39,6 +41,7 @@ export function configure(buddy: CLI) {
|
|
|
39
41
|
.option('--output', 'The AWS output format')
|
|
40
42
|
.option('--quiet', 'Suppress output')
|
|
41
43
|
.action(async (options?: ConfigureOptions) => {
|
|
44
|
+
log.debug('Running `buddy configure:aws` ...', options)
|
|
42
45
|
await configureAws(options)
|
|
43
46
|
process.exit(ExitCode.Success)
|
|
44
47
|
})
|
|
@@ -49,7 +52,7 @@ export function configure(buddy: CLI) {
|
|
|
49
52
|
})
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
async function configureAws(options
|
|
55
|
+
async function configureAws(options?: ConfigureOptions) {
|
|
53
56
|
const startTime = performance.now()
|
|
54
57
|
|
|
55
58
|
const awsAccessKeyId = options?.accessKeyId ?? process.env.AWS_ACCESS_KEY_ID
|
|
@@ -57,7 +60,7 @@ async function configureAws(options: ConfigureOptions) {
|
|
|
57
60
|
const defaultRegion = 'us-east-1' // we only support `us-east-1` for now
|
|
58
61
|
const defaultOutputFormat = options?.output ?? 'json'
|
|
59
62
|
|
|
60
|
-
const command = `aws configure --profile ${options
|
|
63
|
+
const command = `aws configure --profile ${options?.profile ?? process.env.AWS_PROFILE}`
|
|
61
64
|
const input = `${awsAccessKeyId}\n${awsSecretAccessKey}\n${defaultRegion}\n${defaultOutputFormat}\n`
|
|
62
65
|
|
|
63
66
|
const result = await runCommand(command, {
|
|
@@ -72,7 +75,7 @@ async function configureAws(options: ConfigureOptions) {
|
|
|
72
75
|
process.exit(ExitCode.FatalError)
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
if (options
|
|
78
|
+
if (options?.quiet)
|
|
76
79
|
return
|
|
77
80
|
|
|
78
81
|
await outro('Exited', { startTime, useSeconds: true })
|
package/src/commands/create.ts
CHANGED
|
@@ -37,6 +37,8 @@ export function create(buddy: CLI) {
|
|
|
37
37
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
38
38
|
// .option('--auth', 'Scaffold an authentication?', { default: true })
|
|
39
39
|
.action(async (options: CreateOptions) => {
|
|
40
|
+
log.debug('Running `buddy new <name>` ...', options)
|
|
41
|
+
|
|
40
42
|
const startTime = await intro('stacks new')
|
|
41
43
|
const name = options.name
|
|
42
44
|
const path = resolve(process.cwd(), name)
|
|
@@ -45,7 +47,7 @@ export function create(buddy: CLI) {
|
|
|
45
47
|
onlineCheck()
|
|
46
48
|
const result = await download(name, path, options)
|
|
47
49
|
|
|
48
|
-
if (result
|
|
50
|
+
if (result.isErr()) {
|
|
49
51
|
log.error(result.error)
|
|
50
52
|
process.exit(ExitCode.FatalError)
|
|
51
53
|
}
|
package/src/commands/deploy.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { addDomain, hasUserDomainBeenAddedToCloud } from '@stacksjs/dns'
|
|
|
10
10
|
|
|
11
11
|
export function deploy(buddy: CLI) {
|
|
12
12
|
const descriptions = {
|
|
13
|
-
deploy: '
|
|
13
|
+
deploy: 'Re-installs your npm dependencies',
|
|
14
14
|
project: 'Target a specific project',
|
|
15
15
|
verbose: 'Enable verbose output',
|
|
16
16
|
}
|
|
@@ -21,6 +21,8 @@ export function deploy(buddy: CLI) {
|
|
|
21
21
|
.option('-p, --project', descriptions.project, { default: false })
|
|
22
22
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
23
23
|
.action(async (options: DeployOptions) => {
|
|
24
|
+
log.debug('Running `buddy deploy` ...', options)
|
|
25
|
+
|
|
24
26
|
const startTime = await intro('buddy deploy')
|
|
25
27
|
const domain = options.domain || app.url
|
|
26
28
|
|