Skip to content

Commit c029b6a

Browse files
committed
Report correct source when version is being set by nodenv-nvmrc
1 parent 24baacd commit c029b6a

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
target_dir="$1"
2+
find_nvmrc_file() {
3+
local root="$1"
4+
while ! [[ "$root" =~ ^//[^/]*$ ]]; do
5+
if [ -e "${root}/.nvmrc" ]; then
6+
NODENV_VERSION_ORIGIN="${root}/.nvmrc"
7+
return 0
8+
fi
9+
[ -n "$root" ] || break
10+
root="${root%/*}"
11+
done
12+
return 1
13+
}
14+
15+
if ! NODENV_NVMRC_VERSION=$(nodenv-nvmrc); then
16+
exit 1
17+
elif [ -n "$NODENV_NVMRC_VERSION" ]; then
18+
find_nvmrc_file "$NODENV_DIR"
19+
fi

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nodenv-nvmrc",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"private": true,
55
"description": "Activate a nodenv node version from .nvmrc",
66
"homepage": "https://github.com/ouchxp/nodenv-nvmrc#readme",

0 commit comments

Comments
 (0)