Skip to content

Commit 5898fd4

Browse files
committed
chore: wip
1 parent 93b9a97 commit 5898fd4

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

app/Actions/SubscriberEmailAction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Action } from '@stacksjs/actions'
2+
import { schema } from '@stacksjs/validation'
23
// import { epmailSubscribeRequest } from '@stacksjs/validation'
34
import SubscriberEmail from '../../storage/framework/orm/src/models/SubscriberEmail'
45
import type { SubscriberEmailRequestType } from '../../storage/framework/types/requests'

storage/framework/core/actions/src/generate/lib-entries.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import { hasComponents, hasFunctions } from '@stacksjs/storage'
55
import { generateLibEntry } from '../helpers/lib-entries'
66

77
export async function generateLibEntries() {
8-
console.log('generateLibEntries')
98
log.info('Generating library entry points...')
10-
console.log('generateLibEntries2')
119

1210
if (library.releaseable && hasComponents()) {
1311
await generateLibEntry('vue-components')

storage/framework/core/actions/src/helpers/utils.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,27 @@ type Action = ActionPath | ActionName | string
2020
export async function runAction(action: Action, options?: ActionOptions) {
2121
// check if action is a file anywhere in ./app/Actions/**/*.ts
2222
// if it is, return and await the action
23-
const glob = new Bun.Glob('**/*.ts')
23+
const glob = new Bun.Glob('**/*.{ts,js}')
2424
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true }
2525

2626
for await (const file of glob.scan(scanOptions)) {
27-
log.debug('file', file)
2827
if (file === `${action}.ts` || file.endsWith(`${action}.ts`))
2928
return ((await import(/* @vite-ignore */ p.userActionsPath(file))).default as ActionType).handle()
3029

30+
if (file === `${action}.js` || file.endsWith(`${action}.js`))
31+
return ((await import(/* @vite-ignore */ p.userActionsPath(file))).default as ActionType).handle()
32+
3133
// if a custom model name is used, we need to check for it
32-
const a = await import(/* @vite-ignore */ p.userActionsPath(file))
33-
if (a.name === action) return await a.handle()
34+
try {
35+
const a = await import(/* @vite-ignore */ p.userActionsPath(file))
36+
if (a.name === action) {
37+
console.log('a.name matches', a.name)
38+
return await a.handle()
39+
}
40+
} catch (error) {
41+
console.log('error', error)
42+
process.exit()
43+
}
3444
}
3545

3646
// or else, just run the action normally by assuming the action is core Action, stored in p.actionsPath

0 commit comments

Comments
 (0)