Skip to content

Commit fd30c0b

Browse files
committed
fixed #86 and lint errors
1 parent a213995 commit fd30c0b

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ watch:
77
./node_modules/.bin/gulp watch
88

99
test-only:
10-
./node_modules/.bin/nyc --check-coverage --lines 85 --branches 74 --functions 85 ./node_modules/.bin/ava --verbose test/
10+
./node_modules/.bin/nyc --check-coverage --lines 85 --branches 74 --functions 85 ./node_modules/.bin/ava --verbose --concurrency 5 test/
1111
./node_modules/.bin/nyc report --reporter=lcov
1212

1313
lint:

src/cli/commands/install.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import type { RegistryNames } from "../../registries/index.js";
1313
import type { Reporter } from "kreporters";
1414
import type Config from "../../config.js";
15-
import type { DependencyRequestPatterns } from "../../types.js";
1615
import Lockfile from "../../lockfile/index.js";
1716
import lockStringify from "../../lockfile/stringify.js";
1817
import PackageInstallScripts from "../../package-install-scripts.js";
@@ -31,18 +30,6 @@ let invariant = require("invariant");
3130
let emoji = require("node-emoji");
3231
let path = require("path");
3332

34-
type FetchResolveParams = {
35-
totalSteps: number,
36-
patterns: Array<string>,
37-
requests: DependencyRequestPatterns
38-
};
39-
40-
type FetchResolveReturn = {
41-
patterns: Array<string>,
42-
total: number,
43-
step: number
44-
};
45-
4633
type InstallActions = "install" | "update" | "uninstall";
4734

4835
export class Install {

src/package-linker.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ export default class PackageLinker {
223223

224224
async copyModules(patterns: Array<string>): Promise<void> {
225225
let flatTree = await this.initCopyModules(patterns);
226+
// sorted tree makes file creation and copying not to interfere with each other
227+
flatTree = flatTree.sort((dep1, dep2) => {
228+
return dep1[0].localeCompare(dep2[0]);
229+
});
226230
let self = this;
227231

228232
//

test/commands/install.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ async function run(flags, args, name, checkInstalled, beforeInstall) {
7676
}
7777

7878
async function getPackageVersion(config, packagePath) {
79-
return JSON.parse(await fs.readFile(path.join(config.cwd, `node_modules/${packagePath}/package.json`))).version;
79+
return JSON.parse(await fs.readFile(
80+
path.join(config.cwd, `node_modules/${packagePath}/package.json`))).version;
8081
}
8182

8283
test("root install from shrinkwrap", () => {
@@ -653,7 +654,7 @@ test.skip("install --save should add missing deps to fbkpm and mirror (PR import
653654
let cwd = path.join(fixturesLoc, fixture);
654655
await fs.copy(path.join(cwd, "fbkpm.lock.before"), path.join(cwd, "fbkpm.lock"));
655656

656-
return run({save: true}, [], fixture, async (config, reporter) => {
657+
return run({save: true}, [], fixture, async (config) => {
657658
assert.equal(await getPackageVersion(config, "mime-types"), "2.0.0");
658659
assert(semver.satisfies(await getPackageVersion(config, "mime-db"), "~1.0.1"));
659660
assert.equal(await getPackageVersion(config, "fake-fbkpm-dependency"), "1.0.1");
@@ -678,7 +679,8 @@ test.skip("install --save should add missing deps to fbkpm and mirror (PR import
678679
});
679680

680681
// TODO https://github.com/facebook/fbkpm/issues/78
681-
test.skip("install --save should update a dependency to fbkpm and mirror (PR import scenario 2)", async () => {
682+
test.skip("install --save should update a dependency to fbkpm and mirror (PR import scenario 2)",
683+
async () => {
682684
// mime-types@2.0.0 is saved in local mirror and gets updated to mime-types@2.1.11 via
683685
// a change in package.json,
684686
// files in mirror, fbkpm.lock, package.json and node_modules should reflect that
@@ -741,7 +743,7 @@ test("install --initMirror should add init mirror deps from package.json", async
741743
let fixture = "install-init-mirror";
742744

743745
// initMirror gets converted to save flag in cli/install.js
744-
return run({save: true}, [], fixture, async (config, reporter) => {
746+
return run({save: true}, [], fixture, async (config) => {
745747
assert.equal(await getPackageVersion(config, "mime-types"), "2.0.0");
746748
assert(semver.satisfies(await getPackageVersion(config, "mime-db"), "~1.0.1"));
747749

0 commit comments

Comments
 (0)