@npmcli/git
Advanced tools
Comparing version 4.0.4 to 4.1.0
const is = require('./is.js') | ||
const { dirname } = require('path') | ||
module.exports = async ({ cwd = process.cwd() } = {}) => { | ||
if (await is({ cwd })) { | ||
return cwd | ||
} | ||
while (cwd !== dirname(cwd)) { | ||
cwd = dirname(cwd) | ||
module.exports = async ({ cwd = process.cwd(), root } = {}) => { | ||
while (true) { | ||
if (await is({ cwd })) { | ||
return cwd | ||
} | ||
const next = dirname(cwd) | ||
if (cwd === root || cwd === next) { | ||
return null | ||
} | ||
cwd = next | ||
} | ||
return null | ||
} |
{ | ||
"name": "@npmcli/git", | ||
"version": "4.0.4", | ||
"version": "4.1.0", | ||
"main": "lib/index.js", | ||
@@ -26,4 +26,3 @@ "files": [ | ||
"tap": { | ||
"check-coverage": true, | ||
"coverage-map": "map.js", | ||
"timeout": 600, | ||
"nyc-arg": [ | ||
@@ -36,3 +35,3 @@ "--exclude", | ||
"@npmcli/eslint-config": "^4.0.0", | ||
"@npmcli/template-oss": "4.12.0", | ||
"@npmcli/template-oss": "4.15.1", | ||
"npm-package-arg": "^10.0.0", | ||
@@ -57,5 +56,5 @@ "slash": "^3.0.0", | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"windowsCI": false, | ||
"version": "4.12.0" | ||
"version": "4.15.1", | ||
"publish": true | ||
} | ||
} |
@@ -127,3 +127,4 @@ # @npmcli/git | ||
probably best to only call it if you're reasonably sure you're likely to be | ||
in a git project somewhere. | ||
in a git project somewhere. Pass in `opts.root` to stop checking at that | ||
directory. | ||
@@ -130,0 +131,0 @@ Resolves to `null` if not in a git project. |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
21817
159
1