Skip to content

Commit d50561f

Browse files
committed
chore: wip
1 parent c540fb7 commit d50561f

File tree

13 files changed

+68
-11
lines changed

13 files changed

+68
-11
lines changed

bun.lockb

248 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"build:web-components": "bun run buddy build:web-components",
4545
"build:functions": "bun run buddy build:functions // needs to have option to ",
4646
"build:docs": "bun run buddy build:docs",
47+
"build:server": "bun run buddy build:server",
4748
"build:stacks": "bun run buddy build:stacks",
4849
"prod": "bun run buddy build",
4950
"prod:components": "bun run buddy build:components",

storage/framework/core/actions/src/build/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { log } from '@stacksjs/cli'
22
import { buddyPath } from '@stacksjs/path'
33
import { $ } from 'bun'
44

5-
log.info('Building CLI')
5+
log.info('Building CLI...')
66

77
await $`bun ${buddyPath('compile.ts')}`
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { log } from '@stacksjs/cli'
2+
import { buddyPath, frameworkPath } from '@stacksjs/path'
3+
import { $ } from 'bun'
4+
5+
log.info('Building Server...')
6+
7+
$.cwd(frameworkPath('server'))
8+
9+
await $`bun build.ts`

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export function build(buddy: CLI) {
1919
pages: 'Build your frontend',
2020
docs: 'Build your documentation',
2121
framework: 'Build Stacks framework',
22+
cli: 'Automagically build the CLI',
23+
server: 'Build the Stacks cloud server (Docker image)',
2224
select: 'What are you trying to build?',
2325
project: 'Target a specific project',
2426
verbose: 'Enable verbose output',
@@ -36,6 +38,7 @@ export function build(buddy: CLI) {
3638
.option('-b, --buddy', descriptions.buddy, { default: false })
3739
.option('-s, --stacks', descriptions.framework, { default: false })
3840
.option('-p, --project', descriptions.project, { default: false })
41+
.option('--server', descriptions.server, { default: false })
3942
.option('--verbose', descriptions.verbose, { default: false })
4043
.action(async (server: string | undefined, options: BuildOptions) => {
4144
switch (server) {
@@ -66,6 +69,9 @@ export function build(buddy: CLI) {
6669
case 'stacks':
6770
options.stacks = true
6871
break
72+
case 'server':
73+
options.stacks = true
74+
break
6975
default:
7076
break
7177
}
@@ -109,7 +115,7 @@ export function build(buddy: CLI) {
109115
})
110116

111117
buddy
112-
.command('build:cli', 'Automagically build the CLI')
118+
.command('build:cli', descriptions.cli)
113119
.alias('prod:cli')
114120
.option('-b, --buddy', descriptions.buddy, { default: true })
115121
.option('-p, --project', descriptions.project, { default: false })
@@ -118,6 +124,16 @@ export function build(buddy: CLI) {
118124
await runAction(Action.BuildCli, options)
119125
})
120126

127+
buddy
128+
.command('build:server', descriptions.server)
129+
.alias('prod:server')
130+
.alias('build:docker')
131+
.option('-p, --project', descriptions.project, { default: false })
132+
.option('--verbose', descriptions.verbose, { default: false })
133+
.action(async (options: BuildOptions) => {
134+
await runAction(Action.BuildServer, options)
135+
})
136+
121137
buddy
122138
.command('build:functions', 'Automagically build function library for npm/CDN distribution')
123139
.option('-f, --functions', descriptions.functions, { default: true })

storage/framework/core/bun-create/stx/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"build:web-components": "bun run buddy build:web-components",
6464
"build:functions": "bun run buddy build:functions // needs to have option to ",
6565
"build:docs": "bun run buddy build:docs",
66+
"build:server": "bun run buddy build:server",
6667
"build:stacks": "bun run buddy build:stacks",
6768
"prod": "bun run buddy build",
6869
"prod:components": "bun run buddy build:components",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class SecurityStack {
4747
this.certificate = new acm.Certificate(scope, 'Certificate', {
4848
domainName: props.domain,
4949
validation: acm.CertificateValidation.fromDns(props.zone),
50-
subjectAlternativeNames: [`www.${props.domain}`, `api.${props.domain}`],
50+
subjectAlternativeNames: [`www.${props.domain}`],
5151
})
5252
}
5353

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ export async function deleteJumpBox(stackName?: string) {
186186
if (!jumpBoxId)
187187
return err('Jump-box not found')
188188

189+
log.info(`Deleting jump-box ${jumpBoxId}...`)
190+
189191
return await deleteEc2Instance(jumpBoxId, stackName)
190192
}
191193

@@ -203,6 +205,7 @@ export async function deleteIamUsers() {
203205

204206
const promises = users.map(async (user) => {
205207
const userName = user.UserName || ''
208+
206209
log.info(`Deleting IAM user: ${userName}`)
207210

208211
// Get the list of policies attached to the user
@@ -251,12 +254,15 @@ export async function deleteStacksBuckets() {
251254
// List all objects in the bucket
252255
const objects = await s3.listObjectsV2({ Bucket: bucketName })
253256
log.info(`Finished listing bucket ${bucketName} objects`)
257+
254258
// Delete all objects
255259
if (objects.Contents) {
256260
log.info('Deleting bucket objects...')
261+
257262
await Promise.all(objects.Contents.map(object =>
258263
s3.deleteObject({ Bucket: bucketName, Key: object.Key || '' }).catch(error => handleError(error)),
259264
))
265+
260266
log.info(`Finished deleting objects from bucket ${bucketName}`)
261267
}
262268

@@ -273,24 +279,29 @@ export async function deleteStacksBuckets() {
273279

274280
// Delete all delete markers
275281
log.info(`Deleting bucket ${bucketName} delete markers...`)
282+
276283
if (versions.DeleteMarkers) {
277284
await Promise.all(versions.DeleteMarkers.map(marker =>
278285
s3.deleteObject({ Bucket: bucketName, Key: marker.Key || '', VersionId: marker.VersionId }),
279286
)).catch(error => handleError(error))
287+
280288
log.info(`Finished deleting delete markers from bucket ${bucketName}`)
281289
}
282290

283291
// If the bucket has uncompleted multipart uploads, you need to abort them
284292
const uploads = await s3.listMultipartUploads({ Bucket: bucketName })
285293
if (uploads.Uploads) {
286294
log.info('Aborting bucket multipart uploads...')
295+
287296
await Promise.all(uploads.Uploads.map(upload =>
288297
s3.abortMultipartUpload({ Bucket: bucketName, Key: upload.Key || '', UploadId: upload.UploadId }),
289298
)).catch(error => handleError(error))
299+
290300
log.info(`Finished aborting multipart uploads from bucket ${bucketName}`)
291301
}
292302

293303
await s3.deleteBucket({ Bucket: bucketName }).catch(error => handleError(error))
304+
294305
log.info(`Bucket ${bucketName} deleted`)
295306
}
296307
catch (error) {
@@ -322,6 +333,7 @@ export async function deleteStacksFunctions() {
322333
await Promise.all(promises).catch((error: Error) => {
323334
if (error.message.includes('it is a replicated function')) {
324335
log.info('Function is replicated, skipping...')
336+
325337
return ok('CloudFront is still deleting the some functions. Try again later.')
326338
}
327339

@@ -334,7 +346,6 @@ export async function deleteStacksFunctions() {
334346
export async function deleteLogGroups() {
335347
try {
336348
const client = new CloudWatchLogsClient({ region: 'us-east-1' })
337-
338349
const logGroups: DescribeLogGroupsCommandOutput = await client.send(new DescribeLogGroupsCommand({}))
339350

340351
if (!logGroups?.logGroups)
@@ -391,6 +402,7 @@ export async function hasBeenDeployed() {
391402

392403
try {
393404
const response = await s3.send(new ListBucketsCommand({}))
405+
394406
return ok(response.Buckets?.some(bucket => bucket.Name?.includes(config.app.name?.toLocaleLowerCase() || 'stacks')) || false)
395407
}
396408
catch (error) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export enum Action {
5757
BuildDesktop = 'build/desktop',
5858
BuildDocs = 'build/docs',
5959
BuildFunctionLib = 'build-function-lib',
60+
BuildServer = 'build/server',
6061
Changelog = 'changelog',
6162
Clean = 'clean',
6263
DevComponents = 'dev/components',

storage/framework/core/scheduler/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@
4545
"prepublishOnly": "bun --bun run build"
4646
},
4747
"peerDependencies": {
48-
"node-cron": "3.0.3"
48+
"cron": "^3.1.6"
4949
},
5050
"dependencies": {
51-
"node-cron": "3.0.3"
51+
"cron": "^3.1.6"
5252
},
5353
"devDependencies": {
54-
"@stacksjs/development": "workspace:*",
55-
"@types/node-cron": "^3.0.11"
54+
"@stacksjs/development": "workspace:*"
5655
}
5756
}

0 commit comments

Comments
 (0)