Skip to content

Commit

Permalink
fix(create): Pass options snapshot to pacote.manifest()
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Dec 19, 2018
1 parent 11c583c commit 6116680
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions commands/create/__tests__/create-command.test.js
Expand Up @@ -6,7 +6,6 @@ const fs = require("fs-extra");
const path = require("path");
const execa = require("execa");
const slash = require("slash");
const { Conf } = require("@lerna/npm-conf");

// mocked modules
const getManifest = require("libnpm/manifest");
Expand Down Expand Up @@ -131,7 +130,10 @@ describe("CreateCommand", () => {
type: "tag",
fetchSpec: "latest",
}),
expect.any(Conf)
expect.objectContaining({
// an npm-conf snapshot
registry: "https://registry.npmjs.org/",
})
);
});

Expand Down
3 changes: 2 additions & 1 deletion commands/create/index.js
Expand Up @@ -229,6 +229,7 @@ class CreateCommand extends Command {
const exts = this.collectExternalVersions();
const localRelative = this.hasLocalRelativeFileSpec();
const savePrefix = this.conf.get("save-exact") ? "" : this.conf.get("save-prefix");
const pacoteOpts = this.conf.snapshot;

const decideVersion = spec => {
if (this.packageGraph.has(spec.name)) {
Expand All @@ -252,7 +253,7 @@ class CreateCommand extends Command {
}

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

if (spec.type === "git") {
Expand Down

0 comments on commit 6116680

Please sign in to comment.