/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/utils/upgrade/src/modules/file-scanner/scanner.ts
24 строки
654 B
Ben Irvin
fix: upgrade tool ignores node modules and dist (#21195)
09 сен 2024, 18:49
Не верифицирован
09 сен 2024, 18:49
41f8115
Код
Авторство
О чём код?
import path from 'node:path'; import fastglob from 'fast-glob'; import type { FileScanner as FileScannerInterface } from './types'; export class FileScanner implements FileScannerInterface { public cwd: string; constructor(cwd: string) { this.cwd = cwd; } scan(patterns: string[]) { // we use fastglob instead of glob because it supports negation patterns const filenames = fastglob.sync(patterns, { cwd: this.cwd, }); // Resolve the full paths for every filename return filenames.map((filename) => path.join(this.cwd, filename)); } } export const fileScannerFactory = (cwd: string) => new FileScanner(cwd);