Skip to content

Commit f457117

Browse files
chore: wip
1 parent 08a9189 commit f457117

File tree

19 files changed

+76
-71
lines changed

19 files changed

+76
-71
lines changed

app/Listener.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ import { path as p } from '@stacksjs/path'
33
import events from './Events'
44

55
for (const key in events) {
6-
// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>
7-
if (events.hasOwnProperty(key)) {
8-
const eventKey = key
9-
const eventListeners = events[key]
6+
// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>
7+
if (events.hasOwnProperty(key)) {
8+
const eventKey = key
9+
const eventListeners = events[key]
1010

11-
for (const eventListener of eventListeners) {
12-
const modulePath = eventListener
13-
14-
if (isFunction(modulePath)) {
15-
await modulePath()
16-
} else {
17-
try {
18-
const actionModule = await import(p.projectPath(`Actions/${modulePath}.ts`))
19-
20-
listen(eventKey, e => actionModule.default.handle(e))
21-
} catch (error) {
22-
console.error('Module not found:', modulePath);
23-
}
24-
}
11+
for (const eventListener of eventListeners) {
12+
const modulePath = eventListener
13+
14+
if (isFunction(modulePath)) {
15+
await modulePath()
16+
} else {
17+
try {
18+
const actionModule = await import(p.projectPath(`Actions/${modulePath}.ts`))
19+
20+
listen(eventKey, (e) => actionModule.default.handle(e))
21+
} catch (error) {
22+
console.error('Module not found:', modulePath)
2523
}
24+
}
2625
}
2726
}
27+
}
2828

29-
function isFunction(val: unknown): val is Function {
30-
return typeof val === 'function'
31-
}
29+
function isFunction(val: unknown): val is Function {
30+
return typeof val === 'function'
31+
}

storage/framework/cloud/build.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ async function buildServer() {
5555

5656
async function main() {
5757
useCustomOrDefaultServerConfig()
58-
if (cloudConfig.api?.deploy)
59-
await buildServer()
58+
if (cloudConfig.api?.deploy) await buildServer()
6059
}
6160

6261
main().catch((error) => {

storage/framework/cloud/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ if (process.env.QUEUE_WORKER) {
3030
process.exit(0)
3131
}
3232

33-
const development =
34-
process.env.APP_ENV?.toLowerCase() !== 'production' &&
35-
process.env.APP_ENV?.toLowerCase() !== 'prod'
33+
const development = process.env.APP_ENV?.toLowerCase() !== 'production' && process.env.APP_ENV?.toLowerCase() !== 'prod'
3634

3735
const server = Bun.serve({
3836
port: 3000,
@@ -65,11 +63,7 @@ const server = Bun.serve({
6563
console.log('WebSocket message', message)
6664
},
6765

68-
async close(
69-
ws: ServerWebSocket,
70-
code: number,
71-
reason?: string,
72-
): Promise<void> {
66+
async close(ws: ServerWebSocket, code: number, reason?: string): Promise<void> {
7367
console.log('WebSocket closed', { code, reason })
7468
},
7569
},
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { watch } from 'fs'
2+
3+
const watcher = watch('/Users/glennmichaeltorregosa/Documents/Projects/stacks/app/Models', async (event, filename) => {
4+
await Bun.$`bun ../orm/generate-model.ts`
5+
6+
console.log('generated orm models')
7+
})

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { fs, glob } from '@stacksjs/storage'
55
import { camelCase, pascalCase, plural, singular, snakeCase } from '@stacksjs/strings'
66
import type { Attributes, Model, RelationConfig } from '@stacksjs/types'
77
import { isString } from '@stacksjs/validation'
8+
89
export interface FieldArrayElement {
910
entity: string
1011
charValue?: string | null
@@ -359,8 +360,7 @@ async function initiateModelGeneration(modelStringFile?: string): Promise<void>
359360
await generateApiRoutes(modelFiles)
360361

361362
for (const modelFile of modelFiles) {
362-
363-
if (modelStringFile && (modelStringFile !== modelFile)) continue
363+
if (modelStringFile && modelStringFile !== modelFile) continue
364364

365365
log.debug(`Processing model file: ${modelFile}`)
366366

@@ -463,18 +463,16 @@ async function deleteExistingOrmActions(modelStringFile?: string) {
463463
if (modelStringFile) {
464464
const ormPath = path.projectStoragePath(`framework/orm/Actions/${modelStringFile}.ts`)
465465

466-
if (fs.existsSync(ormPath)) await Bun.$`rm ${ormPath}`
466+
if (fs.existsSync(ormPath)) await Bun.$`rm ${ormPath}`
467467

468-
return
468+
return
469469
}
470470

471471
const ormPaths = glob.sync(path.projectStoragePath(`framework/orm/Actions/*.ts`))
472472

473473
for (const ormPath of ormPaths) {
474474
if (fs.existsSync(ormPath)) await Bun.$`rm ${ormPath}`
475475
}
476-
477-
478476
}
479477

480478
async function deleteExistingModelNameTypes() {

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,15 @@ export function cloud(buddy: CLI) {
112112
if (options.diff) {
113113
const result = await runCommand('npx cdk diff', {
114114
cwd: p.frameworkCloudPath(),
115-
stdin: 'pipe'
115+
stdin: 'pipe',
116116
})
117117

118118
if (result.isErr()) {
119-
await outro('While running the cloud diff command, there was an issue', { startTime, useSeconds: true }, result.error)
119+
await outro(
120+
'While running the cloud diff command, there was an issue',
121+
{ startTime, useSeconds: true },
122+
result.error,
123+
)
120124
process.exit(ExitCode.FatalError)
121125
}
122126

@@ -506,11 +510,15 @@ export function cloud(buddy: CLI) {
506510

507511
const result = await runCommand('npx cdk diff', {
508512
cwd: p.frameworkCloudPath(),
509-
stdin: 'pipe'
513+
stdin: 'pipe',
510514
})
511515

512516
if (result.isErr()) {
513-
await outro('While running the cloud diff command, there was an issue', { startTime, useSeconds: true }, result.error)
517+
await outro(
518+
'While running the cloud diff command, there was an issue',
519+
{ startTime, useSeconds: true },
520+
result.error,
521+
)
514522
process.exit(ExitCode.FatalError)
515523
}
516524

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class CdnStack {
111111
enableIpv6: true,
112112

113113
defaultBehavior: {
114-
origin: new origins.S3Origin(config.app.docMode ? props.docsBucket as s3.Bucket : props.publicBucket, {
114+
origin: new origins.S3Origin(config.app.docMode ? (props.docsBucket as s3.Bucket) : props.publicBucket, {
115115
originAccessIdentity: this.originAccessIdentity,
116116
}),
117117
edgeLambdas: [

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,9 @@ export class Cloud extends Stack {
110110
})
111111

112112
await this.queue.init()
113-
114113
}
115114

116-
this.cdn = new CdnStack(this, {
115+
this.cdn = new CdnStack(this, {
117116
...props,
118117
publicBucket: this.storage.publicBucket,
119118
docsBucket: this.storage.docsBucket,
@@ -128,7 +127,6 @@ export class Cloud extends Stack {
128127
lb: this.api?.lb,
129128
})
130129

131-
132130
this.deployment = new DeploymentStack(this, {
133131
...props,
134132
publicBucket: this.storage.publicBucket,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export class StorageStack {
4444
Tags.of(this.docsBucket).add('weekly-backup', 'true')
4545
}
4646

47-
4847
this.privateBucket = new s3.Bucket(scope, 'PrivateBucket', {
4948
bucketName: `${this.bucketPrefix}-private-${props.timestamp}`,
5049
versioned: true,

storage/framework/core/components/notification/auto-imports.d.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/* eslint-disable */
2-
/* prettier-ignore */
3-
// @ts-nocheck
4-
// noinspection JSUnusedGlobalSymbols
5-
// Generated by unplugin-auto-import
6-
export {}
71
declare global {
82
const Action: typeof import('../../actions/src/action')['Action']
93
const BunCronJob: typeof import('../../scheduler/src/index')['BunCronJob']
@@ -961,11 +955,23 @@ declare global {
961955
// for type re-export
962956
declare global {
963957
// @ts-ignore
964-
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
958+
export type {
959+
Component,
960+
ComponentPublicInstance,
961+
ComputedRef,
962+
ExtractDefaultPropTypes,
963+
ExtractPropTypes,
964+
ExtractPublicPropTypes,
965+
InjectionKey,
966+
PropType,
967+
Ref,
968+
VNode,
969+
WritableComputedRef,
970+
} from 'vue'
965971
import('vue')
966972
}
967973
// for vue template auto import
968-
import { UnwrapRef } from 'vue'
974+
import type { UnwrapRef } from 'vue'
969975
declare module 'vue' {
970976
interface GlobalComponents {}
971977
interface ComponentCustomProperties {

0 commit comments

Comments
 (0)