@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/upgrade.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import { runAction } from '@stacksjs/actions'
|
|
3
3
|
import { intro, log, outro } from '@stacksjs/cli'
|
|
4
|
+
import { Action } from '@stacksjs/enums'
|
|
4
5
|
import { ExitCode } from '@stacksjs/types'
|
|
5
6
|
import type { CLI, UpgradeOptions } from '@stacksjs/types'
|
|
6
|
-
import {
|
|
7
|
+
import { isString } from '@stacksjs/validation'
|
|
7
8
|
|
|
8
9
|
export function upgrade(buddy: CLI) {
|
|
9
10
|
const descriptions = {
|
|
@@ -12,7 +13,8 @@ export function upgrade(buddy: CLI) {
|
|
|
12
13
|
dependencies: 'Upgrade your dependencies (pkgx.yaml & package.json)',
|
|
13
14
|
bun: 'Upgrade Bun to the latest version',
|
|
14
15
|
shell: 'Upgrade the to the latest shell integration (currently only supports Oh My Zsh)',
|
|
15
|
-
binary:
|
|
16
|
+
binary:
|
|
17
|
+
'Upgrade the `stacks` binary to the latest version. Please note, the binary is moved to the `~/.stacks/bin` directory',
|
|
16
18
|
all: 'Upgrade Node, package manager, project dependencies, and framework',
|
|
17
19
|
force: 'Overwrite possible local updates with remote framework updates',
|
|
18
20
|
select: 'What are you trying to upgrade?',
|
|
@@ -27,7 +29,7 @@ export function upgrade(buddy: CLI) {
|
|
|
27
29
|
.option('-a, --all', descriptions.all, { default: false })
|
|
28
30
|
.option('-f, --force', descriptions.force, { default: false })
|
|
29
31
|
.option('--framework', descriptions.framework, { default: false })
|
|
30
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
32
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
31
33
|
.option('-s, --shell', descriptions.shell, { default: false })
|
|
32
34
|
.option('-b, --binary', descriptions.binary, { default: false })
|
|
33
35
|
// .option('--canary', descriptions.canary, { default: false })
|
|
@@ -40,31 +42,35 @@ export function upgrade(buddy: CLI) {
|
|
|
40
42
|
const perf = await intro('buddy upgrade')
|
|
41
43
|
|
|
42
44
|
if (hasNoOptions(options)) {
|
|
43
|
-
let answers = await log.prompt.require()
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (isString(answers))
|
|
58
|
-
answers = [answers]
|
|
45
|
+
let answers = await log.prompt.require().multiselect(descriptions.select, {
|
|
46
|
+
options: [
|
|
47
|
+
{ value: 'dependencies', label: 'Dependencies' },
|
|
48
|
+
{ value: 'framework', label: 'Framework' },
|
|
49
|
+
{ value: 'bun', label: 'Bun' },
|
|
50
|
+
{ value: 'shell', label: 'Shell' },
|
|
51
|
+
{ value: 'binary', label: 'Binary' },
|
|
52
|
+
],
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
if (answers !== null) process.exit(ExitCode.InvalidArgument)
|
|
56
|
+
|
|
57
|
+
if (isString(answers)) answers = [answers]
|
|
59
58
|
|
|
60
59
|
// creates an object out of array and sets answers to true
|
|
61
|
-
options = answers.reduce((a: any, v: any) =>
|
|
60
|
+
options = answers.reduce((a: any, v: any) => {
|
|
61
|
+
a[v] = true
|
|
62
|
+
return a
|
|
63
|
+
}, {})
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
const result = await runAction(Action.Upgrade, options)
|
|
65
67
|
|
|
66
68
|
if (result.isErr()) {
|
|
67
|
-
await outro(
|
|
69
|
+
await outro(
|
|
70
|
+
'While running the buddy:upgrade command, there was an issue',
|
|
71
|
+
{ startTime: perf, useSeconds: true },
|
|
72
|
+
result.error,
|
|
73
|
+
)
|
|
68
74
|
process.exit()
|
|
69
75
|
}
|
|
70
76
|
|
|
@@ -74,7 +80,7 @@ export function upgrade(buddy: CLI) {
|
|
|
74
80
|
|
|
75
81
|
buddy
|
|
76
82
|
.command('upgrade:framework', descriptions.framework)
|
|
77
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
83
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
78
84
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
79
85
|
.example('buddy upgrade:framework --verbose')
|
|
80
86
|
.action(async (options: UpgradeOptions) => {
|
|
@@ -86,7 +92,7 @@ export function upgrade(buddy: CLI) {
|
|
|
86
92
|
|
|
87
93
|
buddy
|
|
88
94
|
.command('upgrade:dependencies', descriptions.dependencies)
|
|
89
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
95
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
90
96
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
91
97
|
.alias('upgrade:deps')
|
|
92
98
|
.example('buddy upgrade:dependencies --verbose')
|
|
@@ -97,7 +103,7 @@ export function upgrade(buddy: CLI) {
|
|
|
97
103
|
|
|
98
104
|
buddy
|
|
99
105
|
.command('upgrade:bun', descriptions.bun)
|
|
100
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
106
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
101
107
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
102
108
|
.action(async (options: UpgradeOptions) => {
|
|
103
109
|
log.debug('Running `buddy upgrade:bun` ...', options)
|
|
@@ -105,7 +111,11 @@ export function upgrade(buddy: CLI) {
|
|
|
105
111
|
const result = await runAction(Action.UpgradeBun, options)
|
|
106
112
|
|
|
107
113
|
if (result.isErr()) {
|
|
108
|
-
await outro(
|
|
114
|
+
await outro(
|
|
115
|
+
'While running the buddy upgrade:bun command, there was an issue',
|
|
116
|
+
{ startTime: perf, useSeconds: true },
|
|
117
|
+
result.error,
|
|
118
|
+
) // FIXME: should not have to cast
|
|
109
119
|
process.exit()
|
|
110
120
|
}
|
|
111
121
|
|
|
@@ -114,7 +124,7 @@ export function upgrade(buddy: CLI) {
|
|
|
114
124
|
|
|
115
125
|
buddy
|
|
116
126
|
.command('upgrade:all', descriptions.all)
|
|
117
|
-
.option('-p, --project', descriptions.project, { default: false })
|
|
127
|
+
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
118
128
|
.option('--verbose', descriptions.verbose, { default: false })
|
|
119
129
|
.action(async (options: UpgradeOptions) => {
|
|
120
130
|
log.debug('Running `buddy upgrade:all` ...', options)
|
|
@@ -132,7 +142,11 @@ export function upgrade(buddy: CLI) {
|
|
|
132
142
|
const result = await runAction(Action.UpgradeShell, options)
|
|
133
143
|
|
|
134
144
|
if (result.isErr()) {
|
|
135
|
-
await outro(
|
|
145
|
+
await outro(
|
|
146
|
+
'While running the buddy upgrade:shell command, there was an issue',
|
|
147
|
+
{ startTime: perf, useSeconds: true },
|
|
148
|
+
result.error,
|
|
149
|
+
) // FIXME: should not have to cast
|
|
136
150
|
process.exit()
|
|
137
151
|
}
|
|
138
152
|
|
|
@@ -155,7 +169,11 @@ export function upgrade(buddy: CLI) {
|
|
|
155
169
|
const result = await runAction(Action.UpgradeBinary, options)
|
|
156
170
|
|
|
157
171
|
if (result.isErr()) {
|
|
158
|
-
await outro(
|
|
172
|
+
await outro(
|
|
173
|
+
'While running the buddy upgrade:binary command, there was an issue',
|
|
174
|
+
{ startTime: perf, useSeconds: true },
|
|
175
|
+
result.error,
|
|
176
|
+
) // FIXME: should not have to cast
|
|
159
177
|
process.exit()
|
|
160
178
|
}
|
|
161
179
|
|
|
@@ -169,5 +187,7 @@ export function upgrade(buddy: CLI) {
|
|
|
169
187
|
}
|
|
170
188
|
|
|
171
189
|
function hasNoOptions(options: UpgradeOptions) {
|
|
172
|
-
return
|
|
190
|
+
return (
|
|
191
|
+
!options.framework && !options.dependencies && !options.bun && !options.shell && !options.binary && !options.all
|
|
192
|
+
)
|
|
173
193
|
}
|
package/src/commands/version.ts
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import type { CLI } from '@stacksjs/types'
|
|
3
2
|
import { bold, dim, green, intro, log } from '@stacksjs/cli'
|
|
4
3
|
import { storage } from '@stacksjs/storage'
|
|
4
|
+
import type { CLI } from '@stacksjs/types'
|
|
5
5
|
|
|
6
6
|
export function version(buddy: CLI) {
|
|
7
7
|
const descriptions = {
|
|
8
8
|
version: 'Retrieving Stacks build version',
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
buddy
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
log.debug('Running `buddy version` ...')
|
|
15
|
-
await intro('buddy version')
|
|
11
|
+
buddy.command('version', descriptions.version).action(async () => {
|
|
12
|
+
log.debug('Running `buddy version` ...')
|
|
13
|
+
await intro('buddy version')
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const pkg = await storage.readPackageJson('./package.json')
|
|
16
|
+
const bunVersion = 'wip'
|
|
17
|
+
const stacksVersion = pkg.version
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
log.info(green(bold('@stacksjs/ ')) + dim(` ${stacksVersion}`))
|
|
20
|
+
log.info(green(bold('Bun: ')) + dim(` ${bunVersion}`))
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
// redis (or other cache/s), mysql (or other database/s),
|
|
23
|
+
})
|
|
26
24
|
|
|
27
25
|
buddy.on('version:*', () => {
|
|
28
26
|
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
package/src/custom-cli.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { handleError } from '@stacksjs/error-handling'
|
|
3
|
-
import { config } from '@stacksjs/config'
|
|
4
2
|
import { cli } from '@stacksjs/cli'
|
|
3
|
+
import { config } from '@stacksjs/config'
|
|
4
|
+
import { handleError } from '@stacksjs/error-handling'
|
|
5
5
|
import { path as p } from '@stacksjs/path'
|
|
6
6
|
import { fs } from '@stacksjs/storage'
|
|
7
7
|
|
|
@@ -17,17 +17,15 @@ async function main() {
|
|
|
17
17
|
|
|
18
18
|
// dynamically import and register commands from ./app/Commands/*
|
|
19
19
|
const commandsDir = p.appPath('Commands')
|
|
20
|
-
const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
|
|
20
|
+
const commandFiles = fs.readdirSync(commandsDir).filter((file) => file.endsWith('.ts'))
|
|
21
21
|
|
|
22
22
|
for (const file of commandFiles) {
|
|
23
23
|
const commandPath = `${commandsDir}/${file}`
|
|
24
24
|
const dynamicImport = await import(commandPath)
|
|
25
25
|
|
|
26
26
|
// Correctly use the default export function
|
|
27
|
-
if (typeof dynamicImport.default === 'function')
|
|
28
|
-
|
|
29
|
-
else
|
|
30
|
-
console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
|
|
27
|
+
if (typeof dynamicImport.default === 'function') dynamicImport.default(buddy)
|
|
28
|
+
else console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
buddy.parse()
|
package/dist/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/commands/build.d.ts
DELETED
package/dist/commands/clean.d.ts
DELETED
package/dist/commands/cloud.d.ts
DELETED
package/dist/commands/dev.d.ts
DELETED
package/dist/commands/dns.d.ts
DELETED
package/dist/commands/fresh.d.ts
DELETED
package/dist/commands/http.d.ts
DELETED
package/dist/commands/index.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export * from './build';
|
|
2
|
-
export * from './changelog';
|
|
3
|
-
export * from './clean';
|
|
4
|
-
export * from './cloud';
|
|
5
|
-
export * from './commit';
|
|
6
|
-
export * from './configure';
|
|
7
|
-
export * from './create';
|
|
8
|
-
export * from './deploy';
|
|
9
|
-
export * from './dev';
|
|
10
|
-
export * from './domains';
|
|
11
|
-
export * from './dns';
|
|
12
|
-
export * from './fresh';
|
|
13
|
-
export * from './generate';
|
|
14
|
-
export * from './http';
|
|
15
|
-
export * from './lint';
|
|
16
|
-
export * from './list';
|
|
17
|
-
export * from './install';
|
|
18
|
-
export * from './key';
|
|
19
|
-
export * from './make';
|
|
20
|
-
export * from './migrate';
|
|
21
|
-
export * from './ports';
|
|
22
|
-
export * from './prepublish';
|
|
23
|
-
export * from './projects';
|
|
24
|
-
export * from './release';
|
|
25
|
-
export * from './seed';
|
|
26
|
-
export * from './setup';
|
|
27
|
-
export * from './test';
|
|
28
|
-
export * from './tinker';
|
|
29
|
-
export * from './types';
|
|
30
|
-
export * from './upgrade';
|
|
31
|
-
export * from './version';
|
package/dist/commands/key.d.ts
DELETED
package/dist/commands/lint.d.ts
DELETED
package/dist/commands/list.d.ts
DELETED
package/dist/commands/make.d.ts
DELETED
package/dist/commands/ports.d.ts
DELETED
package/dist/commands/seed.d.ts
DELETED
package/dist/commands/setup.d.ts
DELETED
package/dist/commands/test.d.ts
DELETED
package/dist/commands/types.d.ts
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './commands';
|