Skip to content

Commit

Permalink
exclude some dirs from FileSystemRepo, like node_modules and .git
Browse files Browse the repository at this point in the history
  • Loading branch information
rafawalter committed Nov 25, 2020
1 parent 93a3d50 commit 198e01f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/repository/file_system_repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Config from '../config.ts';

export default class FileSystemRepository implements Repository {
packages: Array<FileSystemPackage> = [];
readonly excludeDirs = ['$RECYCLE.BIN', 'node_modules', '.git']

constructor(private config: Config, private rootDir: string) {
log.debug(`FSRepo: Root=${this.rootDir}`);
Expand All @@ -35,8 +36,7 @@ export default class FileSystemRepository implements Repository {
private readPackageInDir(packageName: string, dirname: string): FileSystemPackage | undefined {
let pkg: FileSystemPackage | undefined = undefined;
log.debug(`readDir ${packageName} ${dirname}`)
const ignoreDirs = ['$RECYCLE.BIN', 'node_modules', '.git']
if (ignoreDirs.find(ignoreDir => dirname.endsWith(ignoreDir))) {
if (this.excludeDirs.find(ignoreDir => dirname.endsWith(ignoreDir))) {
log.debug(`ignoring ${dirname}`)
return
}
Expand Down Expand Up @@ -87,12 +87,13 @@ export default class FileSystemRepository implements Repository {
log.debug(`# listPackages: rootDir not found ${this.rootDir}`)
return [];
}

const packagesGlob = `${this.rootDir}/**/*.levain.{yaml,yml}`.replace(/\\/g, '/');
const globOptions: ExpandGlobOptions = {
// root: this.rootDir,
includeDirs: true,
extended: true,
includeDirs: true,
exclude: this.excludeDirs,
}
log.debug(`# listPackages: ${packagesGlob} ${JSON.stringify(globOptions)}`)
const packageFiles = expandGlobSync(packagesGlob, globOptions)
Expand Down

0 comments on commit 198e01f

Please sign in to comment.