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

better exclude for lerna private packages #1876

Merged
merged 1 commit into from Mar 14, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/core/src/utils/__tests__/get-lerna-packages.test.ts
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
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