Skip to content

Commit db5d1d7

Browse files
committed
Fixed scenario for importing a PR with package.json changed
If package.json has changed you should be able to run `kpm install --save` to udpate offline mirror and fbkpm.lock with latest package.json.
1 parent 7c52e1c commit db5d1d7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/cli/commands/install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ function isStrictLockfile(flags: Object, args: Array<string>): boolean {
337337
*/
338338

339339
function shouldWriteLockfileIfExists(flags: Object, args: Array<string>): boolean {
340-
if (args.length) {
340+
if (args.length || flags.save) {
341341
return shouldWriteLockfile(flags, args);
342342
} else {
343343
return false;

test/commands/install.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,7 @@ test("uninstall should remove subdependencies", () => {
647647
});
648648
});
649649

650-
// TODO https://github.com/facebook/fbkpm/issues/77
651-
test.failing("[network] install --save should add missing deps to fbkpm and mirror (PR import scenario)",
650+
test("[network] install --save should add missing deps to fbkpm and mirror (PR import scenario)",
652651
async () => {
653652
let mirrorPath = "mirror-for-offline";
654653
let fixture = "install-import-pr";
@@ -668,7 +667,6 @@ async () => {
668667

669668
let lockFileContent = await fs.readFile(path.join(config.cwd, "fbkpm.lock"));
670669
let lockFileLines = lockFileContent.split("\n").filter((line) => !!line);
671-
// TODO error here
672670
assert.equal(lockFileLines.length, 14);
673671
assert.equal(lockFileLines[4].indexOf("mime-db@"), 0);
674672
assert.equal(lockFileLines[8].indexOf("mime-types@2.0.0"), 0);

0 commit comments

Comments
 (0)