@stacksjs/buddy 0.65.0 → 0.67.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-agapayce.js → chunk-3whxjf1k.js} +1 -4
- package/dist/chunk-42swmjjw.js +2 -0
- package/dist/chunk-564c63vr.js +2 -0
- package/dist/chunk-5wxk7vka.js +1 -0
- package/dist/chunk-6cscdnf5.js +2 -0
- package/dist/chunk-898dh3kh.js +8 -0
- package/dist/chunk-9g2p5d3j.js +2 -0
- package/dist/chunk-bpa4071y.js +2 -0
- package/dist/chunk-cbtnhpqk.js +2 -0
- package/dist/chunk-f18wwa85.js +827 -0
- package/dist/chunk-g767h9jq.js +3 -0
- package/dist/chunk-hgzxtrgw.js +9 -0
- package/dist/chunk-hqv9y9k2.js +6 -0
- package/dist/chunk-jfs19hhz.js +2 -0
- package/dist/chunk-ncwfzcsm.js +2 -0
- package/dist/chunk-pfb4369d.js +2 -0
- package/dist/chunk-sgm5999j.js +12 -0
- package/dist/chunk-we57sm1m.js +2 -0
- package/dist/chunk-wps8bq6b.js +2 -0
- package/dist/chunk-y2g00ayp.js +2 -0
- package/dist/chunk-ycyg22fp.js +2 -0
- package/dist/cli.js +1 -4
- package/dist/index.js +1 -4
- package/dist/stacks +0 -0
- package/package.json +48 -49
- package/dist/chunk-1bcxd9nx.js +0 -5
- package/dist/chunk-1bcxd9nx.js.map +0 -17
- package/dist/chunk-3gvx3tap.js +0 -5
- package/dist/chunk-3gvx3tap.js.map +0 -9
- package/dist/chunk-5mkzknp4.js +0 -5
- package/dist/chunk-5mkzknp4.js.map +0 -32
- package/dist/chunk-a3d48jzd.js +0 -15
- package/dist/chunk-a3d48jzd.js.map +0 -164
- package/dist/chunk-a6ba4vgs.js +0 -5
- package/dist/chunk-a6ba4vgs.js.map +0 -11
- package/dist/chunk-agapayce.js.map +0 -15
- package/dist/chunk-b9d377d9.js +0 -5
- package/dist/chunk-b9d377d9.js.map +0 -26
- package/dist/chunk-bh61bx6h.js +0 -4
- package/dist/chunk-bh61bx6h.js.map +0 -23
- package/dist/chunk-fqrjh7j8.js +0 -5
- package/dist/chunk-fqrjh7j8.js.map +0 -10
- package/dist/chunk-jkt9jxar.js +0 -9
- package/dist/chunk-jkt9jxar.js.map +0 -13
- package/dist/chunk-k1q2z202.js +0 -4
- package/dist/chunk-k1q2z202.js.map +0 -16
- package/dist/chunk-mmjggjd5.js +0 -849
- package/dist/chunk-mmjggjd5.js.map +0 -240
- package/dist/chunk-mxwvrbdh.js +0 -6
- package/dist/chunk-mxwvrbdh.js.map +0 -59
- package/dist/chunk-n55kahn5.js +0 -5
- package/dist/chunk-n55kahn5.js.map +0 -12
- package/dist/chunk-pbpgcz3v.js +0 -5
- package/dist/chunk-pbpgcz3v.js.map +0 -46
- package/dist/chunk-sadghty0.js +0 -5
- package/dist/chunk-sadghty0.js.map +0 -20
- package/dist/chunk-smzpmhmp.js +0 -11
- package/dist/chunk-smzpmhmp.js.map +0 -10
- package/dist/chunk-w4zypt02.js +0 -5
- package/dist/chunk-w4zypt02.js.map +0 -23
- package/dist/chunk-ywfsnx7v.js +0 -5
- package/dist/chunk-ywfsnx7v.js.map +0 -22
- package/dist/chunk-yxs8vtg9.js +0 -5
- package/dist/chunk-yxs8vtg9.js.map +0 -10
- package/dist/chunk-z7609s4h.js +0 -12
- package/dist/chunk-z7609s4h.js.map +0 -11
- package/dist/cli.js.map +0 -10
- package/dist/index.js.map +0 -9
- package/src/cli.ts +0 -105
- package/src/commands/add.ts +0 -71
- package/src/commands/build.ts +0 -299
- package/src/commands/changelog.ts +0 -52
- package/src/commands/clean.ts +0 -46
- package/src/commands/cloud.ts +0 -553
- package/src/commands/commit.ts +0 -26
- package/src/commands/configure.ts +0 -84
- package/src/commands/create.ts +0 -143
- package/src/commands/deploy.ts +0 -194
- package/src/commands/dev.ts +0 -292
- package/src/commands/dns.ts +0 -86
- package/src/commands/domains.ts +0 -255
- package/src/commands/fresh.ts +0 -48
- package/src/commands/generate.ts +0 -202
- package/src/commands/http.ts +0 -57
- package/src/commands/index.ts +0 -33
- package/src/commands/install.ts +0 -30
- package/src/commands/key.ts +0 -36
- package/src/commands/lint.ts +0 -54
- package/src/commands/list.ts +0 -42
- package/src/commands/make.ts +0 -352
- package/src/commands/migrate.ts +0 -105
- package/src/commands/outdated.ts +0 -31
- package/src/commands/ports.ts +0 -188
- package/src/commands/prepublish.ts +0 -28
- package/src/commands/projects.ts +0 -54
- package/src/commands/release.ts +0 -50
- package/src/commands/route.ts +0 -39
- package/src/commands/seed.ts +0 -47
- package/src/commands/setup.ts +0 -145
- package/src/commands/test.ts +0 -214
- package/src/commands/tinker.ts +0 -42
- package/src/commands/types.ts +0 -35
- package/src/commands/upgrade.ts +0 -200
- package/src/commands/version.ts +0 -29
- package/src/custom-cli.ts +0 -35
- package/src/index.ts +0 -1
package/src/commands/test.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import type { CLI, TestOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { runAction } from '@stacksjs/actions'
|
|
4
|
-
import { intro, log, outro } from '@stacksjs/cli'
|
|
5
|
-
import { Action } from '@stacksjs/enums'
|
|
6
|
-
import { projectPath } from '@stacksjs/path'
|
|
7
|
-
|
|
8
|
-
export function test(buddy: CLI): void {
|
|
9
|
-
const descriptions = {
|
|
10
|
-
command: 'Runs your test suite',
|
|
11
|
-
types: 'Typechecks your codebase',
|
|
12
|
-
coverage: 'Generates a test coverage report',
|
|
13
|
-
ui: 'Runs your test suite in the browser',
|
|
14
|
-
unit: 'Runs your unit tests',
|
|
15
|
-
feature: 'Runs your feature tests',
|
|
16
|
-
showReport: 'Show the test report',
|
|
17
|
-
project: 'Target a specific project',
|
|
18
|
-
verbose: 'Enable verbose output',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
buddy
|
|
22
|
-
.command('test', descriptions.command)
|
|
23
|
-
.option('-f, --feature', descriptions.feature, { default: false })
|
|
24
|
-
.option('-u, --unit', descriptions.unit, { default: false })
|
|
25
|
-
// .option('--ui', descriptions.ui, { default: false })
|
|
26
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
27
|
-
.option('--verbose', descriptions.verbose, { default: true })
|
|
28
|
-
.action(async (options: TestOptions) => {
|
|
29
|
-
const perf = await intro('buddy test')
|
|
30
|
-
|
|
31
|
-
if (options.feature && options.unit) {
|
|
32
|
-
const result = await runAction(Action.Test, {
|
|
33
|
-
...options,
|
|
34
|
-
cwd: projectPath(),
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
if (result.isErr()) {
|
|
38
|
-
await outro(
|
|
39
|
-
'While running `buddy test`, there was an issue',
|
|
40
|
-
{ startTime: perf, useSeconds: true },
|
|
41
|
-
result.error,
|
|
42
|
-
)
|
|
43
|
-
process.exit()
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (options.feature && !options.unit) {
|
|
48
|
-
log.info('Running Feature tests...')
|
|
49
|
-
|
|
50
|
-
const result = await runAction(Action.TestFeature, {
|
|
51
|
-
...options,
|
|
52
|
-
cwd: projectPath(),
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
if (result.isErr()) {
|
|
56
|
-
await outro(
|
|
57
|
-
'While running `buddy test`, there was an issue',
|
|
58
|
-
{ startTime: perf, useSeconds: true },
|
|
59
|
-
result.error,
|
|
60
|
-
)
|
|
61
|
-
process.exit()
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!options.feature && options.unit) {
|
|
66
|
-
log.info('Running Unit tests...')
|
|
67
|
-
|
|
68
|
-
const result = await runAction(Action.TestUnit, {
|
|
69
|
-
...options,
|
|
70
|
-
cwd: projectPath(),
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
if (result.isErr()) {
|
|
74
|
-
await outro(
|
|
75
|
-
'While running `buddy test`, there was an issue',
|
|
76
|
-
{ startTime: perf, useSeconds: true },
|
|
77
|
-
result.error,
|
|
78
|
-
)
|
|
79
|
-
process.exit()
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (!options.feature && !options.unit) {
|
|
84
|
-
const result = await runAction(Action.Test, {
|
|
85
|
-
...options,
|
|
86
|
-
cwd: projectPath(),
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
if (result.isErr()) {
|
|
90
|
-
await outro(
|
|
91
|
-
'While running `buddy test`, there was an issue',
|
|
92
|
-
{ startTime: perf, useSeconds: true },
|
|
93
|
-
result.error,
|
|
94
|
-
)
|
|
95
|
-
process.exit()
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
await outro('Finished running tests', {
|
|
100
|
-
startTime: perf,
|
|
101
|
-
useSeconds: true,
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
buddy
|
|
106
|
-
.command('test:unit', descriptions.unit)
|
|
107
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
108
|
-
.action(async (options: TestOptions) => {
|
|
109
|
-
const perf = await intro('buddy test:unit')
|
|
110
|
-
const result = await runAction(Action.TestUnit, {
|
|
111
|
-
...options,
|
|
112
|
-
verbose: true,
|
|
113
|
-
cwd: projectPath(),
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
if (result.isErr()) {
|
|
117
|
-
await outro(
|
|
118
|
-
'While running `buddy test:unit`, there was an issue',
|
|
119
|
-
{ startTime: perf, useSeconds: true },
|
|
120
|
-
result.error,
|
|
121
|
-
)
|
|
122
|
-
process.exit()
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
await outro('Finished running unit tests', {
|
|
126
|
-
startTime: perf,
|
|
127
|
-
useSeconds: true,
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
buddy
|
|
132
|
-
.command('test:feature', descriptions.feature)
|
|
133
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
134
|
-
.action(async (options: TestOptions) => {
|
|
135
|
-
const perf = await intro('buddy test:feature')
|
|
136
|
-
const result = await runAction(Action.TestFeature, {
|
|
137
|
-
...options,
|
|
138
|
-
verbose: true,
|
|
139
|
-
cwd: projectPath(),
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
if (result.isErr()) {
|
|
143
|
-
await outro(
|
|
144
|
-
'While running `buddy test:feature`, there was an issue',
|
|
145
|
-
{ startTime: perf, useSeconds: true },
|
|
146
|
-
result.error,
|
|
147
|
-
)
|
|
148
|
-
process.exit()
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
await outro('Finished running feature tests', {
|
|
152
|
-
startTime: perf,
|
|
153
|
-
useSeconds: true,
|
|
154
|
-
})
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
buddy
|
|
158
|
-
.command('test:ui', descriptions.command)
|
|
159
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
160
|
-
.action(async (options: TestOptions) => {
|
|
161
|
-
const perf = await intro('buddy test:ui')
|
|
162
|
-
const result = await runAction(Action.TestUi, {
|
|
163
|
-
...options,
|
|
164
|
-
verbose: true,
|
|
165
|
-
cwd: projectPath(),
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
if (result.isErr()) {
|
|
169
|
-
await outro(
|
|
170
|
-
'While running `buddy test:ui`, there was an issue',
|
|
171
|
-
{ startTime: perf, useSeconds: true },
|
|
172
|
-
result.error,
|
|
173
|
-
)
|
|
174
|
-
process.exit()
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
await outro('Finished running tests in the browser', {
|
|
178
|
-
startTime: perf,
|
|
179
|
-
useSeconds: true,
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
buddy
|
|
184
|
-
.command('test:types', descriptions.types)
|
|
185
|
-
.alias('typecheck')
|
|
186
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
187
|
-
.action(async (options: TestOptions) => {
|
|
188
|
-
const perf = await intro('buddy test:types')
|
|
189
|
-
const result = await runAction(Action.Typecheck, {
|
|
190
|
-
...options,
|
|
191
|
-
verbose: true,
|
|
192
|
-
cwd: projectPath(),
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
if (result.isErr()) {
|
|
196
|
-
await outro(
|
|
197
|
-
'While running `buddy test:types`, there was an issue',
|
|
198
|
-
{ startTime: perf, useSeconds: true },
|
|
199
|
-
result.error,
|
|
200
|
-
)
|
|
201
|
-
process.exit()
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
await outro('Finished running typecheck', {
|
|
205
|
-
startTime: perf,
|
|
206
|
-
useSeconds: true,
|
|
207
|
-
})
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
buddy.on('test:*', () => {
|
|
211
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
212
|
-
process.exit(1)
|
|
213
|
-
})
|
|
214
|
-
}
|
package/src/commands/tinker.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { CLI, TinkerOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { intro, log, outro, runCommand } from '@stacksjs/cli'
|
|
4
|
-
import { ExitCode } from '@stacksjs/types'
|
|
5
|
-
|
|
6
|
-
export function tinker(buddy: CLI): void {
|
|
7
|
-
const descriptions = {
|
|
8
|
-
tinker: 'Tinker with your code',
|
|
9
|
-
project: 'Target a specific project',
|
|
10
|
-
verbose: 'Enable verbose output',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
buddy
|
|
14
|
-
.command('tinker', descriptions.tinker)
|
|
15
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
16
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
17
|
-
.action(async (options: TinkerOptions) => {
|
|
18
|
-
log.debug('Running `buddy tinker` ...', options)
|
|
19
|
-
|
|
20
|
-
const perf = await intro('buddy tinker')
|
|
21
|
-
const result = await runCommand('bun repl', {
|
|
22
|
-
stdin: 'inherit',
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
if (result.isErr()) {
|
|
26
|
-
await outro(
|
|
27
|
-
'While running the tinker command, there was an issue',
|
|
28
|
-
{ startTime: perf, useSeconds: true },
|
|
29
|
-
result.error || undefined,
|
|
30
|
-
)
|
|
31
|
-
process.exit()
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
await outro('Tinker mode exited.', { startTime: perf, useSeconds: true })
|
|
35
|
-
process.exit(ExitCode.Success)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
buddy.on('tinker:*', () => {
|
|
39
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
40
|
-
process.exit(1)
|
|
41
|
-
})
|
|
42
|
-
}
|
package/src/commands/types.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { CLI, CliOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { generateTypes } from '@stacksjs/actions'
|
|
4
|
-
import { log } from '@stacksjs/logging'
|
|
5
|
-
|
|
6
|
-
export function types(buddy: CLI): void {
|
|
7
|
-
const descriptions = {
|
|
8
|
-
generate: 'Generate the types of & for your library/libraries',
|
|
9
|
-
fix: 'wip',
|
|
10
|
-
project: 'Target a specific project',
|
|
11
|
-
verbose: 'Enable verbose output',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
buddy
|
|
15
|
-
.command('types:generate', descriptions.generate)
|
|
16
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
17
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
18
|
-
.action(async (options: CliOptions) => {
|
|
19
|
-
log.debug('Running `buddy types:generate` ...', options)
|
|
20
|
-
await generateTypes()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
buddy
|
|
24
|
-
.command('types:fix', descriptions.fix)
|
|
25
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
26
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
27
|
-
.action(async () => {
|
|
28
|
-
// await fixTypes()
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
buddy.on('types:*', () => {
|
|
32
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
33
|
-
process.exit(1)
|
|
34
|
-
})
|
|
35
|
-
}
|
package/src/commands/upgrade.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import type { CLI, UpgradeOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { runAction } from '@stacksjs/actions'
|
|
4
|
-
import { intro, log, outro, prompts } from '@stacksjs/cli'
|
|
5
|
-
import { Action } from '@stacksjs/enums'
|
|
6
|
-
import { ExitCode } from '@stacksjs/types'
|
|
7
|
-
import { isString } from '@stacksjs/validation'
|
|
8
|
-
|
|
9
|
-
export function upgrade(buddy: CLI): void {
|
|
10
|
-
const descriptions = {
|
|
11
|
-
command: 'Upgrade dependencies, framework, package manager, JS/TS runtime',
|
|
12
|
-
framework: 'Upgrade the Stacks framework',
|
|
13
|
-
dependencies: 'Upgrade your dependencies (pkgx.yaml & package.json)',
|
|
14
|
-
bun: 'Upgrade Bun to the latest version',
|
|
15
|
-
shell: 'Upgrade the to the latest shell integration (currently only supports Oh My Zsh)',
|
|
16
|
-
binary:
|
|
17
|
-
'Upgrade the `stacks` binary to the latest version. Please note, the binary is moved to the `~/.stacks/bin` directory',
|
|
18
|
-
all: 'Upgrade Node, package manager, project dependencies, and framework',
|
|
19
|
-
force: 'Overwrite possible local updates with remote framework updates',
|
|
20
|
-
select: 'What are you trying to upgrade?',
|
|
21
|
-
project: 'Target a specific project',
|
|
22
|
-
verbose: 'Enable verbose output',
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
buddy
|
|
26
|
-
.command('upgrade', descriptions.command)
|
|
27
|
-
.option('-d, --dependencies', descriptions.dependencies, { default: false })
|
|
28
|
-
.option('-b, --bun', descriptions.bun, { default: false })
|
|
29
|
-
.option('-a, --all', descriptions.all, { default: false })
|
|
30
|
-
.option('-f, --force', descriptions.force, { default: false })
|
|
31
|
-
.option('--framework', descriptions.framework, { default: false })
|
|
32
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
33
|
-
.option('-s, --shell', descriptions.shell, { default: false })
|
|
34
|
-
.option('-b, --binary', descriptions.binary, { default: false })
|
|
35
|
-
// .option('--canary', descriptions.canary, { default: false })
|
|
36
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
37
|
-
.alias('update')
|
|
38
|
-
.example('buddy upgrade -a --verbose')
|
|
39
|
-
.action(async (options: UpgradeOptions) => {
|
|
40
|
-
log.debug('Running `buddy upgrade` ...', options)
|
|
41
|
-
|
|
42
|
-
const perf = await intro('buddy upgrade')
|
|
43
|
-
|
|
44
|
-
if (hasNoOptions(options)) {
|
|
45
|
-
const answers = await prompts({
|
|
46
|
-
type: 'multiselect',
|
|
47
|
-
name: 'value',
|
|
48
|
-
message: descriptions.select,
|
|
49
|
-
choices: [
|
|
50
|
-
{ value: 'dependencies', title: 'Dependencies' },
|
|
51
|
-
{ value: 'framework', title: 'Framework' },
|
|
52
|
-
{ value: 'bun', title: 'Bun' },
|
|
53
|
-
{ value: 'shell', title: 'Shell' },
|
|
54
|
-
{ value: 'binary', title: 'Binary' },
|
|
55
|
-
],
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
let answersValue = answers.value
|
|
59
|
-
|
|
60
|
-
if (answersValue !== null)
|
|
61
|
-
process.exit(ExitCode.InvalidArgument)
|
|
62
|
-
|
|
63
|
-
if (isString(answersValue))
|
|
64
|
-
answersValue = [answersValue]
|
|
65
|
-
|
|
66
|
-
// creates an object out of array and sets answers to true
|
|
67
|
-
options = answersValue.reduce((a: any, v: any) => {
|
|
68
|
-
a[v] = true
|
|
69
|
-
return a
|
|
70
|
-
}, {})
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const result = await runAction(Action.Upgrade, options)
|
|
74
|
-
|
|
75
|
-
if (result.isErr()) {
|
|
76
|
-
await outro(
|
|
77
|
-
'While running the buddy:upgrade command, there was an issue',
|
|
78
|
-
{ startTime: perf, useSeconds: true },
|
|
79
|
-
result.error,
|
|
80
|
-
)
|
|
81
|
-
process.exit()
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
await outro('Upgrade complete.', { startTime: perf, useSeconds: true })
|
|
85
|
-
process.exit()
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
buddy
|
|
89
|
-
.command('upgrade:framework', descriptions.framework)
|
|
90
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
91
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
92
|
-
.example('buddy upgrade:framework --verbose')
|
|
93
|
-
.action(async (options: UpgradeOptions) => {
|
|
94
|
-
log.debug('Running `buddy upgrade:framework` ...', options)
|
|
95
|
-
|
|
96
|
-
// const perf = await intro('buddy update:framework')
|
|
97
|
-
await runAction(Action.Upgrade, options)
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
buddy
|
|
101
|
-
.command('upgrade:dependencies', descriptions.dependencies)
|
|
102
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
103
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
104
|
-
.alias('upgrade:deps')
|
|
105
|
-
.example('buddy upgrade:dependencies --verbose')
|
|
106
|
-
.action(async (options: UpgradeOptions) => {
|
|
107
|
-
log.debug('Running `buddy upgrade:dependencies` ...', options)
|
|
108
|
-
await runAction(Action.Upgrade, options)
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
buddy
|
|
112
|
-
.command('upgrade:bun', descriptions.bun)
|
|
113
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
114
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
115
|
-
.action(async (options: UpgradeOptions) => {
|
|
116
|
-
log.debug('Running `buddy upgrade:bun` ...', options)
|
|
117
|
-
const perf = await intro('buddy upgrade:bun')
|
|
118
|
-
const result = await runAction(Action.UpgradeBun, options)
|
|
119
|
-
|
|
120
|
-
if (result.isErr()) {
|
|
121
|
-
await outro(
|
|
122
|
-
'While running the buddy upgrade:bun command, there was an issue',
|
|
123
|
-
{ startTime: perf, useSeconds: true },
|
|
124
|
-
result.error,
|
|
125
|
-
) // FIXME: should not have to cast
|
|
126
|
-
process.exit()
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
process.exit(ExitCode.Success)
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
buddy
|
|
133
|
-
.command('upgrade:all', descriptions.all)
|
|
134
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
135
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
136
|
-
.action(async (options: UpgradeOptions) => {
|
|
137
|
-
log.debug('Running `buddy upgrade:all` ...', options)
|
|
138
|
-
await runAction(Action.Upgrade, options)
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
buddy
|
|
142
|
-
.command('upgrade:shell', descriptions.shell)
|
|
143
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
144
|
-
.example('buddy upgrade:shell')
|
|
145
|
-
.action(async (options: UpgradeOptions) => {
|
|
146
|
-
log.debug('Running `buddy upgrade:shell` ...', options)
|
|
147
|
-
|
|
148
|
-
const perf = await intro('buddy upgrade:shell')
|
|
149
|
-
const result = await runAction(Action.UpgradeShell, options)
|
|
150
|
-
|
|
151
|
-
if (result.isErr()) {
|
|
152
|
-
await outro(
|
|
153
|
-
'While running the buddy upgrade:shell command, there was an issue',
|
|
154
|
-
{ startTime: perf, useSeconds: true },
|
|
155
|
-
result.error,
|
|
156
|
-
) // FIXME: should not have to cast
|
|
157
|
-
process.exit()
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
process.exit(ExitCode.Success)
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
buddy
|
|
164
|
-
.command('upgrade:binary', descriptions.binary)
|
|
165
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
166
|
-
.example('buddy upgrade:binary')
|
|
167
|
-
.action(async (options: UpgradeOptions) => {
|
|
168
|
-
if (process.getuid && process.getuid() !== 0) {
|
|
169
|
-
log.warn('To upgrade the binary, you need to run this command with sudo, or as root.')
|
|
170
|
-
process.exit(0) // Exit with an error code
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
log.debug('Running `buddy upgrade:binary` ...', options)
|
|
174
|
-
|
|
175
|
-
const perf = await intro('buddy upgrade:binary')
|
|
176
|
-
const result = await runAction(Action.UpgradeBinary, options)
|
|
177
|
-
|
|
178
|
-
if (result.isErr()) {
|
|
179
|
-
await outro(
|
|
180
|
-
'While running the buddy upgrade:binary command, there was an issue',
|
|
181
|
-
{ startTime: perf, useSeconds: true },
|
|
182
|
-
result.error,
|
|
183
|
-
) // FIXME: should not have to cast
|
|
184
|
-
process.exit()
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
process.exit(ExitCode.Success)
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
buddy.on('upgrade:*', () => {
|
|
191
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
192
|
-
process.exit(1)
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function hasNoOptions(options: UpgradeOptions) {
|
|
197
|
-
return (
|
|
198
|
-
!options.framework && !options.dependencies && !options.bun && !options.shell && !options.binary && !options.all
|
|
199
|
-
)
|
|
200
|
-
}
|
package/src/commands/version.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { CLI } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { bold, dim, green, intro, log } from '@stacksjs/cli'
|
|
4
|
-
import { storage } from '@stacksjs/storage'
|
|
5
|
-
|
|
6
|
-
export function version(buddy: CLI): void {
|
|
7
|
-
const descriptions = {
|
|
8
|
-
version: 'Retrieving Stacks build version',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
buddy.command('version', descriptions.version).action(async () => {
|
|
12
|
-
log.debug('Running `buddy version` ...')
|
|
13
|
-
await intro('buddy version')
|
|
14
|
-
|
|
15
|
-
const pkg = await storage.readPackageJson('./package.json')
|
|
16
|
-
const bunVersion = 'wip'
|
|
17
|
-
const stacksVersion = pkg.version
|
|
18
|
-
|
|
19
|
-
log.info(green(bold('@stacksjs/ ')) + dim(` ${stacksVersion}`))
|
|
20
|
-
log.info(green(bold('Bun: ')) + dim(` ${bunVersion}`))
|
|
21
|
-
|
|
22
|
-
// redis (or other cache/s), mysql (or other database/s),
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
buddy.on('version:*', () => {
|
|
26
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
27
|
-
process.exit(1)
|
|
28
|
-
})
|
|
29
|
-
}
|
package/src/custom-cli.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { cli } from '@stacksjs/cli'
|
|
3
|
-
import { config } from '@stacksjs/config'
|
|
4
|
-
import { handleError } from '@stacksjs/error-handling'
|
|
5
|
-
import { path as p } from '@stacksjs/path'
|
|
6
|
-
import { fs } from '@stacksjs/storage'
|
|
7
|
-
|
|
8
|
-
// setup global error handlers
|
|
9
|
-
process.on('uncaughtException', handleError)
|
|
10
|
-
process.on('unhandledRejection', handleError)
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
const buddy = cli(config.cli.name)
|
|
14
|
-
|
|
15
|
-
if (!fs.existsSync(p.projectPath(config.cli.command)))
|
|
16
|
-
fs.writeFileSync(p.projectPath(config.cli.command), `import('./storage/framework/core/buddy/src/custom-cli')`)
|
|
17
|
-
|
|
18
|
-
// dynamically import and register commands from ./app/Commands/*
|
|
19
|
-
const commandsDir = p.appPath('Commands')
|
|
20
|
-
const commandFiles = fs.readdirSync(commandsDir).filter((file: string) => file.endsWith('.ts'))
|
|
21
|
-
|
|
22
|
-
for (const file of commandFiles) {
|
|
23
|
-
const commandPath = `${commandsDir}/${file}`
|
|
24
|
-
const dynamicImport = await import(commandPath)
|
|
25
|
-
|
|
26
|
-
// Correctly use the default export function
|
|
27
|
-
if (typeof dynamicImport.default === 'function')
|
|
28
|
-
dynamicImport.default(buddy)
|
|
29
|
-
else console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
buddy.parse()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
await main()
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './commands'
|