Skip to content

Commit ec4a2fd

Browse files
committed
chore: wip
1 parent 7bceb8d commit ec4a2fd

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

bun.lockb

2.88 KB
Binary file not shown.

storage/framework/core/buddy/src/commands/configure.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ async function configureAws(options?: ConfigureOptions) {
6262
const defaultRegion = 'us-east-1' // we only support `us-east-1` for now
6363
const defaultOutputFormat = options?.output ?? 'json'
6464

65-
const command = `aws configure --profile ${options?.profile ?? process.env.AWS_PROFILE}`
65+
const profile = process.env.AWS_PROFILE ?? options?.profile
66+
const command = profile ? `aws configure --profile ${profile}` : `aws configure`
6667
const input = `${awsAccessKeyId}\n${awsSecretAccessKey}\n${defaultRegion}\n${defaultOutputFormat}\n`
6768

6869
const result = await runCommand(command, {

storage/framework/core/buddy/src/commands/deploy.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import { intro, italic, log, outro, runCommand } from '@stacksjs/cli'
44
import { app } from '@stacksjs/config'
55
import { addDomain, hasUserDomainBeenAddedToCloud } from '@stacksjs/dns'
66
import { Action } from '@stacksjs/enums'
7+
import { path as p } from '@stacksjs/path'
78
import { ExitCode } from '@stacksjs/types'
89
import type { CLI, DeployOptions } from '@stacksjs/types'
10+
import { $ } from 'bun'
911

1012
export function deploy(buddy: CLI) {
1113
const descriptions = {
@@ -35,6 +37,7 @@ export function deploy(buddy: CLI) {
3537
log.info(`Deploying to ${italic(domain)}`)
3638

3739
await checkIfAwsIsConfigured()
40+
await checkIfAwsIsBootstrapped()
3841

3942
options.domain = await configureDomain(domain, options, startTime)
4043

@@ -130,3 +133,33 @@ async function checkIfAwsIsConfigured() {
130133

131134
log.success('AWS is configured')
132135
}
136+
137+
async function checkIfAwsIsBootstrapped() {
138+
try {
139+
log.info('Ensuring AWS is bootstrapped...')
140+
// const toolkitName = 'stacks-toolkit'
141+
await runCommand('aws cloudformation describe-stacks --stack-name stacks-toolkit', { silent: true })
142+
// await $`aws cloudformation describe-stacks --stack-name stacks-toolkit`.quiet()
143+
log.success('AWS is bootstrapped')
144+
145+
return true
146+
} catch (err: any) {
147+
log.debug(`Not yet bootstrapped. Failed with code ${err.exitCode}`)
148+
log.debug(err.stdout.toString())
149+
log.debug(err.stderr.toString())
150+
151+
log.info('AWS is not bootstrapped yet')
152+
log.info('Bootstrapping. This may take a few moments...')
153+
154+
try {
155+
$.cwd(p.frameworkPath('cloud'))
156+
const result = await $`bun run bootstrap`
157+
console.log(result)
158+
return true
159+
} catch (error) {
160+
log.error('Failed to bootstrap AWS')
161+
console.error(error)
162+
process.exit(ExitCode.FatalError)
163+
}
164+
}
165+
}

storage/framework/server/build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { log, runCommand } from '@stacksjs/cli'
33
import { app } from '@stacksjs/config'
44
import { frameworkPath, projectPath } from '@stacksjs/path'
55
import { hasFiles } from '@stacksjs/storage'
6-
import { slug } from '@stacksjs/strings'
6+
7+
// import { slug } from '@stacksjs/strings'
78

89
async function cleanAndCopy(sourcePath: string, targetPath: string) {
910
await runCommand(`rm -rf ${targetPath}`, {

0 commit comments

Comments
 (0)