Skip to content

Commit

Permalink
fix: fix strict-ssl mapping for node-fetch-registry during unpublishe…
Browse files Browse the repository at this point in the history
…d projects lookup (#3747)
  • Loading branch information
CSchulz committed Jun 27, 2023
1 parent 6123e86 commit 5fcf94e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions libs/commands/publish/src/lib/fetch-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import log from "npmlog";

export interface FetchConfig {
[key: string]: unknown;
fetchRetries?: number;
log: typeof log;
registry?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ test("getProjectsWithUnpublishedPackages with private package", async () => {
}),
]);
});

test("getProjectsWithUnpublishedPackages with strict-ssl = false", async () => {
const cwd = await initFixture("public-private");
const packages = await getPackages(cwd);
const projectNodes = packages.map(
(pkg): ProjectGraphProjectNodeWithPackage => ({
name: pkg.name,
type: "lib",
data: { root: pkg.location },
package: pkg,
})
);

const opts = { "strict-ssl": false };
const pkgs = await getProjectsWithUnpublishedPackages(projectNodes, opts);

expect(pacote.packument).toHaveBeenCalledWith("package-1", { "strict-ssl": false, strictSSL: false });
expect(pkgs).toEqual([
expect.objectContaining({
name: "package-1",
}),
]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export async function getProjectsWithUnpublishedPackages(

const mapper = (node: ProjectGraphProjectNodeWithPackage) => {
const pkg = getPackage(node);
// libnpmpublish / npm-registry-fetch check strictSSL rather than strict-ssl
opts["strictSSL"] = opts["strict-ssl"];
return pacote.packument(pkg.name, opts).then(
(packument) => {
if (packument.versions === undefined || packument.versions[pkg.version] === undefined) {
Expand Down

0 comments on commit 5fcf94e

Please sign in to comment.