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

Markings report fails in non-monorepo style repos #33

Open
majgaard opened this issue Oct 20, 2020 · 0 comments
Open

Markings report fails in non-monorepo style repos #33

majgaard opened this issue Oct 20, 2020 · 0 comments

Comments

@majgaard
Copy link

The way the code below is written causes markings reports to fail for any markings in files which belong to the root package.

function getPackageFromFilename(
repoRoot: string,
filename: string,
packagesByDirectory: Map<string, Package>
) {
let currentDir = nodePath.dirname(filename);
while (currentDir !== repoRoot) {
let maybeCurrentPackage = packagesByDirectory.get(currentDir);
if (maybeCurrentPackage !== undefined) {
return maybeCurrentPackage;
}
currentDir = nodePath.dirname(currentDir);
}
throw new Error(`could not find package from ${JSON.stringify(filename)}`);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant