for now copy paste new ioc system

This commit is contained in:
Jacob Nguyen
2024-05-03 18:13:34 -05:00
parent b0e9d15fa7
commit cd92b54839
12 changed files with 222 additions and 205 deletions

View File

@@ -34,17 +34,17 @@ export const shouldHandle = (pth: string, filenam: string) => {
* esm javascript, typescript, and commonjs typescript
* export default commandModule({})
*/
export async function importModule<T>(absPath: string) {
let fileModule = await import(absPath);
let commandModule = fileModule.default;
assert(commandModule , `No export @ ${absPath}. Forgot to ignore with "!"? (!${path.basename(absPath)})?`);
if ('default' in commandModule) {
commandModule = commandModule.default;
}
return { module: commandModule } as T;
}
//async function importModule<T>(absPath: string) {
// let fileModule = await import(absPath);
//
// let commandModule = fileModule.default;
//
// assert(commandModule , `No export @ ${absPath}. Forgot to ignore with "!"? (!${path.basename(absPath)})?`);
// if ('default' in commandModule) {
// commandModule = commandModule.default;
// }
// return { module: commandModule } as T;
//}
export const fmtFileName = (fileName: string) => path.parse(fileName).name;