File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
import jiti from 'jiti'
2
- import { dirname } from 'pathe'
2
+ import { resolve } from 'pathe'
3
3
import { filename } from 'pathe/utils'
4
4
import type {
5
5
ButtonConfig ,
@@ -62,9 +62,14 @@ export const resolveCommand = (
62
62
} )
63
63
const _cmdPath = _jiti . resolve ( cmd )
64
64
const command = _jiti ( _cmdPath ) as HarmonixCommand
65
+ const relativePath = resolve ( _cmdPath ) . replace ( harmonixOptions . rootDir , '' )
66
+ const categoryMatch = relativePath . match (
67
+ / \/ c o m m a n d s \/ ( .+ ?) \/ [ ^ \/ ] + \. ( t s | j s ) /
68
+ )
69
+ const category = categoryMatch ? categoryMatch [ 1 ] : undefined
65
70
const config : CommandConfig = {
66
71
name : command . config . name || filename ( _cmdPath ) ,
67
- category : command . config . category || filename ( dirname ( _cmdPath ) ) ,
72
+ category : command . config . category ?? category ,
68
73
...command . config
69
74
}
70
75
You can’t perform that action at this time.
0 commit comments