Skip to content

Commit

Permalink
Merge pull request #1876 from intuit/private-exclude
Browse files Browse the repository at this point in the history
better exclude for lerna private packages
  • Loading branch information
hipstersmoothie authored Mar 14, 2021
2 parents 25f2f02 + 35b39df commit b051e65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion packages/core/src/utils/__tests__/get-lerna-packages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jest.mock("../exec-promise");
// @ts-ignore
execPromise.mockImplementation(exec);

test("it shouldn't included private packages", async () => {
test("it shouldn't included version-less packages", async () => {
exec.mockReturnValue(endent`
/dir/a:a:0.3.0--canary.32.d54a0c4.0
/dir/b:b:MISSING:PRIVATE
Expand All @@ -20,3 +20,17 @@ test("it shouldn't included private packages", async () => {
},
]);
});

test("it shouldn't included private packages", async () => {
exec.mockReturnValue(endent`
/dir/a:a:0.3.0--canary.32.d54a0c4.0
/dir/b:b:0.3.0:PRIVATE
`);
expect(await getLernaPackages()).toStrictEqual([
{
name: "a",
path: "/dir/a",
version: "0.3.0--canary.32.d54a0c4.0",
},
]);
});
4 changes: 2 additions & 2 deletions packages/core/src/utils/get-lerna-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export default async function getLernaPackages() {
const response = await execPromise("npx", ["lerna", "ls", "-pla"]);

response.split("\n").forEach((packageInfo) => {
const [packagePath, name, version] = packageInfo.split(":");
const [packagePath, name, version, isPrivate] = packageInfo.split(":");

if (version !== "MISSING") {
if (version !== "MISSING" && isPrivate !== "PRIVATE") {
packages.push({ path: packagePath, name, version });
}
});
Expand Down

0 comments on commit b051e65

Please sign in to comment.