diff --git a/lib/normalize.js b/lib/normalize.js index e604bf1..9594ef3 100644 --- a/lib/normalize.js +++ b/lib/normalize.js @@ -6,20 +6,6 @@ const path = require('path') const log = require('proc-log') const git = require('@npmcli/git') -// Replace with https://github.com/npm/git/pull/135 once it lands -const gitFind = async ({ cwd, root }) => { - if (await git.is({ cwd })) { - return cwd - } - while (cwd !== path.dirname(cwd) && cwd !== root) { - cwd = path.dirname(cwd) - if (await git.is({ cwd })) { - return cwd - } - } - return null -} - const normalize = async (pkg, { strict, steps, root }) => { const data = pkg.content const scripts = data.scripts || {} @@ -193,7 +179,7 @@ const normalize = async (pkg, { strict, steps, root }) => { // populate "gitHead" attribute if (steps.includes('gitHead') && !data.gitHead) { - const gitRoot = await gitFind({ cwd: pkg.path, root }) + const gitRoot = await git.find({ cwd: pkg.path, root }) let head if (gitRoot) { try { diff --git a/package.json b/package.json index d29a2e4..ada3be0 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "tap": "^16.0.1" }, "dependencies": { - "@npmcli/git": "^4.0.4", + "@npmcli/git": "^4.1.0", "glob": "^10.2.2", "json-parse-even-better-errors": "^3.0.0", "normalize-package-data": "^5.0.0",