// node native import * as fs from 'fs'; import * as path from 'path'; export { fs, path } // @git.zone scope import * as tspublish from '@git.zone/tspublish'; export { tspublish } // @push.rocks scope import * as smartcli from '@push.rocks/smartcli'; import * as smartdelay from '@push.rocks/smartdelay'; import * as smartfile from '@push.rocks/smartfile'; import * as smartfsModule from '@push.rocks/smartfs'; import * as smartpath from '@push.rocks/smartpath'; import * as smartpromise from '@push.rocks/smartpromise'; // Create a smartfs instance with Node.js provider export const smartfs = new smartfsModule.SmartFs(new smartfsModule.SmartFsProviderNode()); /** * Helper to list files matching a glob pattern like './ts/**\/*.ts' * Parses the pattern to extract base directory and filter pattern */ export async function listFilesWithGlob(basePath: string, globPattern: string): Promise { // Remove leading ./ if present let pattern = globPattern.replace(/^\.\//, ''); // Find the first directory part before any glob characters const globChars = ['*', '?', '{', '[']; let baseDir = basePath; // Find where the glob pattern starts const parts = pattern.split('/'); const staticParts: string[] = []; let filterParts: string[] = []; let foundGlob = false; for (const part of parts) { if (!foundGlob && !globChars.some(c => part.includes(c))) { staticParts.push(part); } else { foundGlob = true; filterParts.push(part); } } // Build the base directory if (staticParts.length > 0) { baseDir = path.join(basePath, ...staticParts); } // Build the filter pattern (just the filename part, ignoring ** for directories) // The recursive() handles the ** part const fileFilter = filterParts[filterParts.length - 1] || '*'; // Check if we need recursive search const needsRecursive = filterParts.some(p => p === '**' || p.includes('**')); let dirBuilder = smartfs.directory(baseDir); if (needsRecursive) { dirBuilder = dirBuilder.recursive(); } try { const entries = await dirBuilder.filter(fileFilter).list(); return entries.filter(e => e.isFile).map(e => e.path); } catch { // Directory doesn't exist or other error return []; } } export { smartcli, smartdelay, smartfile, smartpath, smartpromise }; // third party scope import typescript from 'typescript'; export { typescript }