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,84 +0,0 @@
|
|
|
1
|
-
import type { CLI, ConfigureOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { log, outro, runCommand } from '@stacksjs/cli'
|
|
4
|
-
import { path as p } from '@stacksjs/path'
|
|
5
|
-
import { ExitCode } from '@stacksjs/types'
|
|
6
|
-
|
|
7
|
-
export function configure(buddy: CLI): void {
|
|
8
|
-
const descriptions = {
|
|
9
|
-
configure: 'Configure options',
|
|
10
|
-
aws: 'Configure the AWS connection',
|
|
11
|
-
project: 'Target a specific project',
|
|
12
|
-
profile: 'The AWS profile to use',
|
|
13
|
-
verbose: 'Enable verbose output',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
buddy
|
|
17
|
-
.command('configure', descriptions.configure)
|
|
18
|
-
.option('--aws', descriptions.aws, { default: false })
|
|
19
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
20
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
21
|
-
.action(async (options?: ConfigureOptions) => {
|
|
22
|
-
log.debug('Running `buddy configure` ...', options)
|
|
23
|
-
|
|
24
|
-
if (options?.aws) {
|
|
25
|
-
await configureAws(options)
|
|
26
|
-
process.exit(ExitCode.Success)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
log.info('Not implemented yet. Please use the --aws flag to configure AWS.')
|
|
30
|
-
process.exit(ExitCode.Success)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
buddy
|
|
34
|
-
.command('configure:aws', descriptions.aws)
|
|
35
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
36
|
-
.option('--profile', descriptions.profile, {
|
|
37
|
-
default: process.env.AWS_PROFILE,
|
|
38
|
-
})
|
|
39
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
40
|
-
.option('--access-key-id', 'The AWS access key')
|
|
41
|
-
.option('--secret-access-key', 'The AWS secret access key')
|
|
42
|
-
.option('--region', 'The AWS region')
|
|
43
|
-
.option('--output', 'The AWS output format')
|
|
44
|
-
.option('--quiet', 'Suppress output')
|
|
45
|
-
.action(async (options?: ConfigureOptions) => {
|
|
46
|
-
log.debug('Running `buddy configure:aws` ...', options)
|
|
47
|
-
await configureAws(options)
|
|
48
|
-
process.exit(ExitCode.Success)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
buddy.on('configure:*', () => {
|
|
52
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
53
|
-
process.exit(ExitCode.FatalError)
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function configureAws(options?: ConfigureOptions) {
|
|
58
|
-
const startTime = performance.now()
|
|
59
|
-
|
|
60
|
-
const awsAccessKeyId = options?.accessKeyId ?? process.env.AWS_ACCESS_KEY_ID
|
|
61
|
-
const awsSecretAccessKey = options?.secretAccessKey ?? process.env.AWS_SECRET_ACCESS_KEY
|
|
62
|
-
const defaultRegion = 'us-east-1' // we only support `us-east-1` for now
|
|
63
|
-
const defaultOutputFormat = options?.output ?? 'json'
|
|
64
|
-
|
|
65
|
-
const profile = process.env.AWS_PROFILE ?? options?.profile
|
|
66
|
-
const command = profile ? `aws configure --profile ${profile}` : `aws configure`
|
|
67
|
-
const input = `${awsAccessKeyId}\n${awsSecretAccessKey}\n${defaultRegion}\n${defaultOutputFormat}\n`
|
|
68
|
-
|
|
69
|
-
const result = await runCommand(command, {
|
|
70
|
-
cwd: p.projectPath(),
|
|
71
|
-
stdin: 'pipe', // set stdin mode to 'pipe' to write to it
|
|
72
|
-
input, // the actual input to write
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
if (result.isErr()) {
|
|
76
|
-
await outro('While running the cloud command, there was an issue', { startTime, useSeconds: true }, result.error)
|
|
77
|
-
process.exit(ExitCode.FatalError)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (options?.quiet)
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
await outro('Exited', { startTime, useSeconds: true })
|
|
84
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import type { CLI, CreateOptions } from '@stacksjs/types'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { runAction } from '@stacksjs/actions'
|
|
4
|
-
import { bold, cyan, dim, intro, log, runCommand } from '@stacksjs/cli'
|
|
5
|
-
import { Action } from '@stacksjs/enums'
|
|
6
|
-
import { resolve } from '@stacksjs/path'
|
|
7
|
-
import { isFolder } from '@stacksjs/storage'
|
|
8
|
-
import { ExitCode } from '@stacksjs/types'
|
|
9
|
-
import { useOnline } from '@stacksjs/utils'
|
|
10
|
-
|
|
11
|
-
export function create(buddy: CLI): void {
|
|
12
|
-
const descriptions = {
|
|
13
|
-
name: 'The name of the project',
|
|
14
|
-
command: 'Create a new Stacks project',
|
|
15
|
-
ui: 'Are you building a UI?',
|
|
16
|
-
components: 'Are you building UI components?',
|
|
17
|
-
webComponents: 'Automagically built optimized custom elements/web components?',
|
|
18
|
-
vue: 'Automagically built a Vue component library?',
|
|
19
|
-
views: 'How about views?',
|
|
20
|
-
functions: 'Are you developing functions/composables?',
|
|
21
|
-
api: 'Are you building an API?',
|
|
22
|
-
database: 'Do you need a database?',
|
|
23
|
-
notifications: 'Do you need notifications? e.g. email, SMS, push or chat notifications',
|
|
24
|
-
cache: 'Do you need caching?',
|
|
25
|
-
email: 'Do you need email?',
|
|
26
|
-
project: 'Target a specific project',
|
|
27
|
-
verbose: 'Enable verbose output',
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
buddy
|
|
31
|
-
.command('new [name]', descriptions.command)
|
|
32
|
-
.alias('create [name]')
|
|
33
|
-
.option('-n, --name [name]', descriptions.name, { default: false })
|
|
34
|
-
.option('-u, --ui', descriptions.ui, { default: true }) // if no, disregard remainder of questions wrt UI
|
|
35
|
-
.option('-c, --components', descriptions.components, { default: true }) // if no, -v and -w would be false
|
|
36
|
-
.option('-w, --web-components', descriptions.webComponents, { default: true })
|
|
37
|
-
.option('-v, --vue', descriptions.vue, { default: true })
|
|
38
|
-
.option('-p, --views', descriptions.views, { default: true }) // i.e. `buddy dev`
|
|
39
|
-
.option('-f, --functions', descriptions.functions, { default: true }) // if no, API would be false
|
|
40
|
-
.option('-a, --api', descriptions.api, { default: true }) // APIs need an HTTP server & assumes functions is true
|
|
41
|
-
.option('-d, --database', descriptions.database, { default: true })
|
|
42
|
-
.option('-ca, --cache', descriptions.cache, { default: false })
|
|
43
|
-
.option('-e, --email', descriptions.email, { default: false })
|
|
44
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
45
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
46
|
-
// .option('--auth', 'Scaffold an authentication?', { default: true })
|
|
47
|
-
.action(async (name, options: CreateOptions) => {
|
|
48
|
-
log.debug('Running `buddy new <name>` ...', options)
|
|
49
|
-
|
|
50
|
-
const startTime = await intro('stacks new')
|
|
51
|
-
|
|
52
|
-
name = name ?? options.name
|
|
53
|
-
const path = resolve(process.cwd(), name)
|
|
54
|
-
|
|
55
|
-
isFolderCheck(path)
|
|
56
|
-
onlineCheck()
|
|
57
|
-
|
|
58
|
-
const result = await download(name, path, options)
|
|
59
|
-
|
|
60
|
-
if (result.isErr()) {
|
|
61
|
-
log.error(result.error)
|
|
62
|
-
process.exit(ExitCode.FatalError)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
await ensureEnv(path, options)
|
|
66
|
-
await install(path, options)
|
|
67
|
-
|
|
68
|
-
if (startTime) {
|
|
69
|
-
const time = performance.now() - startTime
|
|
70
|
-
log.success(dim(`[${time.toFixed(2)}ms] Completed`))
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
log.info(bold('Welcome to the Stacks Framework! ⚛️'))
|
|
74
|
-
log.info('To learn more, visit https://stacksjs.org')
|
|
75
|
-
|
|
76
|
-
process.exit(ExitCode.Success)
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
buddy.on('new:*', () => {
|
|
80
|
-
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
81
|
-
process.exit(1)
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function isFolderCheck(path: string) {
|
|
86
|
-
if (isFolder(path)) {
|
|
87
|
-
log.error(`Path ${path} already exists`)
|
|
88
|
-
process.exit(ExitCode.FatalError)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function onlineCheck() {
|
|
93
|
-
const online = useOnline()
|
|
94
|
-
if (!online) {
|
|
95
|
-
log.info('It appears you are disconnected from the internet.')
|
|
96
|
-
log.info('The Stacks setup requires a brief internet connection for setup.')
|
|
97
|
-
log.info('For instance, it installs your dependencies from.')
|
|
98
|
-
process.exit(ExitCode.FatalError)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async function download(name: string, path: string, options: CreateOptions) {
|
|
103
|
-
log.info('Setting up your stack.')
|
|
104
|
-
const result = await runCommand(`bunx --bun giget stacks ${name}`, options)
|
|
105
|
-
log.success(`Successfully scaffolded your project at ${cyan(path)}`)
|
|
106
|
-
|
|
107
|
-
return result
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async function ensureEnv(path: string, options: CreateOptions) {
|
|
111
|
-
log.info('Ensuring your environment is ready...')
|
|
112
|
-
await runCommand('pkgx --update ', { ...options, cwd: path })
|
|
113
|
-
log.success('Environment is ready')
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async function install(path: string, options: CreateOptions) {
|
|
117
|
-
log.info('Installing & setting up Stacks')
|
|
118
|
-
let result = await runCommand('bun install', { ...options, cwd: path })
|
|
119
|
-
|
|
120
|
-
if (result?.isErr()) {
|
|
121
|
-
log.error(result.error)
|
|
122
|
-
process.exit()
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
result = await runCommand('cp .env.example .env', { ...options, cwd: path })
|
|
126
|
-
|
|
127
|
-
if (result?.isErr()) {
|
|
128
|
-
log.error(result.error)
|
|
129
|
-
process.exit(ExitCode.FatalError)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
await runAction(Action.KeyGenerate, { ...options, cwd: path })
|
|
133
|
-
|
|
134
|
-
// TODO: we should ask quite a few questions here, similar how we do in `buddy new my-project`, so we can generate a custom pkgx.yaml file
|
|
135
|
-
|
|
136
|
-
result = await runCommand('git init', { ...options, cwd: path }) // do we need this? or does giget do this already?
|
|
137
|
-
if (result.isErr()) {
|
|
138
|
-
log.error(result.error)
|
|
139
|
-
process.exit(ExitCode.FatalError)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
log.success('Installed & set-up 🚀')
|
|
143
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import type { CLI, DeployOptions } from '@stacksjs/types'
|
|
2
|
-
import { $ } from 'bun'
|
|
3
|
-
import process from 'node:process'
|
|
4
|
-
import { runAction } from '@stacksjs/actions'
|
|
5
|
-
import { intro, italic, log, outro, prompts, runCommand } from '@stacksjs/cli'
|
|
6
|
-
import { app } from '@stacksjs/config'
|
|
7
|
-
import { addDomain, hasUserDomainBeenAddedToCloud } from '@stacksjs/dns'
|
|
8
|
-
import { Action } from '@stacksjs/enums'
|
|
9
|
-
import { path as p } from '@stacksjs/path'
|
|
10
|
-
import { ExitCode } from '@stacksjs/types'
|
|
11
|
-
|
|
12
|
-
export function deploy(buddy: CLI): void {
|
|
13
|
-
const descriptions = {
|
|
14
|
-
deploy: 'Deploy your project',
|
|
15
|
-
project: 'Target a specific project',
|
|
16
|
-
production: 'Deploy to production',
|
|
17
|
-
development: 'Deploy to development',
|
|
18
|
-
staging: 'Deploy to staging',
|
|
19
|
-
yes: 'Confirm all prompts by default',
|
|
20
|
-
domain: 'Specify a domain to deploy to',
|
|
21
|
-
verbose: 'Enable verbose output',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
buddy
|
|
25
|
-
.command('deploy [env]', descriptions.deploy)
|
|
26
|
-
.option('--domain', descriptions.domain, { default: undefined })
|
|
27
|
-
.option('-p, --project [project]', descriptions.project, { default: false })
|
|
28
|
-
.option('--prod', descriptions.production, { default: true })
|
|
29
|
-
.option('--dev', descriptions.development, { default: false })
|
|
30
|
-
.option('--yes', descriptions.yes, { default: false })
|
|
31
|
-
.option('--staging', descriptions.staging, { default: false })
|
|
32
|
-
.option('--verbose', descriptions.verbose, { default: false })
|
|
33
|
-
.action(async (env: string | undefined, options: DeployOptions) => {
|
|
34
|
-
log.debug('Running `buddy deploy` ...', options)
|
|
35
|
-
|
|
36
|
-
const startTime = await intro('buddy deploy')
|
|
37
|
-
const domain = options.domain || app.url
|
|
38
|
-
|
|
39
|
-
if ((options.prod || env === 'production' || env === 'prod') && !options.yes)
|
|
40
|
-
await confirmProductionDeployment()
|
|
41
|
-
|
|
42
|
-
if (!domain) {
|
|
43
|
-
log.info('No domain found in your .env or ./config/app.ts')
|
|
44
|
-
log.info('Please ensure your domain is properly configured.')
|
|
45
|
-
log.info('For more info, check out the docs or join our Discord.')
|
|
46
|
-
process.exit(ExitCode.FatalError)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
log.info(`Deploying to ${italic(domain)}`)
|
|
50
|
-
|
|
51
|
-
await checkIfAwsIsConfigured()
|
|
52
|
-
await checkIfAwsIsBootstrapped()
|
|
53
|
-
|
|
54
|
-
options.domain = await configureDomain(domain, options, startTime)
|
|
55
|
-
|
|
56
|
-
const result = await runAction(Action.Deploy, options)
|
|
57
|
-
|
|
58
|
-
if (result.isErr()) {
|
|
59
|
-
await outro(
|
|
60
|
-
'While running the `buddy deploy`, there was an issue',
|
|
61
|
-
{ startTime, useSeconds: true },
|
|
62
|
-
result.error,
|
|
63
|
-
)
|
|
64
|
-
process.exit(ExitCode.FatalError)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
await outro('Project deployed.', { startTime, useSeconds: true })
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
buddy.on('deploy:*', () => {
|
|
71
|
-
log.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
72
|
-
process.exit(1)
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async function confirmProductionDeployment() {
|
|
77
|
-
const { confirmed } = await prompts({
|
|
78
|
-
type: 'confirm',
|
|
79
|
-
name: 'confirmed',
|
|
80
|
-
message: 'Are you sure you want to deploy to production?',
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
if (!confirmed) {
|
|
84
|
-
log.info('Aborting deployment...')
|
|
85
|
-
process.exit(ExitCode.InvalidArgument)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async function configureDomain(domain: string, options: DeployOptions, startTime: number) {
|
|
90
|
-
log.debug('Configuring domain...', domain)
|
|
91
|
-
if (!domain) {
|
|
92
|
-
log.info('We could not identify a domain to deploy to.')
|
|
93
|
-
log.warn('Please set your .env or ./config/app.ts properly.')
|
|
94
|
-
log.info('Alternatively, specify a domain to deploy via the `--domain` flag.')
|
|
95
|
-
console.log('')
|
|
96
|
-
log.info(' ➡️ Example: `buddy deploy --domain example.com`')
|
|
97
|
-
console.log('')
|
|
98
|
-
process.exit(ExitCode.FatalError)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// TODO: we can improve this check at some point, otherwise domains that legitimately include the word localhost will fail
|
|
102
|
-
// TODO: add check for whether the local APP_ENV is getting deployed, if so, ask if the user meant to deploy `dev`
|
|
103
|
-
if (domain.includes('localhost')) {
|
|
104
|
-
log.info('You are deploying to a local environment.')
|
|
105
|
-
log.warn(
|
|
106
|
-
'Please set your .env or ./config/app.ts properly. The domain we are deploying cannot be a `localhost` domain.',
|
|
107
|
-
)
|
|
108
|
-
log.info('Alternatively, specify a domain to deploy via the `--domain` flag.')
|
|
109
|
-
console.log('')
|
|
110
|
-
log.info(' ➡️ Example: `buddy deploy --domain example.com`')
|
|
111
|
-
console.log('')
|
|
112
|
-
process.exit(ExitCode.FatalError)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (await hasUserDomainBeenAddedToCloud(domain)) {
|
|
116
|
-
log.info('Domain is properly configured')
|
|
117
|
-
log.info('Your cloud is deploying...')
|
|
118
|
-
|
|
119
|
-
log.info(`${italic('This may take a while...')}`)
|
|
120
|
-
|
|
121
|
-
return domain
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// if the domain hasn't been added to the user's (AWS) cloud, we will add it for them
|
|
125
|
-
// and then exit the process with prompts for the user to update their nameservers
|
|
126
|
-
console.log('')
|
|
127
|
-
log.info(` 👋 It appears to be your first ${italic(domain)} deployment.`)
|
|
128
|
-
console.log('')
|
|
129
|
-
log.info(italic('Let’s ensure it is all connected properly.'))
|
|
130
|
-
log.info(italic('One moment...'))
|
|
131
|
-
console.log('')
|
|
132
|
-
|
|
133
|
-
const result = await addDomain({
|
|
134
|
-
...options,
|
|
135
|
-
deploy: true,
|
|
136
|
-
startTime,
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
if (result.isErr()) {
|
|
140
|
-
await outro('While running the `buddy deploy`, there was an issue', { startTime, useSeconds: true }, result.error)
|
|
141
|
-
process.exit(ExitCode.FatalError)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
await outro('Added your domain.', { startTime, useSeconds: true })
|
|
145
|
-
process.exit(ExitCode.Success)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async function checkIfAwsIsConfigured() {
|
|
149
|
-
log.info('Ensuring AWS is configured...')
|
|
150
|
-
const result = await runCommand('buddy configure:aws', {
|
|
151
|
-
silent: true,
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
if (result.isErr()) {
|
|
155
|
-
log.error('AWS is not configured properly.', {
|
|
156
|
-
shouldExit: false,
|
|
157
|
-
})
|
|
158
|
-
log.error('Please run `buddy configure:aws` to set up your AWS credentials.')
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
log.success('AWS is configured')
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
async function checkIfAwsIsBootstrapped() {
|
|
165
|
-
try {
|
|
166
|
-
log.info('Ensuring AWS is bootstrapped...')
|
|
167
|
-
// const toolkitName = 'stacks-toolkit'
|
|
168
|
-
await runCommand('aws cloudformation describe-stacks --stack-name stacks-toolkit', { silent: true })
|
|
169
|
-
// await $`aws cloudformation describe-stacks --stack-name stacks-toolkit`.quiet()
|
|
170
|
-
log.success('AWS is bootstrapped')
|
|
171
|
-
|
|
172
|
-
return true
|
|
173
|
-
}
|
|
174
|
-
catch (err: any) {
|
|
175
|
-
log.debug(`Not yet bootstrapped. Failed with code ${err.exitCode}`)
|
|
176
|
-
log.debug(err.stdout.toString())
|
|
177
|
-
log.debug(err.stderr.toString())
|
|
178
|
-
|
|
179
|
-
log.info('AWS is not bootstrapped yet')
|
|
180
|
-
log.info('Bootstrapping. This may take a few moments...')
|
|
181
|
-
|
|
182
|
-
try {
|
|
183
|
-
$.cwd(p.frameworkCloudPath())
|
|
184
|
-
const result = await $`bun run bootstrap`
|
|
185
|
-
console.log(result)
|
|
186
|
-
return true
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
log.error('Failed to bootstrap AWS')
|
|
190
|
-
console.error(error)
|
|
191
|
-
process.exit(ExitCode.FatalError)
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|