diff --git a/packages/cache/src/cli/compileWalletSetupFunctions.ts b/packages/cache/src/cli/compileWalletSetupFunctions.ts index a8d2c107b..4c366edb2 100644 --- a/packages/cache/src/cli/compileWalletSetupFunctions.ts +++ b/packages/cache/src/cli/compileWalletSetupFunctions.ts @@ -6,21 +6,18 @@ import { FIXES_BANNER } from './compilationFixes' const OUT_DIR_NAME = 'wallet-setup-dist' -export async function compileWalletSetupFunctions( - walletSetupDir: string, - debug: boolean -) { - const outDir = path.join(ensureCacheDirExists(), OUT_DIR_NAME); +export async function compileWalletSetupFunctions(walletSetupDir: string, debug: boolean) { + const outDir = path.join(ensureCacheDirExists(), OUT_DIR_NAME) // Use a normalized glob pattern - const globPattern = path.join(walletSetupDir, '**', '*.setup.{ts,js,mjs}'); - + const globPattern = path.join(walletSetupDir, '**', '*.setup.{ts,js,mjs}') + // Use glob to find files, ensuring proper path handling - const fileList: string[] = await glob(globPattern, { absolute: false, windowsPathsNoEscape: true }); + const fileList: string[] = await glob(globPattern, { absolute: false, windowsPathsNoEscape: true }) if (debug) { - console.log('[DEBUG] Found the following wallet setup files:'); - console.log(fileList, '\n'); + console.log('[DEBUG] Found the following wallet setup files:') + console.log(fileList, '\n') } // TODO: This error message is copied over from another function. Refactor this. @@ -30,7 +27,7 @@ export async function compileWalletSetupFunctions( `No wallet setup files found at ${walletSetupDir}`, 'Remember that all wallet setup files must end with `.setup.{ts,js,mjs}` extension!' ].join('\n') - ); + ) } const normalized = fileList.map((file) => { @@ -63,4 +60,4 @@ export async function compileWalletSetupFunctions( console.log('error within compile', e) } return outDir -} \ No newline at end of file +} diff --git a/packages/cache/src/utils/importWalletSetupFile.ts b/packages/cache/src/utils/importWalletSetupFile.ts index 488bd69bb..ebae4ab90 100644 --- a/packages/cache/src/utils/importWalletSetupFile.ts +++ b/packages/cache/src/utils/importWalletSetupFile.ts @@ -10,7 +10,7 @@ const WalletSetupModule = z.object({ }) export async function importWalletSetupFile(walletSetupFilePath: string) { - const fileToImport = process.platform === 'win32' ? 'file:\\\\\\' + walletSetupFilePath : walletSetupFilePath + const fileToImport = process.platform === 'win32' ? `file:\\\\\\${walletSetupFilePath}` : walletSetupFilePath const walletSetupModule = await import(fileToImport) const result = WalletSetupModule.safeParse(walletSetupModule) if (!result.success) {