stacks 0.66.0 → 0.68.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/package.json +54 -49
- package/buddy/README.md +0 -396
- package/buddy/art/social.jpg +0 -0
- package/buddy/bin/cli.ts +0 -85
- package/buddy/build.ts +0 -43
- package/buddy/package.json +0 -129
- package/buddy/src/cli.ts +0 -105
- package/buddy/src/commands/add.ts +0 -71
- package/buddy/src/commands/build.ts +0 -299
- package/buddy/src/commands/changelog.ts +0 -52
- package/buddy/src/commands/clean.ts +0 -46
- package/buddy/src/commands/cloud.ts +0 -553
- package/buddy/src/commands/commit.ts +0 -26
- package/buddy/src/commands/configure.ts +0 -84
- package/buddy/src/commands/create.ts +0 -143
- package/buddy/src/commands/deploy.ts +0 -194
- package/buddy/src/commands/dev.ts +0 -292
- package/buddy/src/commands/dns.ts +0 -86
- package/buddy/src/commands/domains.ts +0 -255
- package/buddy/src/commands/fresh.ts +0 -48
- package/buddy/src/commands/generate.ts +0 -202
- package/buddy/src/commands/http.ts +0 -57
- package/buddy/src/commands/index.ts +0 -33
- package/buddy/src/commands/install.ts +0 -30
- package/buddy/src/commands/key.ts +0 -36
- package/buddy/src/commands/lint.ts +0 -54
- package/buddy/src/commands/list.ts +0 -42
- package/buddy/src/commands/make.ts +0 -352
- package/buddy/src/commands/migrate.ts +0 -105
- package/buddy/src/commands/outdated.ts +0 -31
- package/buddy/src/commands/ports.ts +0 -188
- package/buddy/src/commands/prepublish.ts +0 -28
- package/buddy/src/commands/projects.ts +0 -54
- package/buddy/src/commands/release.ts +0 -47
- package/buddy/src/commands/route.ts +0 -39
- package/buddy/src/commands/seed.ts +0 -47
- package/buddy/src/commands/setup.ts +0 -145
- package/buddy/src/commands/test.ts +0 -214
- package/buddy/src/commands/tinker.ts +0 -42
- package/buddy/src/commands/types.ts +0 -35
- package/buddy/src/commands/upgrade.ts +0 -200
- package/buddy/src/commands/version.ts +0 -29
- package/buddy/src/custom-cli.ts +0 -35
- package/buddy/src/index.ts +0 -1
- package/buddy/tsconfig.json +0 -3
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { CLI, PrepublishOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { runAction } from '@stacksjs/actions'
|
|
4
|
-
import { Action } from '@stacksjs/enums'
|
|
5
|
-
import { log } from '@stacksjs/logging'
|
|
6
|
-
|
|
7
|
-
export function prepublish(buddy: CLI): void {
|
|
8
|
-
const descriptions = {
|
|
9
|
-
command: 'Run your prepublish script',
|
|
10
|
-
project: 'Target a specific project',
|
|
11
|
-
verbose: 'Enable verbose output',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
buddy
|
|
15
|
-
.command('prepublish', descriptions.command)
|
|
16
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
17
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
18
|
-
.action(async (options: PrepublishOptions) => {
|
|
19
|
-
log.debug('Running `buddy prepublish` ...', options)
|
|
20
|
-
|
|
21
|
-
await runAction(Action.Prepublish, options)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
buddy.on('prepublish:*', () => {
|
|
25
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
26
|
-
process.exit(1)
|
|
27
|
-
})
|
|
28
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { CLI, ProjectsOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { intro, log } from '@stacksjs/cli'
|
|
4
|
-
import { ExitCode } from '@stacksjs/types'
|
|
5
|
-
import { findStacksProjects } from '@stacksjs/utils'
|
|
6
|
-
|
|
7
|
-
export function projects(buddy: CLI): void {
|
|
8
|
-
const descriptions = {
|
|
9
|
-
projects: 'Find all Stacks projects on your system',
|
|
10
|
-
verbose: 'Enable verbose output',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
buddy
|
|
14
|
-
.command('projects', descriptions.projects)
|
|
15
|
-
.option('-q, --quiet', 'Use minimal output', { default: false })
|
|
16
|
-
.option('-l, --list', 'List all local Stacks projects', { default: false })
|
|
17
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
18
|
-
.action(async (options: ProjectsOptions) => {
|
|
19
|
-
log.debug('Running `buddy projects` ...', options)
|
|
20
|
-
|
|
21
|
-
if (!options.quiet)
|
|
22
|
-
await intro('buddy projects')
|
|
23
|
-
|
|
24
|
-
const projects = await findStacksProjects(undefined, options)
|
|
25
|
-
|
|
26
|
-
for (const project of projects) console.log(' - ', project)
|
|
27
|
-
|
|
28
|
-
process.exit(ExitCode.Success)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
buddy
|
|
32
|
-
.command('projects:list', descriptions.projects)
|
|
33
|
-
.option('-q, --quiet', 'Use minimal output', { default: false })
|
|
34
|
-
.option('-l, --list', 'List all local Stacks projects', { default: true })
|
|
35
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
36
|
-
.action(async (options: ProjectsOptions) => {
|
|
37
|
-
log.debug('Running `buddy projects` ...', options)
|
|
38
|
-
|
|
39
|
-
if (!options.quiet)
|
|
40
|
-
await intro('buddy projects:list')
|
|
41
|
-
|
|
42
|
-
// uses os.homedir() as the default path
|
|
43
|
-
const projects = await findStacksProjects(undefined, options)
|
|
44
|
-
|
|
45
|
-
for (const project of projects) console.log(' - ', project)
|
|
46
|
-
|
|
47
|
-
process.exit(ExitCode.Success)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
buddy.on('projects:*', () => {
|
|
51
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
52
|
-
process.exit(1)
|
|
53
|
-
})
|
|
54
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { CLI, ReleaseOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { runAction } from '@stacksjs/actions'
|
|
4
|
-
import { intro, italic, log, outro } from '@stacksjs/cli'
|
|
5
|
-
import { Action } from '@stacksjs/enums'
|
|
6
|
-
import { ExitCode } from '@stacksjs/types'
|
|
7
|
-
|
|
8
|
-
const descriptions = {
|
|
9
|
-
release: 'Release a new version of your libraries/packages',
|
|
10
|
-
project: 'Target a specific project',
|
|
11
|
-
dryRun: 'Run the release without actually releasing',
|
|
12
|
-
verbose: 'Enable verbose output',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function release(buddy: CLI): void {
|
|
16
|
-
buddy
|
|
17
|
-
.command('release', descriptions.release)
|
|
18
|
-
.option('--dry-run', descriptions.dryRun, { default: false })
|
|
19
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
20
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
21
|
-
.action(async (options: ReleaseOptions) => {
|
|
22
|
-
log.debug('Running `buddy release` ...', options)
|
|
23
|
-
|
|
24
|
-
if (options.dryRun)
|
|
25
|
-
log.warn('Dry run enabled. No changes will be made or committed.')
|
|
26
|
-
|
|
27
|
-
const startTime = await intro('buddy release')
|
|
28
|
-
const result = await runAction(Action.Release, options)
|
|
29
|
-
|
|
30
|
-
if (result.isErr()) {
|
|
31
|
-
log.error('Failed to release', result.error)
|
|
32
|
-
process.exit(ExitCode.FatalError)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
await outro('Triggered CI/CD Release via GitHub Actions', {
|
|
36
|
-
startTime,
|
|
37
|
-
useSeconds: true,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
log.info(`Follow along: ${italic('https://github.com/stacksjs/stacks/actions')}`)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
buddy.on('release:*', () => {
|
|
44
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
45
|
-
process.exit(1)
|
|
46
|
-
})
|
|
47
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { CLI, MigrateOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { runAction } from '@stacksjs/actions'
|
|
4
|
-
import { intro, outro } from '@stacksjs/cli'
|
|
5
|
-
import { Action } from '@stacksjs/enums'
|
|
6
|
-
import { ExitCode } from '@stacksjs/types'
|
|
7
|
-
|
|
8
|
-
export function route(buddy: CLI): void {
|
|
9
|
-
const descriptions = {
|
|
10
|
-
route: 'Lists your routes',
|
|
11
|
-
verbose: 'Enable verbose output',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
buddy
|
|
15
|
-
.command('route:list', descriptions.route)
|
|
16
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
17
|
-
.action(async (options: MigrateOptions) => {
|
|
18
|
-
const perf = await intro('buddy route:list')
|
|
19
|
-
const result = await runAction(Action.RouteList, options)
|
|
20
|
-
|
|
21
|
-
if (result.isErr()) {
|
|
22
|
-
await outro(
|
|
23
|
-
'While running the migrate command, there was an issue',
|
|
24
|
-
{ startTime: perf, useSeconds: true },
|
|
25
|
-
result.error,
|
|
26
|
-
)
|
|
27
|
-
process.exit()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
await outro(`Successfully listed routes`)
|
|
31
|
-
|
|
32
|
-
process.exit(ExitCode.Success)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
buddy.on('route:*', () => {
|
|
36
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
37
|
-
process.exit(1)
|
|
38
|
-
})
|
|
39
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { CLI, SeedOptions } 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 { ExitCode } from '@stacksjs/types'
|
|
7
|
-
|
|
8
|
-
export function seed(buddy: CLI): void {
|
|
9
|
-
const descriptions = {
|
|
10
|
-
seed: 'Seed your database',
|
|
11
|
-
project: 'Target a specific project',
|
|
12
|
-
verbose: 'Enable verbose output',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
buddy
|
|
16
|
-
.command('seed', descriptions.seed)
|
|
17
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
18
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
19
|
-
.action(async (options: SeedOptions) => {
|
|
20
|
-
log.debug('Running `buddy seed` ...', options)
|
|
21
|
-
|
|
22
|
-
const perf = await intro('buddy seed')
|
|
23
|
-
const result = await runAction(Action.Seed, options)
|
|
24
|
-
|
|
25
|
-
if (result.isErr()) {
|
|
26
|
-
await outro(
|
|
27
|
-
'While running the seed command, there was an issue',
|
|
28
|
-
{ startTime: perf, useSeconds: true },
|
|
29
|
-
result.error,
|
|
30
|
-
)
|
|
31
|
-
process.exit(ExitCode.FatalError)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const APP_ENV = process.env.APP_ENV || 'local'
|
|
35
|
-
|
|
36
|
-
await outro(`Seeded your ${APP_ENV} database.`, {
|
|
37
|
-
startTime: perf,
|
|
38
|
-
useSeconds: true,
|
|
39
|
-
})
|
|
40
|
-
process.exit(ExitCode.Success)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
buddy.on('seed:*', () => {
|
|
44
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
45
|
-
process.exit(1)
|
|
46
|
-
})
|
|
47
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import type { CLI, CliOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { runAction } from '@stacksjs/actions'
|
|
4
|
-
import { log, runCommand } from '@stacksjs/cli'
|
|
5
|
-
import { Action } from '@stacksjs/enums'
|
|
6
|
-
import { handleError } from '@stacksjs/error-handling'
|
|
7
|
-
import { path as p } from '@stacksjs/path'
|
|
8
|
-
import { storage } from '@stacksjs/storage'
|
|
9
|
-
import { ExitCode } from '@stacksjs/types'
|
|
10
|
-
|
|
11
|
-
export function setup(buddy: CLI): void {
|
|
12
|
-
const descriptions = {
|
|
13
|
-
setup: 'This command ensures your project is setup correctly',
|
|
14
|
-
ohMyZsh: 'Enable Oh My Zsh',
|
|
15
|
-
aws: 'Ensures AWS is connected to the project',
|
|
16
|
-
project: 'Target a specific project',
|
|
17
|
-
verbose: 'Enable verbose output',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
buddy
|
|
21
|
-
.command('setup', descriptions.setup)
|
|
22
|
-
.alias('ensure')
|
|
23
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
24
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
25
|
-
.action(async (options: CliOptions) => {
|
|
26
|
-
log.debug('Running `buddy setup` ...', options)
|
|
27
|
-
|
|
28
|
-
if (!(await isPkgxInstalled()))
|
|
29
|
-
await installPkgx()
|
|
30
|
-
|
|
31
|
-
// ensure the minimal amount of deps are written to ./pkgx.yaml
|
|
32
|
-
await optimizePkgxDeps()
|
|
33
|
-
|
|
34
|
-
// TODO: optimizeConfigDir()
|
|
35
|
-
// TODO: optimizeAddDir()
|
|
36
|
-
|
|
37
|
-
await initializeProject(options)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
buddy
|
|
41
|
-
.command('setup:oh-my-zsh', descriptions.ohMyZsh) // if triggered multiple times, it will update the plugin
|
|
42
|
-
.alias('upgrade:oh-my-zsh')
|
|
43
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
44
|
-
.action(async (_options?: CliOptions) => {
|
|
45
|
-
log.debug('Running `buddy setup:oh-my-zsh` ...', _options)
|
|
46
|
-
const result = await runAction(Action.UpgradeShell)
|
|
47
|
-
|
|
48
|
-
if (result.isErr()) {
|
|
49
|
-
log.error(result.error)
|
|
50
|
-
process.exit(ExitCode.FatalError)
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
buddy.on('setup:*', () => {
|
|
55
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
56
|
-
process.exit(ExitCode.FatalError)
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function isPkgxInstalled(): Promise<boolean> {
|
|
61
|
-
const result = await runCommand('pkgx --version', { silent: true })
|
|
62
|
-
|
|
63
|
-
if (result.isOk())
|
|
64
|
-
return true
|
|
65
|
-
|
|
66
|
-
return false
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function installPkgx(): Promise<void> {
|
|
70
|
-
const result = await runCommand(p.frameworkPath('scripts/pkgx-install'))
|
|
71
|
-
|
|
72
|
-
if (result.isOk())
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
handleError(result.error)
|
|
76
|
-
process.exit(ExitCode.FatalError)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function initializeProject(options: CliOptions): Promise<void> {
|
|
80
|
-
log.info('Installing dependencies...')
|
|
81
|
-
|
|
82
|
-
const result = await runCommand('bun install', {
|
|
83
|
-
cwd: options.cwd || p.projectPath(),
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
if (result.isErr()) {
|
|
87
|
-
handleError(result.error)
|
|
88
|
-
process.exit(ExitCode.FatalError)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
log.success('Installed node_modules')
|
|
92
|
-
|
|
93
|
-
ensureEnvIsSet(options)
|
|
94
|
-
|
|
95
|
-
const keyResult = await runCommand('buddy key:generate', {
|
|
96
|
-
cwd: options.cwd || p.projectPath(),
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
if (keyResult.isErr()) {
|
|
100
|
-
handleError(keyResult.error)
|
|
101
|
-
process.exit(ExitCode.FatalError)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
log.info('Ensuring AWS is connected...')
|
|
105
|
-
|
|
106
|
-
const awsResult = await runCommand('buddy configure:aws', {
|
|
107
|
-
cwd: options.cwd || p.projectPath(),
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
if (awsResult.isErr()) {
|
|
111
|
-
handleError(awsResult.error)
|
|
112
|
-
process.exit(ExitCode.FatalError)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
log.success('Configured AWS')
|
|
116
|
-
|
|
117
|
-
// TODO: ensure the IDE is setup by making sure .vscode etc exists, and if not, copy them over
|
|
118
|
-
|
|
119
|
-
log.success('Project is setup')
|
|
120
|
-
log.info('Happy coding! 💙')
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export async function optimizePkgxDeps(): Promise<void> {
|
|
124
|
-
return new Promise(resolve => setTimeout(resolve, 300))
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export async function ensureEnvIsSet(options: CliOptions): Promise<void> {
|
|
128
|
-
log.info('Ensuring .env exists...')
|
|
129
|
-
|
|
130
|
-
if (storage.doesNotExist(p.projectPath('.env'))) {
|
|
131
|
-
const envResult = await runCommand('cp .env.example .env', {
|
|
132
|
-
cwd: options.cwd || p.projectPath(),
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
if (envResult.isErr()) {
|
|
136
|
-
handleError(envResult.error)
|
|
137
|
-
process.exit(ExitCode.FatalError)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
log.success('.env created')
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
log.success('.env existed')
|
|
144
|
-
}
|
|
145
|
-
}
|
|
@@ -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
|
-
}
|
|
@@ -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
|
-
}
|
|
@@ -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
|
-
}
|