Skip to content

Commit

Permalink
feat(deps): @evocateur/pacote -> pacote@^11.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Nov 17, 2020
1 parent 7d055f1 commit 99b4217
Show file tree
Hide file tree
Showing 11 changed files with 1,309 additions and 375 deletions.
12 changes: 6 additions & 6 deletions commands/add/__tests__/add-command.test.js
@@ -1,11 +1,11 @@
"use strict";

jest.mock("@lerna/bootstrap");
jest.mock("@evocateur/pacote/manifest");
jest.mock("pacote");

// mocked or stubbed modules
const bootstrap = require("@lerna/bootstrap");
const getManifest = require("@evocateur/pacote/manifest");
const pacote = require("pacote");

// helpers
const initFixture = require("@lerna-test/init-fixture")(__dirname);
Expand All @@ -21,7 +21,7 @@ describe("AddCommand", () => {
// we already have enough tests of BootstrapCommand
bootstrap.mockResolvedValue();
// we don't need network requests during unit tests
getManifest.mockResolvedValue({ version: "1.0.0" });
pacote.manifest.mockResolvedValue({ version: "1.0.0" });

it("should throw without packages", async () => {
const testDir = await initFixture("basic");
Expand Down Expand Up @@ -55,7 +55,7 @@ describe("AddCommand", () => {
expect(pkg3).toDependOn("tiny-tarball");
expect(pkg4).toDependOn("tiny-tarball");

expect(getManifest).toHaveBeenLastCalledWith(
expect(pacote.manifest).toHaveBeenLastCalledWith(
expect.objectContaining({
// an npm-package-arg Result
name: "tiny-tarball",
Expand Down Expand Up @@ -235,7 +235,7 @@ describe("AddCommand", () => {
it("accepts --registry option", async () => {
const testDir = await initFixture("basic");

getManifest.mockImplementationOnce(() => {
pacote.manifest.mockImplementationOnce(() => {
const err = new Error("ENOTFOUND");
return Promise.reject(err);
});
Expand All @@ -249,7 +249,7 @@ describe("AddCommand", () => {
// obviously this registry doesn't exist, thus it will always error
await expect(command).rejects.toThrow(/ENOTFOUND/);

expect(getManifest).toHaveBeenLastCalledWith(
expect(pacote.manifest).toHaveBeenLastCalledWith(
expect.objectContaining({
name: "@my-own/private-idaho",
}),
Expand Down
4 changes: 2 additions & 2 deletions commands/add/index.js
Expand Up @@ -4,7 +4,7 @@ const dedent = require("dedent");
const npa = require("npm-package-arg");
const pMap = require("p-map");
const path = require("path");
const getManifest = require("@evocateur/pacote/manifest");
const pacote = require("pacote");
const semver = require("semver");

const Command = require("@lerna/command");
Expand Down Expand Up @@ -194,7 +194,7 @@ class AddCommand extends Command {
registry: this.options.registry,
});

return getManifest(this.spec, opts.snapshot).then((pkg) => pkg.version);
return pacote.manifest(this.spec, opts.snapshot).then((pkg) => pkg.version);
}

packageSatisfied() {
Expand Down
2 changes: 1 addition & 1 deletion commands/add/package.json
Expand Up @@ -33,7 +33,6 @@
"test": "echo \"Run tests from root\" && exit 1"
},
"dependencies": {
"@evocateur/pacote": "^9.6.3",
"@lerna/bootstrap": "file:../bootstrap",
"@lerna/command": "file:../../core/command",
"@lerna/filter-options": "file:../../core/filter-options",
Expand All @@ -42,6 +41,7 @@
"dedent": "^0.7.0",
"npm-package-arg": "^8.1.0",
"p-map": "^4.0.0",
"pacote": "^11.1.13",
"semver": "^7.3.2"
}
}
8 changes: 4 additions & 4 deletions commands/create/__tests__/create-command.test.js
@@ -1,14 +1,14 @@
"use strict";

jest.mock("@evocateur/pacote/manifest");
jest.mock("pacote");

const fs = require("fs-extra");
const path = require("path");
const execa = require("execa");
const slash = require("slash");

// mocked modules
const getManifest = require("@evocateur/pacote/manifest");
const pacote = require("pacote");

// helpers
const initFixture = require("@lerna-test/init-fixture")(__dirname);
Expand Down Expand Up @@ -48,7 +48,7 @@ const manifestCreated = async (cwd) => {
};

describe("CreateCommand", () => {
getManifest.mockImplementation(() => Promise.resolve({ version: "1.0.0-mocked" }));
pacote.manifest.mockImplementation(() => Promise.resolve({ version: "1.0.0-mocked" }));

// preserve value from @lerna-test/set-npm-userconfig
const userconfig = process.env.npm_config_userconfig;
Expand Down Expand Up @@ -122,7 +122,7 @@ describe("CreateCommand", () => {
expect(result).toMatchSnapshot();

// yargs is automatically added when CLI is stubbed
expect(getManifest).toHaveBeenLastCalledWith(
expect(pacote.manifest).toHaveBeenLastCalledWith(
expect.objectContaining({
name: "yargs",
type: "tag",
Expand Down
4 changes: 2 additions & 2 deletions commands/create/index.js
Expand Up @@ -7,7 +7,7 @@ const { URL } = require("whatwg-url");
const { camelCase } = require("yargs-parser");
const dedent = require("dedent");
const initPackageJson = require("pify")(require("init-package-json"));
const getManifest = require("@evocateur/pacote/manifest");
const pacote = require("pacote");
const npa = require("npm-package-arg");
const pReduce = require("p-reduce");
const slash = require("slash");
Expand Down Expand Up @@ -253,7 +253,7 @@ class CreateCommand extends Command {
}

// from registry
return getManifest(spec, pacoteOpts).then((pkg) => `${savePrefix}${pkg.version}`);
return pacote.manifest(spec, pacoteOpts).then((pkg) => `${savePrefix}${pkg.version}`);
}

if (spec.type === "git") {
Expand Down
2 changes: 1 addition & 1 deletion commands/create/package.json
Expand Up @@ -33,7 +33,6 @@
"test": "echo \"Run tests from root\" && exit 1"
},
"dependencies": {
"@evocateur/pacote": "^9.6.3",
"@lerna/child-process": "file:../../core/child-process",
"@lerna/command": "file:../../core/command",
"@lerna/npm-conf": "file:../../utils/npm-conf",
Expand All @@ -44,6 +43,7 @@
"init-package-json": "^2.0.1",
"npm-package-arg": "^8.1.0",
"p-reduce": "^2.1.0",
"pacote": "^11.1.13",
"pify": "^5.0.0",
"semver": "^7.3.2",
"slash": "^3.0.0",
Expand Down
6 changes: 3 additions & 3 deletions commands/publish/__tests__/get-unpublished-packages.test.js
@@ -1,9 +1,9 @@
"use strict";

jest.mock("@evocateur/pacote/packument");
jest.mock("pacote");

// mocked module(s)
const getPackument = require("@evocateur/pacote/packument");
const pacote = require("pacote");

// helpers
const PackageGraph = require("@lerna/package-graph");
Expand All @@ -13,7 +13,7 @@ const initFixture = require("@lerna-test/init-fixture")(__dirname);
// file under test
const getUnpublishedPackages = require("../lib/get-unpublished-packages");

getPackument.mockImplementation(async (pkg) => {
pacote.packument.mockImplementation(async (pkg) => {
if (pkg === "package-1") {
return {
versions: {},
Expand Down
4 changes: 2 additions & 2 deletions commands/publish/lib/get-unpublished-packages.js
Expand Up @@ -2,7 +2,7 @@

const log = require("npmlog");
const pMap = require("p-map");
const getPackument = require("@evocateur/pacote/packument");
const pacote = require("pacote");

module.exports = getUnpublishedPackages;

Expand All @@ -15,7 +15,7 @@ function getUnpublishedPackages(packageGraph, opts) {
const graphNodesToCheck = Array.from(packageGraph.values()).filter(({ pkg }) => !pkg.private);

const mapper = (pkg) =>
getPackument(pkg.name, opts).then(
pacote.packument(pkg.name, opts).then(
(packument) => {
if (packument.versions === undefined || packument.versions[pkg.version] === undefined) {
return pkg;
Expand Down
2 changes: 1 addition & 1 deletion commands/publish/package.json
Expand Up @@ -36,7 +36,6 @@
"dependencies": {
"@evocateur/libnpmaccess": "^3.1.2",
"@evocateur/npm-registry-fetch": "^4.0.0",
"@evocateur/pacote": "^9.6.3",
"@lerna/check-working-tree": "file:../../utils/check-working-tree",
"@lerna/child-process": "file:../../core/child-process",
"@lerna/collect-updates": "file:../../utils/collect-updates",
Expand All @@ -62,6 +61,7 @@
"npmlog": "^4.1.2",
"p-map": "^4.0.0",
"p-pipe": "^3.1.0",
"pacote": "^11.1.13",
"semver": "^7.3.2"
}
}

0 comments on commit 99b4217

Please sign in to comment.