Skip to content

Commit 0bacdf1

Browse files
committed
chore: wip
1 parent e3f7e98 commit 0bacdf1

File tree

6 files changed

+30
-2
lines changed

6 files changed

+30
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ buddy make:notification welcome-email # bootstraps a welcome-email notification
225225
buddy make:lang de # bootstraps a lang/de.yml language file
226226
buddy make:stack my-project # shares logic with `bunx stacks new my-project`
227227

228+
buddy migrate # runs database migrations
229+
buddy migrate:dns # sets the ./config/dns.ts file
230+
231+
buddy dns example.com # list all DNS records for example.com
232+
buddy dns example.com --type MX # list MX records for example.com
233+
228234
buddy lint # runs linter
229235
buddy lint:fix # runs linter and fixes issues
230236

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// wip

storage/framework/.stacks/core/buddy/src/commands/migrate.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import process from 'node:process'
22
import { ExitCode } from '@stacksjs/types'
3-
import type { CLI, FreshOptions } from '@stacksjs/types'
3+
import type { CLI, MigrateOptions } from '@stacksjs/types'
44
import { runAction } from '@stacksjs/actions'
55
import { intro, outro } from '@stacksjs/cli'
66
import { Action } from '@stacksjs/enums'
77

88
export function migrate(buddy: CLI) {
99
const descriptions = {
1010
migrate: 'Migrates your database',
11+
dns: 'Writes the DNS records for a domain to ./config/dns.ts',
1112
verbose: 'Enable verbose output',
1213
}
1314

1415
buddy
1516
.command('migrate', descriptions.migrate)
1617
.option('--verbose', descriptions.verbose, { default: false })
17-
.action(async (options: FreshOptions) => {
18+
.action(async (options: MigrateOptions) => {
1819
const perf = await intro('buddy migrate')
1920
const result = await runAction(Action.Migrate, { ...options })
2021

@@ -29,6 +30,24 @@ export function migrate(buddy: CLI) {
2930
process.exit(ExitCode.Success)
3031
})
3132

33+
buddy
34+
.command('migrate:dns', descriptions.migrate)
35+
.option('--verbose', descriptions.verbose, { default: false })
36+
.action(async (options: MigrateOptions) => {
37+
const perf = await intro('buddy migrate')
38+
const result = await runAction(Action.MigrateDns, { ...options })
39+
40+
if (result.isErr()) {
41+
await outro('While running the migrate:dns command, there was an issue', { startTime: perf, useSeconds: true }, result.error)
42+
process.exit()
43+
}
44+
45+
const APP_URL = process.env.APP_URL || 'undefined'
46+
47+
await outro(`Migrated your ${APP_URL} DNS.`, { startTime: perf, useSeconds: true })
48+
process.exit(ExitCode.Success)
49+
})
50+
3251
buddy.on('migrate:*', () => {
3352
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
3453
process.exit(1)

storage/framework/.stacks/core/enums/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export enum Action {
7575
KeyGenerate = 'key-generate',
7676
MakeNotification = 'make-notification',
7777
Migrate = 'migrate',
78+
MigrateDns = 'migrate/dns',
7879
Seed = 'seed',
7980
Lint = 'lint/index',
8081
LintFix = 'lint/fix',

storage/framework/.stacks/core/types/src/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ export interface CloudCliOptions extends CliOptions {
291291
export interface CommitOptions extends CliOptions { }
292292
export interface KeyOptions extends CliOptions { }
293293
export interface FreshOptions extends CliOptions { }
294+
export interface MigrateOptions extends CliOptions { }
294295
export interface InspireOptions extends CliOptions { }
295296
export interface InstallOptions extends CliOptions { }
296297
export interface ReleaseOptions extends CliOptions { }

0 commit comments

Comments
 (0)