Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore git-ignored files when glob searching for packages #55

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tricky-olives-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@manypkg/get-packages": patch
---

Ignore git-ignored files when glob searching for packages. This fixes an issue with package cycles.
14 changes: 8 additions & 6 deletions packages/get-packages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,19 @@ export async function getPackages(dir: string): Promise<Packages> {
};
}

const folders = await globby(tool.packageGlobs, {
const directories = await globby(tool.packageGlobs, {
cwd,
onlyDirectories: true,
absolute: true,
expandDirectories: false
expandDirectories: false,
gitignore: true
});

let pkgJsonsMissingNameField: Array<string> = [];

const results = (
await Promise.all(
folders.sort().map(dir =>
directories.sort().map(dir =>
fs
.readJson(path.join(dir, "package.json"))
.then(packageJson => {
Expand Down Expand Up @@ -197,16 +198,17 @@ export function getPackagesSync(dir: string): Packages {
packages: [root]
};
}
const folders = globbySync(tool.packageGlobs, {
const directories = globbySync(tool.packageGlobs, {
cwd,
onlyDirectories: true,
absolute: true,
expandDirectories: false
expandDirectories: false,
gitignore: true
});

let pkgJsonsMissingNameField: Array<string> = [];

const results = folders
const results = directories
.sort()
.map(dir => {
try {
Expand Down