Skip to content

Commit e45fef5

Browse files
committed
chore: wip
1 parent 64da0e9 commit e45fef5

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

storage/framework/core/router/src/router.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { path as p, projectStoragePath, routesPath } from '@stacksjs/path'
44
import { kebabCase, pascalCase } from '@stacksjs/strings'
55
import type { Job } from '@stacksjs/types'
66
import type { RedirectCode, Route, RouteGroupOptions, RouterInterface, StatusCode } from '@stacksjs/types'
7-
87
import { extractDefaultRequest, extractModelRequest, findRequestInstance } from './utils'
98

109
type ActionPath = string // TODO: narrow this by automating its generation

storage/framework/server/src/utils.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import process from 'node:process'
2-
import { log } from '@stacksjs/cli'
3-
import { app, cloud as cloudConfig } from '@stacksjs/config'
2+
import { log, runCommand } from '@stacksjs/cli'
3+
import { app } from '@stacksjs/config'
44
import { frameworkCloudPath, frameworkPath, projectPath } from '@stacksjs/path'
55
import { hasFiles } from '@stacksjs/storage'
6+
import { slug } from '@stacksjs/strings'
67
import { $ } from 'bun'
78

89
export async function cleanAndCopy(sourcePath: string, targetPath: string) {
910
$.cwd(frameworkPath('server'))
10-
11-
await $`rm -rf ${targetPath}`
12-
await $`cp -r ${sourcePath} ${targetPath}`
11+
const r = await $`rm -rf ${targetPath}`.text()
12+
await $`cp -r ${sourcePath} ${targetPath}`.text()
1313
}
1414

1515
export async function useCustomOrDefaultServerConfig() {
@@ -26,9 +26,13 @@ export async function useCustomOrDefaultServerConfig() {
2626
}
2727

2828
export async function buildServer() {
29-
log.info('Preparing server...')
29+
log.info('Preparing build...')
30+
31+
// delete old CDK relating files, to always build fresh
32+
await $`rm -rf ${frameworkCloudPath('cdk.out/')}`
33+
await $`rm -rf ${frameworkCloudPath('cdk.context.json')}`
34+
await $`rm -rf ${frameworkCloudPath('dist.zip')}`
3035

31-
await cleanAndCopy(frameworkPath('core'), frameworkCloudPath('core'))
3236
await cleanAndCopy(projectPath('config'), frameworkCloudPath('config'))
3337
await cleanAndCopy(projectPath('routes'), frameworkCloudPath('routes'))
3438
await cleanAndCopy(projectPath('app'), frameworkCloudPath('app'))
@@ -41,12 +45,13 @@ export async function buildServer() {
4145
}
4246

4347
// TODO: need to build index.ts into index.js and then run that from within the Dockerfile
48+
$.cwd(frameworkPath('server'))
4449

4550
// TODO: also allow for a custom container name via a config option
4651
// this currently does not need to be enabled because our CDK deployment handles the docker build process
47-
// await runCommand(`docker build --pull -t ${slug(app.name)} .`, {
48-
// cwd: frameworkPath('cloud'),
49-
// })
52+
await runCommand(`docker build --pull -t ${slug(app.name)} .`, {
53+
cwd: frameworkPath('cloud'),
54+
})
5055

5156
log.success('Server ready to be built')
5257
}

0 commit comments

Comments
 (0)