Skip to content

Commit f844805

Browse files
committed
chore: wip
1 parent 0207364 commit f844805

File tree

8 files changed

+67
-19
lines changed

8 files changed

+67
-19
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ WIP: Updates to here are in progress.
55
First off, thank you for taking the time to contribute to the Stacks ecosystem ❤️
66

77
> **Note**
8-
> The likelihood is high that the repo you are working on is either a Stack or Stacks itself. In both cases, you will be exposed to a meshup of technologies, like [Vue][vue], [Vite][vite], [Tauri][tauri], [Nitro][nitro], and [Bun][bun].
8+
> The likelihood is high that the repo you are working on is either a Stack or Stacks itself. In both cases, you will be exposed to a meshup of technologies, like [Vite][vite], [Tauri][tauri], [Nitro][nitro], [Vue][vue], and [Bun][bun].
99
1010
## 💭 Knowledge
1111

config/app.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import type { AppConfig } from '@stacksjs/types'
99
* you have any questions, feel free to reach out via Discord or GitHub Discussions.
1010
*/
1111
export default {
12-
name: env.APP_NAME || 'Stacks',
12+
name: env.APP_NAME ?? 'Stacks',
1313
description: 'Stacks is a full-stack framework for building modern web applications.',
14-
env: env.APP_ENV || 'local',
15-
url: env.APP_URL || 'stacks.localhost',
14+
env: env.APP_ENV ?? 'local',
15+
url: env.APP_URL ?? 'stacks.localhost',
1616
redirectUrls: ['stacksjs.com'],
17-
debug: env.DEBUG || false,
17+
debug: env.DEBUG ?? false,
1818
key: env.APP_KEY,
1919

20-
maintenanceMode: env.APP_MAINTENANCE || false,
21-
// docMode: true, // instead of example.com/docs, deploys example.com as main entry point for docs
22-
docMode: false,
20+
maintenanceMode: env.APP_MAINTENANCE ?? false,
21+
docMode: true, // instead of example.com/docs, deploys example.com as main entry point for docs
22+
// docMode: false,
2323

2424
timezone: 'America/Los_Angeles',
2525
locale: 'en',

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

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ export function cloud(buddy: CLI) {
2323
cloud: 'Interact with the Stacks Cloud',
2424
ssh: 'SSH into the Stacks Cloud',
2525
add: 'Add a resource to the Stacks Cloud',
26-
remove: 'Removes the Stacks Cloud. In case it fails, try again',
27-
optimizeCost: 'Removes certain resources that may be re-applied at a later time',
28-
cleanUp: 'Removes all resources that were retained during the cloud deletion',
29-
invalidateCache: 'Invalidates the CloudFront cache',
26+
remove: 'Remove the Stacks Cloud. In case it fails, try again',
27+
optimizeCost: 'Remove certain resources that may be re-applied at a later time',
28+
cleanUp: 'Remove all resources that were retained during the cloud deletion',
29+
invalidateCache: 'Invalidate the CloudFront cache',
30+
diff: 'Show the diff of the current, undeployed cloud changes ',
3031
paths: 'The paths to invalidate',
3132
project: 'Target a specific project',
3233
verbose: 'Enable verbose output',
@@ -38,6 +39,7 @@ export function cloud(buddy: CLI) {
3839
.option('--connect', descriptions.ssh, { default: false })
3940
.option('--invalidate-cache', descriptions.invalidateCache, { default: false })
4041
.option('--paths [paths]', descriptions.paths)
42+
.option('--diff', descriptions.diff, { default: false })
4143
.option('-p, --project [project]', descriptions.project, { default: false })
4244
.option('--verbose', descriptions.verbose, { default: false })
4345
.action(async (options: CloudCliOptions) => {
@@ -107,6 +109,22 @@ export function cloud(buddy: CLI) {
107109
process.exit(ExitCode.Success)
108110
}
109111

112+
if (options.diff) {
113+
const result = await runCommand('bunx cdk diff', {
114+
cwd: p.frameworkCloudPath(),
115+
stdin: 'pipe'
116+
})
117+
118+
if (result.isErr()) {
119+
await outro('While running the cloud diff command, there was an issue', { startTime, useSeconds: true }, result.error)
120+
process.exit(ExitCode.FatalError)
121+
}
122+
123+
await outro('Showing diff of the current, undeployed cloud changes', { startTime, useSeconds: true })
124+
console.log(result.value)
125+
process.exit(ExitCode.Success)
126+
}
127+
110128
log.info('Not implemented yet. Read more about `buddy cloud` here: https://stacksjs.org/docs/cloud')
111129
process.exit(ExitCode.Success)
112130
})
@@ -476,6 +494,30 @@ export function cloud(buddy: CLI) {
476494
process.exit(ExitCode.Success)
477495
})
478496

497+
buddy
498+
.command('cloud:diff', descriptions.diff)
499+
.option('-p, --project [project]', descriptions.project, { default: false })
500+
.option('--verbose', descriptions.verbose, { default: false })
501+
.action(async (options: CloudCliOptions) => {
502+
log.debug('Running `buddy cloud:diff` ...', options)
503+
504+
const startTime = await intro('buddy cloud:diff')
505+
506+
const result = await runCommand('bunx cdk diff', {
507+
cwd: p.frameworkCloudPath(),
508+
stdin: 'pipe'
509+
})
510+
511+
if (result.isErr()) {
512+
await outro('While running the cloud diff command, there was an issue', { startTime, useSeconds: true }, result.error)
513+
process.exit(ExitCode.FatalError)
514+
}
515+
516+
await outro('Showing diff of the current, undeployed cloud changes', { startTime, useSeconds: true })
517+
console.log(result.value)
518+
process.exit(ExitCode.Success)
519+
})
520+
479521
buddy.on('cloud:*', () => {
480522
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
481523
process.exit(1)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ import { $ } from 'bun'
1111

1212
export function deploy(buddy: CLI) {
1313
const descriptions = {
14-
deploy: 'Re-installs your npm dependencies',
14+
deploy: 'Deploy your project',
1515
project: 'Target a specific project',
1616
production: 'Deploy to production',
1717
development: 'Deploy to development',
1818
staging: 'Deploy to staging',
19+
domain: 'Specify a domain to deploy to',
1920
verbose: 'Enable verbose output',
2021
}
2122

2223
buddy
2324
.command('deploy [env]', descriptions.deploy)
24-
.option('--domain', 'Specify a domain to deploy to', { default: undefined })
25+
.option('--domain', descriptions.domain, { default: undefined })
2526
.option('-p, --project [project]', descriptions.project, { default: false })
2627
.option('--prod', descriptions.production, { default: true })
2728
.option('--dev', descriptions.development, { default: false })

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import type { CLI, DevOptions } from '@stacksjs/types'
1717

1818
export function dev(buddy: CLI) {
1919
const descriptions = {
20-
dev: 'Starts development server',
21-
frontend: 'Starts the frontend development server',
20+
dev: 'Start development server',
21+
frontend: 'Start the frontend development server',
2222
components: 'Start the Components development server',
2323
desktop: 'Start the Desktop App development server',
2424
dashboard: 'Start the Dashboard development server',

storage/framework/core/cloud/src/cloud/compute.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
aws_route53_targets as route53Targets,
1212
aws_secretsmanager as secretsmanager,
1313
} from 'aws-cdk-lib'
14-
import * as ecr_assets from 'aws-cdk-lib/aws-ecr-assets'
1514
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'
1615
import { LogGroup } from 'aws-cdk-lib/aws-logs'
1716
import type { Construct } from 'constructs'
@@ -223,8 +222,12 @@ export class ComputeStack {
223222
},
224223
})
225224

226-
secrets.grantRead(service.taskDefinition.executionRole)
227-
container.addEnvironment('SECRETS_ARN', secrets.secretArn)
225+
if (service.taskDefinition.executionRole) {
226+
secrets.grantRead(service.taskDefinition.executionRole)
227+
container.addEnvironment('SECRETS_ARN', secrets.secretArn)
228+
} else {
229+
throw new Error('Service task execution role is undefined.')
230+
}
228231

229232
const apiPrefix = 'api'
230233
new Output(scope, 'ApiUrl', {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ export interface CloudCliOptions extends CliOptions {
353353
jumpBox?: boolean
354354
invalidateCache?: boolean
355355
paths?: string
356+
diff?: boolean
356357
}
357358
export interface CommitOptions extends CliOptions {}
358359
export interface KeyOptions extends CliOptions {}

storage/framework/ide/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ typecheck
301301
typegen
302302
typesense
303303
unconfig
304+
undeployed
304305
undeploys
305306
unhead
306307
unimport

0 commit comments

Comments
 (0)