Skip to content

Commit

Permalink
fix: ignore directory with no package.json with warning
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Jan 29, 2023
1 parent 6b4e0f3 commit 76cdddf
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/definitions/check-package-with-workspaces.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/definitions/utils/__mocks__/createReportError.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="jest" />
export declare const mockReportError: jest.Mock<any, any, any>;
export declare const createReportError: jest.Mock<any, any, any>;
export declare const mockReportError: jest.Mock<any, any>;
export declare const createReportError: jest.Mock<any, any>;
//# sourceMappingURL=createReportError.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions dist/index-node16.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,10 @@ function createCheckPackageWithWorkspaces(createCheckPackageOptions = {}) {
cwd: pkgDirname
});
match.forEach(pathMatch => {
const stat = fs.statSync(pathMatch);
if (!stat.isDirectory()) return;
if (!fs.existsSync(path.join(pathMatch, 'package.json'))) {
console.log(`Ignored potential directory, no package.json found: ${pathMatch}`);
return;
}
const subPkgDirectoryPath = path.relative(process.cwd(), pathMatch);
workspacePackagesPaths.push(subPkgDirectoryPath);
});
Expand Down
2 changes: 1 addition & 1 deletion dist/index-node16.mjs.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/check-package-with-workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ export function createCheckPackageWithWorkspaces(
pkgWorkspaces.forEach((pattern) => {
const match = glob.sync(pattern, { cwd: pkgDirname });
match.forEach((pathMatch) => {
const stat = fs.statSync(pathMatch);
if (!stat.isDirectory()) return;
if (!fs.existsSync(path.join(pathMatch, 'package.json'))) {
console.log(
`Ignored potential directory, no package.json found: ${pathMatch}`,
);
return;
}
const subPkgDirectoryPath = path.relative(process.cwd(), pathMatch);
workspacePackagesPaths.push(subPkgDirectoryPath);
});
Expand Down

0 comments on commit 76cdddf

Please sign in to comment.