From 37b39a7e0a2c13144e2b0ad7cc9a984a47245b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Tue, 23 Jul 2019 00:28:49 +0100 Subject: [PATCH] remove dep on `mkdirp` (#1253) There's no need for us to depend on `mkdirp`, because the `fs-extra` module already has `fs.mkdirp` and `fs.mkdirpSync`. This commit removes the dep from our `package.json`, and removes all explicit imports of it. Test plan: `yarn test --full` passes. `git grep "import mkdirp"` has no hits. --- package.json | 1 - src/cli/load.js | 3 +-- src/plugins/git/example/exampleRepo.js | 6 +++--- src/plugins/git/gitUtils.js | 5 ++--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 26e245f..058f590 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.5.0", "lodash.sortby": "^4.7.0", - "mkdirp": "^0.5.1", "object-assign": "4.1.1", "pako": "^1.0.6", "promise": "8.0.3", diff --git a/src/cli/load.js b/src/cli/load.js index df5f642..8b3f5ad 100644 --- a/src/cli/load.js +++ b/src/cli/load.js @@ -1,7 +1,6 @@ // @flow // Implementation of `sourcecred load`. -import mkdirp from "mkdirp"; import path from "path"; import chalk from "chalk"; @@ -303,7 +302,7 @@ export const loadIndividualPlugin = async ( repoIdToString(output), plugin ); - mkdirp.sync(directory); + fs.mkdirpSync(directory); return directory; } const outputDirectory = scopedDirectory("data"); diff --git a/src/plugins/git/example/exampleRepo.js b/src/plugins/git/example/exampleRepo.js index 48dc02e..30b0090 100644 --- a/src/plugins/git/example/exampleRepo.js +++ b/src/plugins/git/example/exampleRepo.js @@ -1,7 +1,7 @@ // @flow -import mkdirp from "mkdirp"; import tmp from "tmp"; +import fs from "fs-extra"; import {makeUtils} from "../gitUtils"; import type {Hash} from "../types"; @@ -31,7 +31,7 @@ export const SUBMODULE_COMMIT_2: Hash = */ export function createExampleRepo(intoDirectory: string): RepositoryInfo { const repositoryPath = intoDirectory; - mkdirp(repositoryPath); + fs.mkdirpSync(repositoryPath); const git = makeUtils(repositoryPath); const commits = []; function commit(message) { @@ -112,7 +112,7 @@ export function createExampleSubmoduleRepo( intoDirectory: string ): RepositoryInfo { const repositoryPath = intoDirectory; - mkdirp(repositoryPath); + fs.mkdirpSync(repositoryPath); const git = makeUtils(repositoryPath); const commits = []; function commit(message) { diff --git a/src/plugins/git/gitUtils.js b/src/plugins/git/gitUtils.js index 969d5da..5a22e3f 100644 --- a/src/plugins/git/gitUtils.js +++ b/src/plugins/git/gitUtils.js @@ -1,8 +1,7 @@ // @flow import {execFileSync} from "child_process"; -import fs from "fs"; -import mkdirp from "mkdirp"; +import fs from "fs-extra"; import path from "path"; export interface Utils { @@ -62,7 +61,7 @@ export function makeUtils(repositoryPath: string): Utils { writeAndStage(filename: string, contents: string) { const filepath = path.join(repositoryPath, filename); const dirpath = path.join(repositoryPath, path.dirname(filename)); - mkdirp.sync(dirpath); + fs.mkdirpSync(dirpath); fs.writeFileSync(filepath, contents); git(["add", filename]); },