@stacksjs/buddy 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.
- package/README.md +0 -1
- package/dist/chunk-b0df37cbea681adc.js +2223 -0
- package/dist/{chunk-d2428b387d843985.js → chunk-eb51d49adb5b5f07.js} +478 -247
- package/dist/cli.js +13 -4
- package/dist/index.js +1 -1
- package/dist/stacks +0 -0
- package/package.json +1 -1
- package/src/cli.ts +17 -13
- package/src/commands/add.ts +5 -6
- package/src/commands/build.ts +55 -34
- package/src/commands/changelog.ts +13 -6
- package/src/commands/clean.ts +13 -5
- package/src/commands/cloud.ts +91 -30
- package/src/commands/commit.ts +2 -2
- package/src/commands/configure.ts +7 -7
- package/src/commands/create.ts +14 -10
- package/src/commands/deploy.ts +15 -10
- package/src/commands/dev.ts +53 -53
- package/src/commands/dns.ts +5 -5
- package/src/commands/domains.ts +132 -41
- package/src/commands/fresh.ts +16 -6
- package/src/commands/generate.ts +14 -16
- package/src/commands/http.ts +2 -2
- package/src/commands/install.ts +2 -2
- package/src/commands/key.ts +3 -3
- package/src/commands/lint.ts +4 -4
- package/src/commands/list.ts +3 -4
- package/src/commands/make.ts +101 -65
- package/src/commands/migrate.ts +52 -9
- package/src/commands/ports.ts +35 -37
- package/src/commands/prepublish.ts +3 -3
- package/src/commands/projects.ts +5 -11
- package/src/commands/release.ts +8 -6
- package/src/commands/seed.ts +12 -5
- package/src/commands/setup.ts +10 -11
- package/src/commands/test.ts +97 -30
- package/src/commands/tinker.ts +10 -6
- package/src/commands/types.ts +3 -3
- package/src/commands/upgrade.ts +49 -29
- package/src/commands/version.ts +11 -13
- package/src/custom-cli.ts +5 -7
- package/dist/cli.d.ts +0 -1
- package/dist/commands/build.d.ts +0 -2
- package/dist/commands/changelog.d.ts +0 -2
- package/dist/commands/clean.d.ts +0 -2
- package/dist/commands/cloud.d.ts +0 -2
- package/dist/commands/commit.d.ts +0 -2
- package/dist/commands/configure.d.ts +0 -2
- package/dist/commands/create.d.ts +0 -2
- package/dist/commands/deploy.d.ts +0 -2
- package/dist/commands/dev.d.ts +0 -3
- package/dist/commands/dns.d.ts +0 -2
- package/dist/commands/domains.d.ts +0 -2
- package/dist/commands/fresh.d.ts +0 -2
- package/dist/commands/generate.d.ts +0 -2
- package/dist/commands/http.d.ts +0 -2
- package/dist/commands/index.d.ts +0 -31
- package/dist/commands/install.d.ts +0 -2
- package/dist/commands/key.d.ts +0 -2
- package/dist/commands/lint.d.ts +0 -2
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/make.d.ts +0 -2
- package/dist/commands/migrate.d.ts +0 -2
- package/dist/commands/ports.d.ts +0 -2
- package/dist/commands/prepublish.d.ts +0 -2
- package/dist/commands/projects.d.ts +0 -2
- package/dist/commands/release.d.ts +0 -2
- package/dist/commands/seed.d.ts +0 -2
- package/dist/commands/setup.d.ts +0 -4
- package/dist/commands/test.d.ts +0 -2
- package/dist/commands/tinker.d.ts +0 -2
- package/dist/commands/types.d.ts +0 -2
- package/dist/commands/upgrade.d.ts +0 -2
- package/dist/commands/version.d.ts +0 -2
- package/dist/index.d.ts +0 -1
package/src/commands/http.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import { config } from '@stacksjs/config'
|
|
2
3
|
import { ExitCode } from '@stacksjs/types'
|
|
3
4
|
import type { CLI } from '@stacksjs/types'
|
|
4
|
-
import { config } from '@stacksjs/config'
|
|
5
5
|
|
|
6
6
|
// import { path } from '@stacksjs/path'
|
|
7
7
|
import { log, runCommandSync } from '@stacksjs/cli'
|
|
@@ -36,7 +36,7 @@ export function http(buddy: CLI) {
|
|
|
36
36
|
|
|
37
37
|
buddy
|
|
38
38
|
.command('http [domain]', descriptions.http)
|
|
39
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
39
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
40
40
|
// .option('--verbose', descriptions.verbose, { default: false })
|
|
41
41
|
.action(async (domain: string | undefined, options: HttpOptions) => {
|
|
42
42
|
log.debug('Running `buddy http [domain]` ...', options)
|
package/src/commands/install.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import type { CLI, InstallOptions } from '@stacksjs/types'
|
|
3
2
|
import { log, runCommand } from '@stacksjs/cli'
|
|
4
3
|
import { path as p } from '@stacksjs/path'
|
|
4
|
+
import type { CLI, InstallOptions } from '@stacksjs/types'
|
|
5
5
|
|
|
6
6
|
export function install(buddy: CLI) {
|
|
7
7
|
const descriptions = {
|
|
@@ -12,7 +12,7 @@ export function install(buddy: CLI) {
|
|
|
12
12
|
|
|
13
13
|
buddy
|
|
14
14
|
.command('install', descriptions.install)
|
|
15
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
15
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
16
16
|
.option('-v, --verbose', descriptions.verbose, { default: false })
|
|
17
17
|
.action(async (options: InstallOptions) => {
|
|
18
18
|
log.debug('Running `buddy install` ...', options)
|
package/src/commands/key.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import type { CLI, KeyOptions } from '@stacksjs/types'
|
|
3
|
-
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
2
|
import { runAction } from '@stacksjs/actions'
|
|
3
|
+
import { intro, log, outro } from '@stacksjs/cli'
|
|
5
4
|
import { Action } from '@stacksjs/enums'
|
|
5
|
+
import type { CLI, KeyOptions } from '@stacksjs/types'
|
|
6
6
|
|
|
7
7
|
export function key(buddy: CLI) {
|
|
8
8
|
const descriptions = {
|
|
@@ -13,7 +13,7 @@ export function key(buddy: CLI) {
|
|
|
13
13
|
|
|
14
14
|
buddy
|
|
15
15
|
.command('key:generate', descriptions.command)
|
|
16
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
16
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
17
17
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
18
18
|
.action(async (options: KeyOptions) => {
|
|
19
19
|
log.debug('Running `buddy key:generate` ...', options)
|
package/src/commands/lint.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import
|
|
2
|
+
import { runAction } from '@stacksjs/actions'
|
|
3
3
|
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
4
|
import { Action } from '@stacksjs/enums'
|
|
5
|
-
import {
|
|
5
|
+
import type { CLI, LintOptions } from '@stacksjs/types'
|
|
6
6
|
|
|
7
7
|
export function lint(buddy: CLI) {
|
|
8
8
|
const descriptions = {
|
|
@@ -15,7 +15,7 @@ export function lint(buddy: CLI) {
|
|
|
15
15
|
buddy
|
|
16
16
|
.command('lint', descriptions.lint)
|
|
17
17
|
.option('-f, --fix', descriptions.lintFix, { default: false })
|
|
18
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
18
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
19
19
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
20
20
|
.action(async (options: LintOptions) => {
|
|
21
21
|
log.debug('Running `buddy lint` ...', options)
|
|
@@ -34,7 +34,7 @@ export function lint(buddy: CLI) {
|
|
|
34
34
|
|
|
35
35
|
buddy
|
|
36
36
|
.command('lint:fix', descriptions.lintFix)
|
|
37
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
37
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
38
38
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
39
39
|
.action(async (options: LintOptions) => {
|
|
40
40
|
log.debug('Running `buddy lint:fix` ...', options)
|
package/src/commands/list.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import { log } from '@stacksjs/logging'
|
|
3
|
+
import { projectPath } from '@stacksjs/path'
|
|
2
4
|
import type { CLI, CliOptions } from '@stacksjs/types'
|
|
3
5
|
import { $ } from 'bun'
|
|
4
|
-
import { projectPath } from '@stacksjs/path'
|
|
5
|
-
import { log } from '@stacksjs/logging'
|
|
6
6
|
|
|
7
7
|
export function list(buddy: CLI) {
|
|
8
8
|
const descriptions = {
|
|
@@ -13,7 +13,7 @@ export function list(buddy: CLI) {
|
|
|
13
13
|
|
|
14
14
|
buddy
|
|
15
15
|
.command('list', descriptions.list)
|
|
16
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
16
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
17
17
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
18
18
|
.action(async (options: CliOptions) => {
|
|
19
19
|
log.debug('Running `buddy list` ...', options)
|
|
@@ -28,7 +28,6 @@ export function list(buddy: CLI) {
|
|
|
28
28
|
.replace('Commands:', '') // Remove "Commands:"
|
|
29
29
|
.replace(/^\s+/gm, '') // Trim leading whitespace from the start of each line
|
|
30
30
|
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
31
|
console.log(cleanedCommands)
|
|
33
32
|
return
|
|
34
33
|
}
|
package/src/commands/make.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
createModel,
|
|
4
4
|
createNotification,
|
|
5
5
|
invoke,
|
|
6
|
+
makeAction,
|
|
6
7
|
makeComponent,
|
|
7
8
|
makeDatabase,
|
|
8
9
|
makeFunction,
|
|
@@ -12,13 +13,14 @@ import {
|
|
|
12
13
|
} from '@stacksjs/actions'
|
|
13
14
|
import { intro, italic, outro, runCommand } from '@stacksjs/cli'
|
|
14
15
|
import { localUrl } from '@stacksjs/config'
|
|
15
|
-
import { path as p } from '@stacksjs/path'
|
|
16
16
|
import { log } from '@stacksjs/logging'
|
|
17
|
+
import { path as p } from '@stacksjs/path'
|
|
17
18
|
import type { CLI, MakeOptions } from '@stacksjs/types'
|
|
18
19
|
import { ExitCode } from '@stacksjs/types'
|
|
19
20
|
|
|
20
21
|
export function make(buddy: CLI) {
|
|
21
22
|
const descriptions = {
|
|
23
|
+
action: 'Create a new action',
|
|
22
24
|
model: 'Create a new model',
|
|
23
25
|
component: 'Create a new component',
|
|
24
26
|
page: 'Create a new page',
|
|
@@ -28,6 +30,7 @@ export function make(buddy: CLI) {
|
|
|
28
30
|
migration: 'Create a new migration',
|
|
29
31
|
factory: 'Create a new factory',
|
|
30
32
|
notification: 'Create a new notification',
|
|
33
|
+
name: 'The name of the action',
|
|
31
34
|
stack: 'Create a new stack',
|
|
32
35
|
certificate: 'Create a new SSL Certificate',
|
|
33
36
|
select: 'What are you trying to make?',
|
|
@@ -37,16 +40,17 @@ export function make(buddy: CLI) {
|
|
|
37
40
|
|
|
38
41
|
buddy
|
|
39
42
|
.command('make', 'The make command')
|
|
40
|
-
.option('-
|
|
41
|
-
.option('-
|
|
42
|
-
.option('-
|
|
43
|
-
.option('-
|
|
44
|
-
.option('-
|
|
45
|
-
.option('-
|
|
46
|
-
.option('-
|
|
47
|
-
.option('-
|
|
48
|
-
.option('-
|
|
49
|
-
.option('-
|
|
43
|
+
.option('-a, --action [action]', descriptions.action, { default: false })
|
|
44
|
+
.option('-m, --model [model]', descriptions.model, { default: false })
|
|
45
|
+
.option('-c, --component [component]', descriptions.component, { default: false })
|
|
46
|
+
.option('-p, --page [page]', descriptions.page, { default: false })
|
|
47
|
+
.option('-f, --function [function]', descriptions.function, { default: false })
|
|
48
|
+
.option('-l, --language [language]', descriptions.language, { default: false })
|
|
49
|
+
.option('-d, --database [database]', descriptions.database, { default: false })
|
|
50
|
+
.option('-m, --migration [migration]', descriptions.migration, { default: false })
|
|
51
|
+
.option('-f, --factory [factory]', descriptions.factory, { default: false })
|
|
52
|
+
.option('-n, --notification [notification]', descriptions.notification, { default: false })
|
|
53
|
+
.option('-s, --stack [stack]', descriptions.stack, { default: false })
|
|
50
54
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
51
55
|
.action(async (options: MakeOptions) => {
|
|
52
56
|
log.debug('Running `buddy make` ...', options)
|
|
@@ -91,14 +95,14 @@ export function make(buddy: CLI) {
|
|
|
91
95
|
})
|
|
92
96
|
|
|
93
97
|
buddy
|
|
94
|
-
.command('make:component', descriptions.component)
|
|
95
|
-
.option('-n, --name',
|
|
96
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
98
|
+
.command('make:component [name]', descriptions.component)
|
|
99
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
100
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
97
101
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
98
|
-
.action(async (options: MakeOptions) => {
|
|
102
|
+
.action(async (name, options: MakeOptions) => {
|
|
99
103
|
log.debug('Running `buddy make:component` ...', options)
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
name = name ?? options.name
|
|
102
106
|
options.name = name
|
|
103
107
|
|
|
104
108
|
if (!name) {
|
|
@@ -110,18 +114,21 @@ export function make(buddy: CLI) {
|
|
|
110
114
|
})
|
|
111
115
|
|
|
112
116
|
buddy
|
|
113
|
-
.command('make:database', descriptions.database)
|
|
114
|
-
.option('-n, --name',
|
|
115
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
117
|
+
.command('make:database [name]', descriptions.database)
|
|
118
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
119
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
116
120
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
117
|
-
.action((options: MakeOptions) => {
|
|
121
|
+
.action((name, options: MakeOptions) => {
|
|
118
122
|
log.debug('Running `buddy make:database` ...', options)
|
|
119
123
|
|
|
120
|
-
|
|
124
|
+
name = name ?? options.name
|
|
121
125
|
options.name = name
|
|
122
126
|
|
|
123
127
|
if (!name) {
|
|
124
|
-
log.error('You need to specify a name
|
|
128
|
+
log.error('You need to specify a database name via the `--name` option, or as the command’s argument.')
|
|
129
|
+
log.info('Example: `buddy make:database my-cool-database`')
|
|
130
|
+
log.info('Or: `buddy make:database --name=my-cool-database`')
|
|
131
|
+
log.info('Read more about the documentation here: https://stacksjs.org/docs/make/database')
|
|
125
132
|
process.exit()
|
|
126
133
|
}
|
|
127
134
|
|
|
@@ -129,14 +136,14 @@ export function make(buddy: CLI) {
|
|
|
129
136
|
})
|
|
130
137
|
|
|
131
138
|
buddy
|
|
132
|
-
.command('make:factory', descriptions.factory)
|
|
133
|
-
.option('-n, --name',
|
|
134
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
139
|
+
.command('make:factory [name]', descriptions.factory)
|
|
140
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
141
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
135
142
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
136
|
-
.action((options: MakeOptions) => {
|
|
143
|
+
.action((name, options: MakeOptions) => {
|
|
137
144
|
log.debug('Running `buddy make:factory` ...', options)
|
|
138
145
|
|
|
139
|
-
|
|
146
|
+
name = name ?? options.name
|
|
140
147
|
options.name = name
|
|
141
148
|
|
|
142
149
|
if (!name) {
|
|
@@ -148,15 +155,15 @@ export function make(buddy: CLI) {
|
|
|
148
155
|
})
|
|
149
156
|
|
|
150
157
|
buddy
|
|
151
|
-
.command('make:view', descriptions.page)
|
|
152
|
-
.alias('make:page')
|
|
153
|
-
.option('-n, --name',
|
|
154
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
158
|
+
.command('make:view [name]', descriptions.page)
|
|
159
|
+
.alias('make:page [name]')
|
|
160
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
161
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
155
162
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
156
|
-
.action(async (options: MakeOptions) => {
|
|
163
|
+
.action(async (name, options: MakeOptions) => {
|
|
157
164
|
log.debug('Running `buddy make:view` ...', options)
|
|
158
165
|
|
|
159
|
-
|
|
166
|
+
name = name ?? options.name
|
|
160
167
|
options.name = name
|
|
161
168
|
|
|
162
169
|
if (!name) {
|
|
@@ -168,9 +175,9 @@ export function make(buddy: CLI) {
|
|
|
168
175
|
})
|
|
169
176
|
|
|
170
177
|
buddy
|
|
171
|
-
.command('make:function', descriptions.function)
|
|
172
|
-
.option('-n, --name',
|
|
173
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
178
|
+
.command('make:function [name]', descriptions.function)
|
|
179
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
180
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
174
181
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
175
182
|
.action(async (options: MakeOptions) => {
|
|
176
183
|
log.debug('Running `buddy make:function` ...', options)
|
|
@@ -179,14 +186,14 @@ export function make(buddy: CLI) {
|
|
|
179
186
|
})
|
|
180
187
|
|
|
181
188
|
buddy
|
|
182
|
-
.command('make:lang', descriptions.language)
|
|
183
|
-
.option('-n, --name',
|
|
184
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
189
|
+
.command('make:lang [name]', descriptions.language)
|
|
190
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
191
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
185
192
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
186
|
-
.action(async (options: MakeOptions) => {
|
|
193
|
+
.action(async (name, options: MakeOptions) => {
|
|
187
194
|
log.debug('Running `buddy make:lang` ...', options)
|
|
188
195
|
|
|
189
|
-
|
|
196
|
+
name = name ?? options.name
|
|
190
197
|
options.name = name
|
|
191
198
|
|
|
192
199
|
if (!name) {
|
|
@@ -198,19 +205,19 @@ export function make(buddy: CLI) {
|
|
|
198
205
|
})
|
|
199
206
|
|
|
200
207
|
buddy
|
|
201
|
-
.command('make:notification', descriptions.notification)
|
|
202
|
-
.option('-n, --name',
|
|
208
|
+
.command('make:notification [name]', descriptions.notification)
|
|
209
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
203
210
|
.option('-e, --email', 'Is it an email notification?', { default: true })
|
|
204
211
|
.option('-c, --chat', 'Is it a chat notification?', { default: false })
|
|
205
212
|
.option('-s, --sms', 'Is it a SMS notification?', { default: false })
|
|
206
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
213
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
207
214
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
208
|
-
.action(async (options: MakeOptions) => {
|
|
215
|
+
.action(async (name, options: MakeOptions) => {
|
|
209
216
|
log.debug('Running `buddy make:notification` ...', options)
|
|
210
217
|
|
|
211
218
|
const perf = await intro('buddy make:notification')
|
|
212
219
|
|
|
213
|
-
|
|
220
|
+
name = name ?? options.name
|
|
214
221
|
options.name = name
|
|
215
222
|
|
|
216
223
|
if (!name) {
|
|
@@ -221,23 +228,29 @@ export function make(buddy: CLI) {
|
|
|
221
228
|
const result = await createNotification(options)
|
|
222
229
|
|
|
223
230
|
if (!result) {
|
|
224
|
-
await outro('While running the make:notification command, there was an issue', {
|
|
231
|
+
await outro('While running the make:notification command, there was an issue', {
|
|
232
|
+
startTime: perf,
|
|
233
|
+
useSeconds: true,
|
|
234
|
+
})
|
|
225
235
|
process.exit()
|
|
226
236
|
}
|
|
227
237
|
|
|
228
|
-
await outro(`Created your ${italic(name)} notification.`, {
|
|
238
|
+
await outro(`Created your ${italic(name)} notification.`, {
|
|
239
|
+
startTime: perf,
|
|
240
|
+
useSeconds: true,
|
|
241
|
+
})
|
|
229
242
|
process.exit(ExitCode.Success)
|
|
230
243
|
})
|
|
231
244
|
|
|
232
245
|
buddy
|
|
233
|
-
.command('make:stack', descriptions.stack)
|
|
234
|
-
.option('-n, --name',
|
|
235
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
246
|
+
.command('make:stack [name]', descriptions.stack)
|
|
247
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
248
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
236
249
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
237
|
-
.action((options: MakeOptions) => {
|
|
250
|
+
.action((name, options: MakeOptions) => {
|
|
238
251
|
log.debug('Running `buddy make:stack` ...', options)
|
|
239
252
|
|
|
240
|
-
|
|
253
|
+
name = name ?? options.name
|
|
241
254
|
options.name = name
|
|
242
255
|
|
|
243
256
|
if (!name) {
|
|
@@ -249,12 +262,34 @@ export function make(buddy: CLI) {
|
|
|
249
262
|
})
|
|
250
263
|
|
|
251
264
|
buddy
|
|
252
|
-
.command('make:
|
|
253
|
-
.option('-n, --name',
|
|
254
|
-
.
|
|
265
|
+
.command('make:action [name]', descriptions.action)
|
|
266
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
267
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
268
|
+
.option('--verbose', descriptions.verbose, { default: false })
|
|
269
|
+
.action(async (name, options: MakeOptions) => {
|
|
270
|
+
log.info('Running `buddy make:action` ...')
|
|
271
|
+
log.debug('Running `buddy make:action` ...', name, options)
|
|
272
|
+
|
|
273
|
+
name = name ?? options.name
|
|
274
|
+
options.name = name
|
|
275
|
+
|
|
276
|
+
if (!name) {
|
|
277
|
+
log.error('You need to specify a name. Read more about the documentation here.')
|
|
278
|
+
process.exit()
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
await makeAction(options)
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
buddy
|
|
285
|
+
.command('make:model [name]', descriptions.model)
|
|
286
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
287
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
288
|
+
.option('--verbose', descriptions.verbose, { default: false })
|
|
289
|
+
.action(async (name, options: MakeOptions) => {
|
|
255
290
|
log.debug('Running `buddy make:model` ...', options)
|
|
256
291
|
|
|
257
|
-
|
|
292
|
+
name = name ?? options.name
|
|
258
293
|
options.name = name
|
|
259
294
|
|
|
260
295
|
if (!name) {
|
|
@@ -266,13 +301,14 @@ export function make(buddy: CLI) {
|
|
|
266
301
|
})
|
|
267
302
|
|
|
268
303
|
buddy
|
|
269
|
-
.command('make:migration', descriptions.migration)
|
|
270
|
-
.option('-n, --name',
|
|
271
|
-
.option('-
|
|
272
|
-
.
|
|
304
|
+
.command('make:migration [name]', descriptions.migration)
|
|
305
|
+
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
306
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
307
|
+
.option('--verbose', descriptions.verbose, { default: false })
|
|
308
|
+
.action((name, options: MakeOptions) => {
|
|
273
309
|
log.debug('Running `buddy make:migration` ...', options)
|
|
274
310
|
|
|
275
|
-
|
|
311
|
+
name = name ?? options.name
|
|
276
312
|
options.name = name
|
|
277
313
|
|
|
278
314
|
if (!name) {
|
|
@@ -280,7 +316,7 @@ export function make(buddy: CLI) {
|
|
|
280
316
|
process.exit()
|
|
281
317
|
}
|
|
282
318
|
|
|
283
|
-
log.info(path
|
|
319
|
+
// log.info(path)
|
|
284
320
|
})
|
|
285
321
|
|
|
286
322
|
buddy
|
|
@@ -293,14 +329,14 @@ export function make(buddy: CLI) {
|
|
|
293
329
|
const domain = await localUrl()
|
|
294
330
|
log.info(`Creating SSL certificate...`)
|
|
295
331
|
|
|
296
|
-
await runCommand(`
|
|
332
|
+
await runCommand(`tlsx ${domain}`, {
|
|
297
333
|
cwd: p.projectStoragePath('keys'),
|
|
298
334
|
})
|
|
299
335
|
|
|
300
336
|
log.success('Certificate created')
|
|
301
337
|
|
|
302
338
|
log.info(`Installing SSL certificate...`)
|
|
303
|
-
await runCommand(`
|
|
339
|
+
await runCommand(`tlsx -install`, {
|
|
304
340
|
cwd: p.projectStoragePath('keys'),
|
|
305
341
|
})
|
|
306
342
|
log.success('Certificate installed')
|
package/src/commands/migrate.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { ExitCode } from '@stacksjs/types'
|
|
3
|
-
import type { CLI, MigrateOptions } 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, MigrateOptions } from '@stacksjs/types'
|
|
7
7
|
|
|
8
8
|
export function migrate(buddy: CLI) {
|
|
9
9
|
const descriptions = {
|
|
@@ -15,28 +15,64 @@ export function migrate(buddy: CLI) {
|
|
|
15
15
|
|
|
16
16
|
buddy
|
|
17
17
|
.command('migrate', descriptions.migrate)
|
|
18
|
-
.option('-
|
|
18
|
+
.option('-d, --diff', 'Show the SQL that would be run', { default: false })
|
|
19
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
19
20
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
20
21
|
.action(async (options: MigrateOptions) => {
|
|
21
22
|
log.debug('Running `buddy migrate` ...', options)
|
|
22
23
|
|
|
23
24
|
const perf = await intro('buddy migrate')
|
|
24
|
-
const result = await runAction(Action.Migrate,
|
|
25
|
+
const result = await runAction(Action.Migrate, options)
|
|
25
26
|
|
|
26
27
|
if (result.isErr()) {
|
|
27
|
-
await outro(
|
|
28
|
+
await outro(
|
|
29
|
+
'While running the migrate command, there was an issue',
|
|
30
|
+
{ startTime: perf, useSeconds: true },
|
|
31
|
+
result.error,
|
|
32
|
+
)
|
|
28
33
|
process.exit()
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
const APP_ENV = process.env.APP_ENV || 'local'
|
|
32
37
|
|
|
33
|
-
await outro(`Migrated your ${APP_ENV} database.`, {
|
|
38
|
+
await outro(`Migrated your ${APP_ENV} database.`, {
|
|
39
|
+
startTime: perf,
|
|
40
|
+
useSeconds: true,
|
|
41
|
+
})
|
|
42
|
+
process.exit(ExitCode.Success)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
buddy
|
|
46
|
+
.command('migrate:fresh', descriptions.migrate)
|
|
47
|
+
.option('-d, --diff', 'Show the SQL that would be run', { default: false })
|
|
48
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
49
|
+
.option('--verbose', descriptions.verbose, { default: false })
|
|
50
|
+
.action(async (options: MigrateOptions) => {
|
|
51
|
+
log.debug('Running `buddy migrate:fresh` ...', options)
|
|
52
|
+
|
|
53
|
+
const perf = await intro('buddy migrate:fresh')
|
|
54
|
+
const result = await runAction(Action.MigrateFresh, options)
|
|
55
|
+
|
|
56
|
+
if (result.isErr()) {
|
|
57
|
+
await outro(
|
|
58
|
+
'While running the migrate:fresh command, there was an issue',
|
|
59
|
+
{ startTime: perf, useSeconds: true },
|
|
60
|
+
result.error,
|
|
61
|
+
)
|
|
62
|
+
process.exit()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await outro(`All tables dropped successfully`, {
|
|
66
|
+
startTime: perf,
|
|
67
|
+
useSeconds: true,
|
|
68
|
+
})
|
|
69
|
+
|
|
34
70
|
process.exit(ExitCode.Success)
|
|
35
71
|
})
|
|
36
72
|
|
|
37
73
|
buddy
|
|
38
74
|
.command('migrate:dns', descriptions.migrate)
|
|
39
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
75
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
40
76
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
41
77
|
.action(async (options: MigrateOptions) => {
|
|
42
78
|
log.debug('Running `buddy migrate:dns` ...', options)
|
|
@@ -45,13 +81,20 @@ export function migrate(buddy: CLI) {
|
|
|
45
81
|
const result = await runAction(Action.MigrateDns, { ...options })
|
|
46
82
|
|
|
47
83
|
if (result.isErr()) {
|
|
48
|
-
await outro(
|
|
84
|
+
await outro(
|
|
85
|
+
'While running the migrate:dns command, there was an issue',
|
|
86
|
+
{ startTime: perf, useSeconds: true },
|
|
87
|
+
result.error,
|
|
88
|
+
)
|
|
49
89
|
process.exit()
|
|
50
90
|
}
|
|
51
91
|
|
|
52
92
|
const APP_URL = process.env.APP_URL || 'undefined'
|
|
53
93
|
|
|
54
|
-
await outro(`Migrated your ${APP_URL} DNS.`, {
|
|
94
|
+
await outro(`Migrated your ${APP_URL} DNS.`, {
|
|
95
|
+
startTime: perf,
|
|
96
|
+
useSeconds: true,
|
|
97
|
+
})
|
|
55
98
|
process.exit(ExitCode.Success)
|
|
56
99
|
})
|
|
57
100
|
|