Skip to content

Commit 5d01d78

Browse files
committed
chore: wip
1 parent d218163 commit 5d01d78

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

bun.lockb

760 Bytes
Binary file not shown.

storage/framework/core/logging/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@stacksjs/cli": "workspace:*",
4444
"@stacksjs/config": "workspace:*",
4545
"@stacksjs/error-handling": "workspace:*",
46+
"@stacksjs/storage": "workspace:*",
4647
"@stacksjs/validation": "workspace:*",
4748
"consola": "^3.2.3"
4849
},

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { appendFile, mkdir } from 'node:fs/promises'
1+
import { access, appendFile, mkdir } from 'node:fs/promises'
22
import { dirname } from 'node:path'
33
import process from 'node:process'
44
import type { Prompt } from '@stacksjs/cli'
@@ -45,16 +45,20 @@ export { consola }
4545

4646
export async function writeToLogFile(message: string) {
4747
const formattedMessage = `[${new Date().toISOString()}] ${message}\n`
48+
4849
try {
50+
const logFilePath = logsPath('console.log')
51+
4952
try {
50-
const logFilePath = logsPath('console.log')
51-
// Ensure the directory exists
53+
// Check if the file exists
54+
await access(logFilePath)
55+
} catch {
56+
// File doesn't exist, create the directory
5257
await mkdir(dirname(logFilePath), { recursive: true })
53-
// Append the message to the log file
54-
await appendFile(logFilePath, formattedMessage)
55-
} catch (error) {
56-
console.error('Failed to write to log file:', error)
5758
}
59+
60+
// Append the message to the log file
61+
await appendFile(logFilePath, formattedMessage)
5862
} catch (error) {
5963
console.error('Failed to write to log file:', error)
6064
}

storage/framework/server/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ helm-charts
1414
.idea
1515
coverage*
1616
cdk.out
17+
.DS_Store

storage/framework/server/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# use the official Bun image
22
# see all versions at https://hub.docker.com/r/oven/bun/tags
33
FROM oven/bun:1.1.24-debian AS base
4-
WORKDIR /usr/src/app
4+
WORKDIR /usr/src
55

66
# Install curl - I wonder if there is a better way to do this, because it is only needed for the healthcheck — is wget installed by default?
77
RUN apt-get update && apt-get install -y curl
@@ -19,6 +19,9 @@ COPY ./docs ./docs
1919
COPY ./routes ./routes
2020
COPY ./dist/* ./
2121

22+
# Create log directory and set permissions
23+
RUN chown -R bun:bun ./storage
24+
2225
# Add volume for logs
2326
VOLUME ["/usr/src/storage"]
2427

storage/framework/server/build-app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const result = await build({
2222
})
2323

2424
// TODO: this is a bundler issue and those files should not need to be copied, and that's why we handle the cleanup here as well
25+
2526
await runCommand(`cp -r ${path.projectStoragePath('app')} ${path.userServerPath('dist')}`)
2627
await runCommand(`rm -rf ${path.projectStoragePath('app')}`)
2728

storage/framework/server/src/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,22 @@ export async function buildDockerImage() {
4646
log.info('Copying project files...')
4747
log.info('Copying config files...')
4848
await cleanCopy(projectPath('config'), frameworkPath('server/config'))
49+
log.success('Copied config files')
4950
log.info('Copying routes files...')
5051
await cleanCopy(projectPath('routes'), frameworkPath('server/routes'))
52+
log.success('Copied routes files')
5153
log.info('Copying app files...')
5254
await cleanCopy(projectPath('app'), frameworkPath('server/app'))
55+
log.success('Copied app files')
5356
log.info('Copying docs files...')
5457
await cleanCopy(projectPath('docs'), frameworkPath('server/docs'))
58+
log.success('Copied docs files')
5559
log.info('Copying storage files...')
5660
await cleanCopy(projectPath('storage'), frameworkPath('server/storage'))
61+
log.success('Copied storage files')
5762
log.info('Copying .env file...')
5863
await cleanCopy(projectPath('.env'), frameworkPath('server/.env'))
64+
log.success('Copied .env file')
5965
log.success('Server ready to be built')
6066

6167
if (!app.name) {

0 commit comments

Comments
 (0)