@stacksjs/buddy 0.64.6 → 0.65.0
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-1bcxd9nx.js +5 -0
- package/dist/chunk-1bcxd9nx.js.map +17 -0
- package/dist/chunk-3gvx3tap.js +5 -0
- package/dist/{chunk-wmfxrbxe.js.map → chunk-3gvx3tap.js.map} +1 -1
- package/dist/chunk-5mkzknp4.js +5 -0
- package/dist/{chunk-kkckr1p6.js.map → chunk-5mkzknp4.js.map} +13 -13
- package/dist/chunk-a3d48jzd.js +15 -0
- package/dist/chunk-a3d48jzd.js.map +164 -0
- package/dist/chunk-a6ba4vgs.js +5 -0
- package/dist/{chunk-44mrj8pm.js.map → chunk-a6ba4vgs.js.map} +3 -3
- package/dist/chunk-agapayce.js +4 -0
- package/dist/chunk-agapayce.js.map +15 -0
- package/dist/chunk-b9d377d9.js +5 -0
- package/dist/{chunk-ebp27f3t.js.map → chunk-b9d377d9.js.map} +9 -9
- package/dist/chunk-bh61bx6h.js +4 -0
- package/dist/{chunk-34xxhapv.js.map → chunk-bh61bx6h.js.map} +2 -2
- package/dist/chunk-fqrjh7j8.js +5 -0
- package/dist/chunk-fqrjh7j8.js.map +10 -0
- package/dist/chunk-jkt9jxar.js +9 -0
- package/dist/{chunk-gsnfg0v2.js.map → chunk-jkt9jxar.js.map} +3 -3
- package/dist/chunk-k1q2z202.js +4 -0
- package/dist/chunk-k1q2z202.js.map +16 -0
- package/dist/chunk-mmjggjd5.js +849 -0
- package/dist/chunk-mmjggjd5.js.map +240 -0
- package/dist/chunk-mxwvrbdh.js +6 -0
- package/dist/chunk-mxwvrbdh.js.map +59 -0
- package/dist/chunk-n55kahn5.js +5 -0
- package/dist/{chunk-b685jsh2.js.map → chunk-n55kahn5.js.map} +3 -3
- package/dist/chunk-pbpgcz3v.js +5 -0
- package/dist/{chunk-1f6t66bt.js.map → chunk-pbpgcz3v.js.map} +4 -4
- package/dist/chunk-sadghty0.js +5 -0
- package/dist/{chunk-een41wce.js.map → chunk-sadghty0.js.map} +7 -7
- package/dist/chunk-smzpmhmp.js +11 -0
- package/dist/chunk-smzpmhmp.js.map +10 -0
- package/dist/chunk-w4zypt02.js +5 -0
- package/dist/{chunk-ygxh9jsp.js.map → chunk-w4zypt02.js.map} +6 -6
- package/dist/chunk-ywfsnx7v.js +5 -0
- package/dist/chunk-ywfsnx7v.js.map +22 -0
- package/dist/chunk-yxs8vtg9.js +5 -0
- package/dist/{chunk-e9xdp71t.js.map → chunk-yxs8vtg9.js.map} +2 -2
- package/dist/chunk-z7609s4h.js +12 -0
- package/dist/{chunk-v7d1bf8z.js.map → chunk-z7609s4h.js.map} +5 -5
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +3 -3
- package/dist/commands/add.d.ts +2 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/changelog.d.ts +2 -0
- package/dist/commands/clean.d.ts +2 -0
- package/dist/commands/cloud.d.ts +2 -0
- package/dist/commands/commit.d.ts +2 -0
- package/dist/commands/configure.d.ts +2 -0
- package/dist/commands/create.d.ts +2 -0
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dns.d.ts +2 -0
- package/dist/commands/domains.d.ts +2 -0
- package/dist/commands/fresh.d.ts +2 -0
- package/dist/commands/generate.d.ts +2 -0
- package/dist/commands/http.d.ts +2 -0
- package/dist/commands/index.d.ts +33 -0
- package/dist/commands/install.d.ts +2 -0
- package/dist/commands/key.d.ts +2 -0
- package/dist/commands/lint.d.ts +2 -0
- package/dist/commands/list.d.ts +2 -0
- package/dist/commands/make.d.ts +2 -0
- package/dist/commands/migrate.d.ts +2 -0
- package/dist/commands/outdated.d.ts +2 -0
- package/dist/commands/ports.d.ts +2 -0
- package/dist/commands/prepublish.d.ts +2 -0
- package/dist/commands/projects.d.ts +2 -0
- package/dist/commands/release.d.ts +2 -0
- package/dist/commands/route.d.ts +2 -0
- package/dist/commands/seed.d.ts +2 -0
- package/dist/commands/setup.d.ts +4 -0
- package/dist/commands/test.d.ts +2 -0
- package/dist/commands/tinker.d.ts +2 -0
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/upgrade.d.ts +2 -0
- package/dist/commands/version.d.ts +2 -0
- package/dist/custom-cli.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/stacks +0 -0
- package/package.json +50 -56
- package/src/cli.ts +10 -7
- package/src/commands/add.ts +2 -2
- package/src/commands/build.ts +50 -32
- package/src/commands/changelog.ts +2 -2
- package/src/commands/clean.ts +2 -2
- package/src/commands/cloud.ts +31 -12
- package/src/commands/commit.ts +2 -2
- package/src/commands/configure.ts +4 -3
- package/src/commands/create.ts +3 -3
- package/src/commands/deploy.ts +21 -10
- package/src/commands/dev.ts +38 -25
- package/src/commands/dns.ts +2 -2
- package/src/commands/domains.ts +2 -2
- package/src/commands/fresh.ts +2 -2
- package/src/commands/generate.ts +27 -3
- package/src/commands/http.ts +2 -2
- package/src/commands/index.ts +3 -3
- package/src/commands/install.ts +2 -2
- package/src/commands/key.ts +2 -2
- package/src/commands/lint.ts +7 -10
- package/src/commands/list.ts +2 -2
- package/src/commands/make.ts +12 -12
- package/src/commands/migrate.ts +2 -2
- package/src/commands/outdated.ts +3 -3
- package/src/commands/ports.ts +26 -16
- package/src/commands/prepublish.ts +2 -2
- package/src/commands/projects.ts +6 -4
- package/src/commands/release.ts +4 -3
- package/src/commands/route.ts +2 -2
- package/src/commands/seed.ts +2 -2
- package/src/commands/setup.ts +11 -7
- package/src/commands/test.ts +77 -54
- package/src/commands/tinker.ts +2 -2
- package/src/commands/types.ts +2 -2
- package/src/commands/upgrade.ts +20 -13
- package/src/commands/version.ts +2 -2
- package/src/custom-cli.ts +3 -2
- package/dist/chunk-1f6t66bt.js +0 -5
- package/dist/chunk-1nyept5d.js +0 -5
- package/dist/chunk-1nyept5d.js.map +0 -10
- package/dist/chunk-3472npd1.js +0 -19
- package/dist/chunk-3472npd1.js.map +0 -156
- package/dist/chunk-34xxhapv.js +0 -4
- package/dist/chunk-3y8aq9qa.js +0 -8
- package/dist/chunk-3y8aq9qa.js.map +0 -65
- package/dist/chunk-44mrj8pm.js +0 -5
- package/dist/chunk-8adez9b9.js +0 -5
- package/dist/chunk-8adez9b9.js.map +0 -10
- package/dist/chunk-b685jsh2.js +0 -5
- package/dist/chunk-been0qrs.js +0 -5
- package/dist/chunk-been0qrs.js.map +0 -16
- package/dist/chunk-dnr3cyf7.js +0 -7
- package/dist/chunk-dnr3cyf7.js.map +0 -60
- package/dist/chunk-e9xdp71t.js +0 -5
- package/dist/chunk-ebp27f3t.js +0 -5
- package/dist/chunk-een41wce.js +0 -5
- package/dist/chunk-gsnfg0v2.js +0 -9
- package/dist/chunk-kkckr1p6.js +0 -5
- package/dist/chunk-pq8pr524.js +0 -5
- package/dist/chunk-pq8pr524.js.map +0 -17
- package/dist/chunk-qrw0tzf0.js +0 -5
- package/dist/chunk-qrw0tzf0.js.map +0 -22
- package/dist/chunk-v7d1bf8z.js +0 -12
- package/dist/chunk-wmfxrbxe.js +0 -5
- package/dist/chunk-ygxh9jsp.js +0 -5
package/src/commands/dev.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CLI, DevOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import {
|
|
3
4
|
runAction,
|
|
@@ -9,13 +10,12 @@ import {
|
|
|
9
10
|
runFrontendDevServer,
|
|
10
11
|
runSystemTrayDevServer,
|
|
11
12
|
} from '@stacksjs/actions'
|
|
12
|
-
import { intro, log, outro, runCommand } from '@stacksjs/cli'
|
|
13
|
+
import { intro, log, outro, prompts, runCommand } from '@stacksjs/cli'
|
|
13
14
|
import { Action } from '@stacksjs/enums'
|
|
14
15
|
import { libsPath } from '@stacksjs/path'
|
|
15
16
|
import { ExitCode } from '@stacksjs/types'
|
|
16
|
-
import type { CLI, DevOptions } from '@stacksjs/types'
|
|
17
17
|
|
|
18
|
-
export function dev(buddy: CLI) {
|
|
18
|
+
export function dev(buddy: CLI): void {
|
|
19
19
|
const descriptions = {
|
|
20
20
|
dev: 'Start development server',
|
|
21
21
|
frontend: 'Start the frontend development server',
|
|
@@ -91,38 +91,50 @@ export function dev(buddy: CLI) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (wantsInteractive(options)) {
|
|
94
|
-
const answer = await
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{ value: '
|
|
100
|
-
{ value: '
|
|
101
|
-
{ value: '
|
|
102
|
-
{ value: '
|
|
103
|
-
{ value: '
|
|
94
|
+
const answer = await prompts({
|
|
95
|
+
type: 'select',
|
|
96
|
+
name: 'value',
|
|
97
|
+
message: descriptions.select,
|
|
98
|
+
choices: [
|
|
99
|
+
{ value: 'all', title: 'All' },
|
|
100
|
+
{ value: 'frontend', title: 'Frontend' },
|
|
101
|
+
{ value: 'api', title: 'Backend' },
|
|
102
|
+
{ value: 'dashboard', title: 'Dashboard' },
|
|
103
|
+
{ value: 'desktop', title: 'Desktop' },
|
|
104
|
+
{ value: 'email', title: 'Email' },
|
|
105
|
+
{ value: 'components', title: 'Components' },
|
|
106
|
+
{ value: 'docs', title: 'Documentation' },
|
|
104
107
|
],
|
|
105
108
|
})
|
|
106
109
|
|
|
107
|
-
|
|
110
|
+
const selectedValue: string = answer.value
|
|
111
|
+
|
|
112
|
+
if (selectedValue === 'components') {
|
|
108
113
|
await runComponentsDevServer(options)
|
|
109
|
-
}
|
|
114
|
+
}
|
|
115
|
+
else if (selectedValue === 'api') {
|
|
110
116
|
await runApiDevServer(options)
|
|
111
|
-
}
|
|
117
|
+
}
|
|
118
|
+
else if (selectedValue === 'dashboard') {
|
|
112
119
|
await runDashboardDevServer(options)
|
|
113
120
|
}
|
|
114
|
-
// else if (
|
|
121
|
+
// else if (selectedValue === 'email')
|
|
115
122
|
// await runEmailDevServer(options)
|
|
116
|
-
else if (
|
|
123
|
+
else if (selectedValue === 'docs') {
|
|
117
124
|
await runDocsDevServer(options)
|
|
118
|
-
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
119
127
|
log.error('Invalid option during interactive mode')
|
|
120
128
|
process.exit(ExitCode.InvalidArgument)
|
|
121
129
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (options.
|
|
125
|
-
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
if (options.components)
|
|
133
|
+
await runComponentsDevServer(options)
|
|
134
|
+
if (options.docs)
|
|
135
|
+
await runDocsDevServer(options)
|
|
136
|
+
else if (options.api)
|
|
137
|
+
await runApiDevServer(options)
|
|
126
138
|
// else if (options.email)
|
|
127
139
|
// await runEmailDevServer(options)
|
|
128
140
|
}
|
|
@@ -146,7 +158,8 @@ export function dev(buddy: CLI) {
|
|
|
146
158
|
// silent: !options.verbose,
|
|
147
159
|
})
|
|
148
160
|
|
|
149
|
-
if (options.verbose)
|
|
161
|
+
if (options.verbose)
|
|
162
|
+
log.info('buddy dev:components result', result)
|
|
150
163
|
|
|
151
164
|
if (result.isErr()) {
|
|
152
165
|
await outro(
|
|
@@ -265,7 +278,7 @@ export function dev(buddy: CLI) {
|
|
|
265
278
|
})
|
|
266
279
|
}
|
|
267
280
|
|
|
268
|
-
export async function startDevelopmentServer(options: DevOptions) {
|
|
281
|
+
export async function startDevelopmentServer(options: DevOptions): Promise<void> {
|
|
269
282
|
const result = await runAction(Action.Dev, options)
|
|
270
283
|
|
|
271
284
|
if (result.isErr()) {
|
package/src/commands/dns.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { CLI } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { log, runCommand } from '@stacksjs/cli'
|
|
3
4
|
import { config } from '@stacksjs/config'
|
|
4
5
|
import { ExitCode } from '@stacksjs/types'
|
|
5
|
-
import type { CLI } from '@stacksjs/types'
|
|
6
6
|
|
|
7
7
|
// import { Action } from '@stacksjs/enums'
|
|
8
8
|
// import { runAction } from '@stacksjs/actions'
|
|
@@ -23,7 +23,7 @@ interface DnsOptions {
|
|
|
23
23
|
verbose?: boolean
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export function dns(buddy: CLI) {
|
|
26
|
+
export function dns(buddy: CLI): void {
|
|
27
27
|
const descriptions = {
|
|
28
28
|
dns: 'Lists the DNS records for a domain',
|
|
29
29
|
query: 'Host name or IP address to query',
|
package/src/commands/domains.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CLI, DomainsOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { runAction } from '@stacksjs/actions'
|
|
3
4
|
import { bgCyan, bold, intro, italic, log, outro, prompts } from '@stacksjs/cli'
|
|
@@ -5,9 +6,8 @@ import { config } from '@stacksjs/config'
|
|
|
5
6
|
import { addDomain } from '@stacksjs/dns'
|
|
6
7
|
import { Action } from '@stacksjs/enums'
|
|
7
8
|
import { ExitCode } from '@stacksjs/types'
|
|
8
|
-
import type { CLI, DomainsOptions } from '@stacksjs/types'
|
|
9
9
|
|
|
10
|
-
export function domains(buddy: CLI) {
|
|
10
|
+
export function domains(buddy: CLI): void {
|
|
11
11
|
const descriptions = {
|
|
12
12
|
purchase: 'Purchase a domain',
|
|
13
13
|
add: 'Add a domain to your cloud', // given you already own it with a different registrar
|
package/src/commands/fresh.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { CLI, FreshOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { runAction } from '@stacksjs/actions'
|
|
3
4
|
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
5
|
import { Action } from '@stacksjs/enums'
|
|
5
6
|
import { ExitCode } from '@stacksjs/types'
|
|
6
|
-
import type { CLI, FreshOptions } from '@stacksjs/types'
|
|
7
7
|
|
|
8
|
-
export function fresh(buddy: CLI) {
|
|
8
|
+
export function fresh(buddy: CLI): void {
|
|
9
9
|
const descriptions = {
|
|
10
10
|
fresh: 'Re-installs your npm dependencies',
|
|
11
11
|
project: 'Target a specific project',
|
package/src/commands/generate.ts
CHANGED
|
@@ -4,17 +4,18 @@ import {
|
|
|
4
4
|
generateCoreSymlink,
|
|
5
5
|
generateIdeHelpers,
|
|
6
6
|
generateLibEntries,
|
|
7
|
+
generateOpenApiSpec,
|
|
7
8
|
generatePkgxConfig,
|
|
8
9
|
generateTypes,
|
|
9
10
|
generateVsCodeCustomData,
|
|
10
11
|
generateWebTypes,
|
|
11
|
-
// generateOpenApiSpec,
|
|
12
12
|
invoke as startGenerationProcess,
|
|
13
13
|
} from '@stacksjs/actions'
|
|
14
14
|
import { intro, log, outro } from '@stacksjs/cli'
|
|
15
|
+
import { generateModelFiles } from '@stacksjs/orm'
|
|
15
16
|
import { type CLI, ExitCode, type GeneratorOptions } from '@stacksjs/types'
|
|
16
17
|
|
|
17
|
-
export function generate(buddy: CLI) {
|
|
18
|
+
export function generate(buddy: CLI): void {
|
|
18
19
|
const descriptions = {
|
|
19
20
|
command:
|
|
20
21
|
'Automagically build any of your libraries/packages for production use. Select any of the following packages',
|
|
@@ -26,6 +27,7 @@ export function generate(buddy: CLI) {
|
|
|
26
27
|
componentMeta: 'Generate component meta information',
|
|
27
28
|
coreSymlink: 'Generate symlink of the core framework to the project root',
|
|
28
29
|
pkgx: 'Generate the pkgx configuration file',
|
|
30
|
+
modelFiles: 'Generate the model files',
|
|
29
31
|
openApi: 'Generate the OpenAPI specification',
|
|
30
32
|
select: 'What are you trying to generate?',
|
|
31
33
|
project: 'Target a specific project',
|
|
@@ -41,6 +43,7 @@ export function generate(buddy: CLI) {
|
|
|
41
43
|
.option('-i, --ide-helpers', descriptions.ideHelpers)
|
|
42
44
|
.option('-c, --component-meta', descriptions.componentMeta)
|
|
43
45
|
.option('-p, --pkgx', descriptions.pkgx)
|
|
46
|
+
.option('-m, --model-files', descriptions.modelFiles)
|
|
44
47
|
.option('-o, --openapi', descriptions.openApi)
|
|
45
48
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
46
49
|
.option('--core-symlink', descriptions.coreSymlink)
|
|
@@ -138,6 +141,27 @@ export function generate(buddy: CLI) {
|
|
|
138
141
|
generatePkgxConfig()
|
|
139
142
|
})
|
|
140
143
|
|
|
144
|
+
buddy
|
|
145
|
+
.command('generate:model-files', descriptions.modelFiles)
|
|
146
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
147
|
+
.option('--verbose', descriptions.verbose, { default: false })
|
|
148
|
+
.action(async () => {
|
|
149
|
+
const perf = await intro('buddy generate:model-files')
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
await generateModelFiles()
|
|
153
|
+
|
|
154
|
+
outro('Generated Model files', {
|
|
155
|
+
startTime: perf,
|
|
156
|
+
useSeconds: true,
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
log.error('There was an error generating your model files', error)
|
|
161
|
+
process.exit(ExitCode.FatalError)
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
|
|
141
165
|
buddy
|
|
142
166
|
.command('generate:openapi-spec', descriptions.openApi)
|
|
143
167
|
.alias('generate:openapi')
|
|
@@ -147,7 +171,7 @@ export function generate(buddy: CLI) {
|
|
|
147
171
|
log.debug('Running `buddy generate:openapi-spec` ...', options)
|
|
148
172
|
const perf = await intro('buddy generate:openapi-spec')
|
|
149
173
|
|
|
150
|
-
|
|
174
|
+
await generateOpenApiSpec()
|
|
151
175
|
|
|
152
176
|
outro('Generated OpenAPI specification', {
|
|
153
177
|
startTime: perf,
|
package/src/commands/http.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { CLI } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { config } from '@stacksjs/config'
|
|
3
4
|
import { ExitCode } from '@stacksjs/types'
|
|
4
|
-
import type { CLI } from '@stacksjs/types'
|
|
5
5
|
|
|
6
6
|
// import { path } from '@stacksjs/path'
|
|
7
7
|
import { log, runCommandSync } from '@stacksjs/cli'
|
|
@@ -27,7 +27,7 @@ interface HttpOptions {
|
|
|
27
27
|
verbose?: boolean
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export function http(buddy: CLI) {
|
|
30
|
+
export function http(buddy: CLI): void {
|
|
31
31
|
const descriptions = {
|
|
32
32
|
http: 'Send an HTTP request to a domain',
|
|
33
33
|
project: 'Target a specific project',
|
package/src/commands/index.ts
CHANGED
|
@@ -7,15 +7,15 @@ export * from './configure'
|
|
|
7
7
|
export * from './create'
|
|
8
8
|
export * from './deploy'
|
|
9
9
|
export * from './dev'
|
|
10
|
-
export * from './domains'
|
|
11
10
|
export * from './dns'
|
|
11
|
+
export * from './domains'
|
|
12
12
|
export * from './fresh'
|
|
13
13
|
export * from './generate'
|
|
14
14
|
export * from './http'
|
|
15
|
-
export * from './lint'
|
|
16
|
-
export * from './list'
|
|
17
15
|
export * from './install'
|
|
18
16
|
export * from './key'
|
|
17
|
+
export * from './lint'
|
|
18
|
+
export * from './list'
|
|
19
19
|
export * from './make'
|
|
20
20
|
export * from './migrate'
|
|
21
21
|
export * from './outdated'
|
package/src/commands/install.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { CLI, InstallOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { log, runCommand } from '@stacksjs/cli'
|
|
3
4
|
import { path as p } from '@stacksjs/path'
|
|
4
|
-
import type { CLI, InstallOptions } from '@stacksjs/types'
|
|
5
5
|
|
|
6
|
-
export function install(buddy: CLI) {
|
|
6
|
+
export function install(buddy: CLI): void {
|
|
7
7
|
const descriptions = {
|
|
8
8
|
install: 'Install your dependencies',
|
|
9
9
|
project: 'Target a specific project',
|
package/src/commands/key.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { CLI, KeyOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { runAction } from '@stacksjs/actions'
|
|
3
4
|
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
5
|
import { Action } from '@stacksjs/enums'
|
|
5
|
-
import type { CLI, KeyOptions } from '@stacksjs/types'
|
|
6
6
|
|
|
7
|
-
export function key(buddy: CLI) {
|
|
7
|
+
export function key(buddy: CLI): void {
|
|
8
8
|
const descriptions = {
|
|
9
9
|
command: 'Generate & set the application key.',
|
|
10
10
|
project: 'Target a specific project',
|
package/src/commands/lint.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { CLI, LintOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { runAction } from '@stacksjs/actions'
|
|
3
|
-
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
|
+
import { intro, log, outro, runCommand } from '@stacksjs/cli'
|
|
4
5
|
import { Action } from '@stacksjs/enums'
|
|
5
|
-
import type { CLI, LintOptions } from '@stacksjs/types'
|
|
6
6
|
|
|
7
|
-
export function lint(buddy: CLI) {
|
|
7
|
+
export function lint(buddy: CLI): void {
|
|
8
8
|
const descriptions = {
|
|
9
9
|
lint: 'Automagically lints your project codebase',
|
|
10
10
|
lintFix: 'Automagically fixes all lint errors',
|
|
@@ -21,13 +21,10 @@ export function lint(buddy: CLI) {
|
|
|
21
21
|
log.debug('Running `buddy lint` ...', options)
|
|
22
22
|
|
|
23
23
|
const startTime = await intro('buddy lint')
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// await outro('While running `buddy lint`, there was an issue', { startTime, useSeconds: true }, result.error)
|
|
29
|
-
// process.exit()
|
|
30
|
-
// }
|
|
24
|
+
|
|
25
|
+
if (options.fix)
|
|
26
|
+
await runAction(Action.LintFix, { ...options })
|
|
27
|
+
else await runCommand('bunx --bun eslint .')
|
|
31
28
|
|
|
32
29
|
await outro('Linted your project', { startTime, useSeconds: true })
|
|
33
30
|
})
|
package/src/commands/list.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { CLI, CliOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { log } from '@stacksjs/logging'
|
|
3
4
|
import { projectPath } from '@stacksjs/path'
|
|
4
|
-
import type { CLI, CliOptions } from '@stacksjs/types'
|
|
5
5
|
import { $ } from 'bun'
|
|
6
6
|
|
|
7
|
-
export function list(buddy: CLI) {
|
|
7
|
+
export function list(buddy: CLI): void {
|
|
8
8
|
const descriptions = {
|
|
9
9
|
list: 'List all of the project-specific Buddy commands',
|
|
10
10
|
project: 'Target a specific project',
|
package/src/commands/make.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CLI, MakeOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import {
|
|
3
4
|
createModel,
|
|
@@ -15,10 +16,9 @@ import { intro, italic, outro, runCommand } from '@stacksjs/cli'
|
|
|
15
16
|
import { localUrl } from '@stacksjs/config'
|
|
16
17
|
import { log } from '@stacksjs/logging'
|
|
17
18
|
import { path as p } from '@stacksjs/path'
|
|
18
|
-
import type { CLI, MakeOptions } from '@stacksjs/types'
|
|
19
19
|
import { ExitCode } from '@stacksjs/types'
|
|
20
20
|
|
|
21
|
-
export function make(buddy: CLI) {
|
|
21
|
+
export function make(buddy: CLI): void {
|
|
22
22
|
const descriptions = {
|
|
23
23
|
action: 'Create a new action',
|
|
24
24
|
model: 'Create a new model',
|
|
@@ -99,7 +99,7 @@ export function make(buddy: CLI) {
|
|
|
99
99
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
100
100
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
101
101
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
102
|
-
.action(async (name, options: MakeOptions) => {
|
|
102
|
+
.action(async (name: string, options: MakeOptions) => {
|
|
103
103
|
log.debug('Running `buddy make:component` ...', options)
|
|
104
104
|
|
|
105
105
|
name = name ?? options.name
|
|
@@ -118,7 +118,7 @@ export function make(buddy: CLI) {
|
|
|
118
118
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
119
119
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
120
120
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
121
|
-
.action((name, options: MakeOptions) => {
|
|
121
|
+
.action((name: string, options: MakeOptions) => {
|
|
122
122
|
log.debug('Running `buddy make:database` ...', options)
|
|
123
123
|
|
|
124
124
|
name = name ?? options.name
|
|
@@ -140,7 +140,7 @@ export function make(buddy: CLI) {
|
|
|
140
140
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
141
141
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
142
142
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
143
|
-
.action((name, options: MakeOptions) => {
|
|
143
|
+
.action((name: string, options: MakeOptions) => {
|
|
144
144
|
log.debug('Running `buddy make:factory` ...', options)
|
|
145
145
|
|
|
146
146
|
name = name ?? options.name
|
|
@@ -160,7 +160,7 @@ export function make(buddy: CLI) {
|
|
|
160
160
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
161
161
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
162
162
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
163
|
-
.action(async (name, options: MakeOptions) => {
|
|
163
|
+
.action(async (name: string, options: MakeOptions) => {
|
|
164
164
|
log.debug('Running `buddy make:view` ...', options)
|
|
165
165
|
|
|
166
166
|
name = name ?? options.name
|
|
@@ -190,7 +190,7 @@ export function make(buddy: CLI) {
|
|
|
190
190
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
191
191
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
192
192
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
193
|
-
.action(async (name, options: MakeOptions) => {
|
|
193
|
+
.action(async (name: string, options: MakeOptions) => {
|
|
194
194
|
log.debug('Running `buddy make:lang` ...', options)
|
|
195
195
|
|
|
196
196
|
name = name ?? options.name
|
|
@@ -212,7 +212,7 @@ export function make(buddy: CLI) {
|
|
|
212
212
|
.option('-s, --sms', 'Is it a SMS notification?', { default: false })
|
|
213
213
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
214
214
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
215
|
-
.action(async (name, options: MakeOptions) => {
|
|
215
|
+
.action(async (name: string, options: MakeOptions) => {
|
|
216
216
|
log.debug('Running `buddy make:notification` ...', options)
|
|
217
217
|
|
|
218
218
|
const perf = await intro('buddy make:notification')
|
|
@@ -247,7 +247,7 @@ export function make(buddy: CLI) {
|
|
|
247
247
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
248
248
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
249
249
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
250
|
-
.action((name, options: MakeOptions) => {
|
|
250
|
+
.action((name: string, options: MakeOptions) => {
|
|
251
251
|
log.debug('Running `buddy make:stack` ...', options)
|
|
252
252
|
|
|
253
253
|
name = name ?? options.name
|
|
@@ -266,7 +266,7 @@ export function make(buddy: CLI) {
|
|
|
266
266
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
267
267
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
268
268
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
269
|
-
.action(async (name, options: MakeOptions) => {
|
|
269
|
+
.action(async (name: string, options: MakeOptions) => {
|
|
270
270
|
log.info('Running `buddy make:action` ...')
|
|
271
271
|
log.debug('Running `buddy make:action` ...', name, options)
|
|
272
272
|
|
|
@@ -286,7 +286,7 @@ export function make(buddy: CLI) {
|
|
|
286
286
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
287
287
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
288
288
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
289
|
-
.action(async (name, options: MakeOptions) => {
|
|
289
|
+
.action(async (name: string, options: MakeOptions) => {
|
|
290
290
|
log.debug('Running `buddy make:model` ...', options)
|
|
291
291
|
|
|
292
292
|
name = name ?? options.name
|
|
@@ -305,7 +305,7 @@ export function make(buddy: CLI) {
|
|
|
305
305
|
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
306
306
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
307
307
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
308
|
-
.action((name, options: MakeOptions) => {
|
|
308
|
+
.action((name: string, options: MakeOptions) => {
|
|
309
309
|
log.debug('Running `buddy make:migration` ...', options)
|
|
310
310
|
|
|
311
311
|
name = name ?? options.name
|
package/src/commands/migrate.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { CLI, MigrateOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { runAction } from '@stacksjs/actions'
|
|
3
4
|
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
5
|
import { Action } from '@stacksjs/enums'
|
|
5
6
|
import { ExitCode } from '@stacksjs/types'
|
|
6
|
-
import type { CLI, MigrateOptions } from '@stacksjs/types'
|
|
7
7
|
|
|
8
|
-
export function migrate(buddy: CLI) {
|
|
8
|
+
export function migrate(buddy: CLI): void {
|
|
9
9
|
const descriptions = {
|
|
10
10
|
migrate: 'Migrates your database',
|
|
11
11
|
dns: 'Writes the DNS records for a domain to ./config/dns.ts',
|
package/src/commands/outdated.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { CLI } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { log } from '@stacksjs/logging'
|
|
3
4
|
import { projectPath } from '@stacksjs/path'
|
|
4
|
-
import type { CLI, CliOptions } from '@stacksjs/types'
|
|
5
5
|
import { $ } from 'bun'
|
|
6
6
|
|
|
7
|
-
export function outdated(buddy: CLI) {
|
|
7
|
+
export function outdated(buddy: CLI): void {
|
|
8
8
|
const descriptions = {
|
|
9
9
|
outdated: 'List all the outdated project dependencies',
|
|
10
10
|
project: 'Target a specific project',
|
|
@@ -15,7 +15,7 @@ export function outdated(buddy: CLI) {
|
|
|
15
15
|
.command('outdated', descriptions.outdated)
|
|
16
16
|
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
17
17
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
18
|
-
.action(async (
|
|
18
|
+
.action(async () => {
|
|
19
19
|
log.debug('Running `buddy outdated` ...')
|
|
20
20
|
|
|
21
21
|
$.cwd(projectPath())
|
package/src/commands/ports.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import type { CLI, Ports, PortsOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { intro, italic, outro } from '@stacksjs/cli'
|
|
3
4
|
import { ports as projectPorts } from '@stacksjs/config'
|
|
4
5
|
import { log } from '@stacksjs/logging'
|
|
5
6
|
import { findProjectPath, path as p, projectPath } from '@stacksjs/path'
|
|
6
|
-
import type { CLI, Ports, PortsOptions } from '@stacksjs/types'
|
|
7
7
|
import { ExitCode } from '@stacksjs/types'
|
|
8
8
|
import { findStacksProjects } from '@stacksjs/utils'
|
|
9
9
|
import { $ } from 'bun'
|
|
10
10
|
|
|
11
|
-
export function ports(buddy: CLI) {
|
|
11
|
+
export function ports(buddy: CLI): void {
|
|
12
12
|
const descriptions = {
|
|
13
13
|
command: 'Let buddy check your project for potential issues and misconfigurations',
|
|
14
14
|
ports: 'Check if the ports are available',
|
|
@@ -31,7 +31,8 @@ export function ports(buddy: CLI) {
|
|
|
31
31
|
log.debug('Running `buddy ports` ...', options)
|
|
32
32
|
|
|
33
33
|
let perf
|
|
34
|
-
if (!options.quiet)
|
|
34
|
+
if (!options.quiet)
|
|
35
|
+
perf = await intro('buddy ports')
|
|
35
36
|
|
|
36
37
|
if (options.project) {
|
|
37
38
|
const path = await findProjectPath(options.project)
|
|
@@ -48,7 +49,8 @@ export function ports(buddy: CLI) {
|
|
|
48
49
|
outputPorts(projectPorts, options)
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
if (!options.quiet)
|
|
52
|
+
if (!options.quiet)
|
|
53
|
+
await outro('Exited', { startTime: perf, useSeconds: false })
|
|
52
54
|
|
|
53
55
|
process.exit(ExitCode.Success)
|
|
54
56
|
})
|
|
@@ -64,11 +66,13 @@ export function ports(buddy: CLI) {
|
|
|
64
66
|
log.debug('Running `buddy ports:list` ...', options)
|
|
65
67
|
|
|
66
68
|
let perf
|
|
67
|
-
if (!options.quiet)
|
|
69
|
+
if (!options.quiet)
|
|
70
|
+
perf = await intro('buddy ports:list')
|
|
68
71
|
|
|
69
72
|
// return the ports for the project
|
|
70
73
|
if (options.project) {
|
|
71
|
-
if (!options.quiet)
|
|
74
|
+
if (!options.quiet)
|
|
75
|
+
log.info(`Listing ports for project: ${italic(options.project)}`)
|
|
72
76
|
|
|
73
77
|
const path = await findProjectPath(options.project)
|
|
74
78
|
|
|
@@ -83,7 +87,8 @@ export function ports(buddy: CLI) {
|
|
|
83
87
|
outputPorts(projectPorts, options)
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
if (!options.quiet)
|
|
90
|
+
if (!options.quiet)
|
|
91
|
+
await outro('Exited', { startTime: perf, useSeconds: false })
|
|
87
92
|
|
|
88
93
|
process.exit(ExitCode.Success)
|
|
89
94
|
})
|
|
@@ -99,7 +104,8 @@ export function ports(buddy: CLI) {
|
|
|
99
104
|
log.debug('Running `buddy ports:check` ...', options)
|
|
100
105
|
|
|
101
106
|
let perf
|
|
102
|
-
if (!options.quiet)
|
|
107
|
+
if (!options.quiet)
|
|
108
|
+
perf = await intro('buddy ports:check')
|
|
103
109
|
|
|
104
110
|
const projects = await findStacksProjects(undefined, { quiet: true })
|
|
105
111
|
|
|
@@ -113,7 +119,8 @@ export function ports(buddy: CLI) {
|
|
|
113
119
|
|
|
114
120
|
log.info('ProjectsPorts:', projectsPorts)
|
|
115
121
|
|
|
116
|
-
if (!options.quiet)
|
|
122
|
+
if (!options.quiet)
|
|
123
|
+
await outro('Exited', { startTime: perf, useSeconds: false })
|
|
117
124
|
|
|
118
125
|
process.exit(ExitCode.Success)
|
|
119
126
|
})
|
|
@@ -125,7 +132,8 @@ export function ports(buddy: CLI) {
|
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
async function getPortsForProjectPath(path: string, options: PortsOptions) {
|
|
128
|
-
if (!options.quiet)
|
|
135
|
+
if (!options.quiet)
|
|
136
|
+
log.info(`Checking ports for project: ${italic(path)}`)
|
|
129
137
|
|
|
130
138
|
$.cwd(path)
|
|
131
139
|
// load the .env file for the project
|
|
@@ -137,13 +145,13 @@ async function getPortsForProjectPath(path: string, options: PortsOptions) {
|
|
|
137
145
|
// get the list of all Stacks project paths (on the system)
|
|
138
146
|
const projects = projectList
|
|
139
147
|
.split('\n')
|
|
140
|
-
.filter(
|
|
141
|
-
.map(
|
|
148
|
+
.filter(line => line.startsWith(' - '))
|
|
149
|
+
.map(line => line.trim().substring(4))
|
|
142
150
|
log.debug('Projects:', projects)
|
|
143
151
|
|
|
144
152
|
// since we are targeting a specific project, find its path
|
|
145
153
|
const ppath = options.project ?? p.projectPath()
|
|
146
|
-
let projectPath = projects.find(
|
|
154
|
+
let projectPath = projects.find(project => project.includes(ppath))
|
|
147
155
|
|
|
148
156
|
log.debug(`Checking ports for project: ${projectPath}`)
|
|
149
157
|
if (projectPath === '' || !projectPath)
|
|
@@ -159,7 +167,7 @@ async function getPortsForProjectPath(path: string, options: PortsOptions) {
|
|
|
159
167
|
let validJsonString = response.replace(/(\w+)(?=\s*:)/g, '"$1"')
|
|
160
168
|
|
|
161
169
|
// Step 2: Remove potential trailing commas before closing braces
|
|
162
|
-
validJsonString = validJsonString.replace(/,(\s
|
|
170
|
+
validJsonString = validJsonString.replace(/,(\s*\})/g, '$1')
|
|
163
171
|
|
|
164
172
|
// Now we can parse it into an object
|
|
165
173
|
const ports = JSON.parse(validJsonString) as Ports
|
|
@@ -170,9 +178,11 @@ async function getPortsForProjectPath(path: string, options: PortsOptions) {
|
|
|
170
178
|
}
|
|
171
179
|
|
|
172
180
|
function outputPorts(ports: Ports, options: PortsOptions) {
|
|
173
|
-
if (!options.quiet)
|
|
181
|
+
if (!options.quiet)
|
|
182
|
+
console.log('')
|
|
174
183
|
|
|
175
184
|
console.log(ports)
|
|
176
185
|
|
|
177
|
-
if (!options.quiet)
|
|
186
|
+
if (!options.quiet)
|
|
187
|
+
console.log('')
|
|
178
188
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { CLI, PrepublishOptions } from '@stacksjs/types'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { runAction } from '@stacksjs/actions'
|
|
3
4
|
import { Action } from '@stacksjs/enums'
|
|
4
5
|
import { log } from '@stacksjs/logging'
|
|
5
|
-
import type { CLI, PrepublishOptions } from '@stacksjs/types'
|
|
6
6
|
|
|
7
|
-
export function prepublish(buddy: CLI) {
|
|
7
|
+
export function prepublish(buddy: CLI): void {
|
|
8
8
|
const descriptions = {
|
|
9
9
|
command: 'Run your prepublish script',
|
|
10
10
|
project: 'Target a specific project',
|