Skip to content

Commit f8c42ba

Browse files
committed
chore: wip
1 parent cab5ffe commit f8c42ba

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

storage/framework/core/actions/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@
2727
],
2828
"exports": {
2929
".": {
30-
"types": "./dist/index.d.ts",
3130
"import": "./dist/index.js"
3231
},
3332
"./*": {
34-
"types": "./dist/*.d.ts",
3533
"import": "./dist/*"
3634
}
3735
},

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Action as ActionType } from '@stacksjs/actions'
22
import type { Err, Ok, Result } from '@stacksjs/error-handling'
33
import type { ActionOptions, CliOptions, CommandError, Readable, Subprocess, Writable } from '@stacksjs/types'
44
import { buddyOptions, runCommand, runCommands } from '@stacksjs/cli'
5-
import { err, handleError } from '@stacksjs/error-handling'
5+
import { err } from '@stacksjs/error-handling'
66
import { log } from '@stacksjs/logging'
77
import * as p from '@stacksjs/path'
88
import { globSync } from '@stacksjs/storage'
@@ -24,25 +24,24 @@ export async function runAction(action: Action, options?: ActionOptions): Promis
2424
// check if action is a file anywhere in ./app/Actions/**/*.ts
2525
// if it is, return and await the action
2626
const glob = new Bun.Glob('**/*.{ts,js}')
27-
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true }
27+
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true, absolute: true }
2828

2929
for await (const file of glob.scan(scanOptions)) {
30-
if (file === `${action}.ts` || file.endsWith(`${action}.ts`))
31-
return ((await import(p.userActionsPath(file))).default as ActionType).handle()
32-
33-
if (file === `${action}.js` || file.endsWith(`${action}.js`))
34-
return ((await import(p.userActionsPath(file))).default as ActionType).handle()
30+
if (file.endsWith(`${action}.ts`) || file.endsWith(`${action}.js`))
31+
return ((await import(file)).default as ActionType).handle()
3532

3633
// if a custom model name is used, we need to check for it
3734
try {
38-
const a = await import(p.userActionsPath(file))
35+
log.debug('trying to import', file)
36+
const a = await import(file)
3937
if (a.name === action) {
40-
console.log('a.name matches', a.name)
38+
log.debug('a.name matches', a.name)
4139
return await a.handle()
4240
}
4341
}
42+
// eslint-disable-next-line unused-imports/no-unused-vars
4443
catch (error) {
45-
handleError(error)
44+
// handleError(error, { shouldExit: false })
4645
}
4746
}
4847

0 commit comments

Comments
 (0)