Skip to content

Commit b9b1764

Browse files
authored
Merge pull request #288 from whi-tw/use_node-version_version
Use version specified in `.node-version` if exists
2 parents 40bfea7 + f01c7d6 commit b9b1764

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nodeenv.py

100755100644
+5
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def _load(cls, configfiles, verbose=False):
106106
"""
107107
Load configuration from the given files in reverse order,
108108
if they exist and have a [nodeenv] section.
109+
Additionally, load version from .node-version if file exists.
109110
"""
110111
for configfile in reversed(configfiles):
111112
configfile = os.path.expanduser(configfile)
@@ -133,6 +134,10 @@ def _load(cls, configfiles, verbose=False):
133134
os.path.basename(configfile), attr, val))
134135
setattr(cls, attr, val)
135136

137+
if os.path.exists(".node-version"):
138+
with open(".node-version", "r") as v_file:
139+
setattr(cls, "node", v_file.readlines(1)[0].strip())
140+
136141
@classmethod
137142
def _dump(cls):
138143
"""

0 commit comments

Comments
 (0)