Skip to content

Commit 337bd35

Browse files
committed
chore: wip
1 parent 8c0e01e commit 337bd35

File tree

11 files changed

+29
-37
lines changed

11 files changed

+29
-37
lines changed

storage/framework/core/actions/src/orm/generate-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ async function deleteExistingModelRequest(modelStringFile?: string) {
533533
}
534534

535535
async function deleteExistingOrmRoute() {
536-
const ormRoute = path.projectStoragePath('framework/orm/routes')
536+
const ormRoute = path.storagePath('framework/orm/routes')
537537

538538
if (fs.existsSync(ormRoute)) await Bun.$`rm ${ormRoute}`
539539
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export const alias: Record<string, string> = {
9090
'@stacksjs/sms/*': p.smsPath('src/*'),
9191
'@stacksjs/scheduler': p.schedulerPath('src/index.ts'),
9292
'@stacksjs/scheduler/*': p.schedulerPath('src/*'),
93-
'@stacksjs/storage': p.storagePath('src/index.ts'),
94-
'@stacksjs/storage/*': p.storagePath('src/*'),
93+
'@stacksjs/storage': p.coreStoragePath('src/index.ts'),
94+
'@stacksjs/storage/*': p.coreStoragePath('src/*'),
9595
'@stacksjs/strings': p.stringsPath('src/index.ts'),
9696
'@stacksjs/strings/*': p.stringsPath('src/*'),
9797
'@stacksjs/testing/*': p.testingPath('*'),
@@ -187,8 +187,8 @@ export const alias: Record<string, string> = {
187187
'stacks/sms/*': p.smsPath('src/*'),
188188
'stacks/scheduler': p.schedulerPath('src/index.ts'),
189189
'stacks/scheduler/*': p.schedulerPath('src/*'),
190-
'stacks/storage': p.storagePath('src/index.ts'),
191-
'stacks/storage/*': p.storagePath('src/*'),
190+
'stacks/storage': p.coreStoragePath('src/index.ts'),
191+
'stacks/storage/*': p.coreStoragePath('src/*'),
192192
'stacks/strings': p.stringsPath('src/index.ts'),
193193
'stacks/strings/*': p.stringsPath('src/*'),
194194
'stacks/testing/*': p.testingPath('*'),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@ export function make(buddy: CLI) {
330330

331331
log.info(`Creating SSL certificate...`)
332332
await runCommand(`tlsx ${domain}`, {
333-
cwd: p.projectStoragePath('keys'),
333+
cwd: p.storagePath('keys'),
334334
})
335335
log.success('Certificate created')
336336

337337
log.info(`Installing SSL certificate...`)
338338
await runCommand(`tlsx -install`, {
339-
cwd: p.projectStoragePath('keys'),
339+
cwd: p.storagePath('keys'),
340340
})
341341
log.success('Certificate installed')
342342
})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export const frameworkDefaults = {
1313
base: '/docs/',
1414
cleanUrls: true,
1515
srcDir: p.projectPath('docs'),
16-
outDir: p.projectStoragePath('framework/docs'),
17-
cacheDir: p.projectStoragePath('framework/cache/docs'),
16+
outDir: p.storagePath('framework/docs'),
17+
cacheDir: p.storagePath('framework/cache/docs'),
1818
assetsDir: p.assetsPath(),
1919
// sitemap: {
2020
// hostname: 'stacks.localhost',

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ export async function writeToLogFile(message: string) {
1313
const formattedMessage = `[${new Date().toISOString()}] ${message}\n`
1414

1515
try {
16-
const logFilePath = config.logging.logsPath ?? 'storage/logs/stacks.log'
16+
const logFile = config.logging.logsPath ?? 'storage/logs/stacks.log'
1717

1818
try {
1919
// Check if the file exists
20-
await access(logFilePath)
20+
await access(logFile)
2121
} catch {
2222
// File doesn't exist, create the directory
23-
await mkdir(dirname(logFilePath), { recursive: true })
23+
console.log('Creating log file directory...', logFile)
24+
await mkdir(dirname(logFile), { recursive: true })
2425
}
2526

2627
// Append the message to the log file
27-
await appendFile(logFilePath, formattedMessage)
28+
await appendFile(logFile, formattedMessage)
2829
} catch (error) {
2930
console.error('Failed to write to log file:', error)
3031
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ export function fakerPath(path?: string): string {
619619
* @returns The absolute or relative path to the specified file or directory within the framework directory.
620620
*/
621621
export function frameworkPath(path?: string, options?: { relative?: boolean; cwd?: string }): string {
622-
const absolutePath = projectStoragePath(`framework/${path || ''}`)
622+
const absolutePath = storagePath(`framework/${path || ''}`)
623623

624624
if (options?.relative) return relative(options.cwd || process.cwd(), absolutePath)
625625

@@ -740,7 +740,7 @@ export function loggingPath(path?: string): string {
740740
* @returns The absolute path to the specified file or directory within the `logs` directory.
741741
*/
742742
export function logsPath(path?: string): string {
743-
return projectStoragePath(`logs/${path || ''}`)
743+
return storagePath(`logs/${path || ''}`)
744744
}
745745

746746
/**
@@ -908,7 +908,7 @@ export function projectConfigPath(path?: string): string {
908908
* @param path - The relative path to the file or directory within the storage directory.
909909
* @returns The absolute path to the specified file or directory within the storage directory.
910910
*/
911-
export function projectStoragePath(path?: string): string {
911+
export function storagePath(path?: string): string {
912912
return projectPath(`storage/${path || ''}`)
913913
}
914914

@@ -971,7 +971,7 @@ export function realtimePath(path?: string) {
971971
* @returns The absolute or relative path to the specified file or directory within the `resources` directory.
972972
*/
973973
export function resourcesPath(path?: string, options?: { relative?: boolean }) {
974-
const absolutePath = projectStoragePath(`resources/${path || ''}`)
974+
const absolutePath = coreStoragePath(`resources/${path || ''}`)
975975

976976
if (options?.relative) return relative(process.cwd(), absolutePath)
977977

@@ -1080,7 +1080,7 @@ export function smsPath(path?: string) {
10801080
* @param path - The relative path to the file or directory within the storage directory.
10811081
* @returns The absolute path to the specified file or directory within the storage directory.
10821082
*/
1083-
export function storagePath(path?: string) {
1083+
export function coreStoragePath(path?: string) {
10841084
return corePath(`storage/${path || ''}`)
10851085
}
10861086

@@ -1338,7 +1338,7 @@ export const path = {
13381338
paymentsPath,
13391339
projectPath,
13401340
findProjectPath,
1341-
projectStoragePath,
1341+
coreStoragePath,
13421342
publicPath,
13431343
pushPath,
13441344
queryBuilderPath,

storage/framework/core/router/build2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { projectStoragePath, routesPath } from '@stacksjs/path'
1+
import { storagePath, routesPath } from '@stacksjs/path'
22
import { intro, outro } from '../build/src'
33

44
const { startTime } = await intro({
55
dir: import.meta.dir,
66
})
77

88
const result = await Bun.build({
9-
entrypoints: [routesPath('api.ts'), projectStoragePath('framework/orm/routes.ts')],
9+
entrypoints: [routesPath('api.ts'), storagePath('framework/orm/routes.ts')],
1010
outdir: './dist',
1111
format: 'esm',
1212
target: 'bun',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export class Router implements RouterInterface {
275275

276276
if (callbackPath.startsWith('../')) importPathFunction = p.routesPath
277277

278-
if (modulePath.includes('OrmAction')) importPathFunction = p.projectStoragePath
278+
if (modulePath.includes('OrmAction')) importPathFunction = p.coreStoragePath
279279

280280
// Remove trailing .ts if present
281281
modulePath = modulePath.endsWith('.ts') ? modulePath.slice(0, -3) : modulePath

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ export function extractModelFromAction(action: string): string {
1717

1818
if (action.includes('IndexOrmAction')) {
1919
const match = action.match(/\/([A-Z][a-z]+)IndexOrmAction/)
20-
2120
const modelString = match ? match[1] : ''
2221

2322
model = modelString as string
2423
}
2524

2625
if (action.includes('StoreOrmAction')) {
2726
const match = action.match(/\/([A-Z][a-z]+)StoreOrmAction/)
28-
2927
const modelString = match ? match[1] : ''
3028

3129
model = modelString as string
@@ -57,31 +55,24 @@ export function extractModelFromAction(action: string): string {
5755

5856
export function extractDynamicAction(action: string): string | undefined {
5957
const regex = /Actions\/(.*?)Action/
60-
6158
const match = action.match(regex)
6259

6360
return match ? match[1] : ''
6461
}
6562

6663
export async function extractModelRequest(action: string) {
6764
const extractedModel = extractModelFromAction(action)
68-
6965
const lowerCaseModel = camelCase(extractedModel)
70-
7166
const requestPath = path.frameworkPath(`requests/${extractedModel}Request.ts`)
72-
7367
const requestInstance = await import(requestPath)
74-
7568
const requestIndex = `${lowerCaseModel}Request`
7669

7770
return requestInstance[requestIndex]
7871
}
7972

8073
export async function findRequestInstance(requestInstance: string) {
81-
const frameworkDirectory = path.projectStoragePath('framework/requests')
82-
74+
const frameworkDirectory = path.storagePath('framework/requests')
8375
const filePath = path.join(frameworkDirectory, `${requestInstance}.ts`)
84-
8576
const pathExists = await existsSync(filePath)
8677

8778
// Check if the directory exists
@@ -91,8 +82,7 @@ export async function findRequestInstance(requestInstance: string) {
9182
return requestInstance.request
9283
}
9384

94-
const defaultRequestPath = path.projectStoragePath('framework/core/router/src/request.ts')
95-
85+
const defaultRequestPath = path.storagePath('framework/core/router/src/request.ts')
9686
const fileExists = await existsSync(defaultRequestPath)
9787

9888
if (fileExists) {

storage/framework/ide/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ templating
294294
termii
295295
terserrc
296296
textlint
297+
Thhmmss
297298
timestampable
298299
treeshaking
299300
triggerable

0 commit comments

Comments
 (0)