diff --git a/Condition.html b/Condition.html
index 96830d1..49e27ea 100644
--- a/Condition.html
+++ b/Condition.html
@@ -415,7 +415,7 @@
processSyn
diff --git a/Configuration.html b/Configuration.html
index 2989f79..fe616e7 100644
--- a/Configuration.html
+++ b/Configuration.html
@@ -165,7 +165,7 @@ new Conf
diff --git a/GotoScope.html b/GotoScope.html
index 7d4bf03..9b0c5f7 100644
--- a/GotoScope.html
+++ b/GotoScope.html
@@ -371,7 +371,7 @@ processSyn
diff --git a/Helper.html b/Helper.html
index 794b8a7..8219c86 100644
--- a/Helper.html
+++ b/Helper.html
@@ -723,7 +723,7 @@ Parameters:
diff --git a/IfAllCondition.html b/IfAllCondition.html
index cd69242..d1e9fc3 100644
--- a/IfAllCondition.html
+++ b/IfAllCondition.html
@@ -351,7 +351,7 @@ processSyn
diff --git a/IfExistCondition.html b/IfExistCondition.html
index 18d2069..40fe8ed 100644
--- a/IfExistCondition.html
+++ b/IfExistCondition.html
@@ -351,7 +351,7 @@ processSyn
diff --git a/IfOnlyExistCondition.html b/IfOnlyExistCondition.html
index ea0c81a..428ba77 100644
--- a/IfOnlyExistCondition.html
+++ b/IfOnlyExistCondition.html
@@ -351,7 +351,7 @@ processSyn
diff --git a/Instance.html b/Instance.html
index d265ee8..00fc80b 100644
--- a/Instance.html
+++ b/Instance.html
@@ -8394,7 +8394,7 @@ Returns:
diff --git a/NodeVersion.html b/NodeVersion.html
index a5fbd25..6daad34 100644
--- a/NodeVersion.html
+++ b/NodeVersion.html
@@ -256,7 +256,7 @@ (async) matchSource:
@@ -441,7 +441,7 @@ Returns:
diff --git a/NpmVersion.html b/NpmVersion.html
index 81e9d4e..e3cb181 100644
--- a/NpmVersion.html
+++ b/NpmVersion.html
@@ -469,7 +469,7 @@ Returns:
diff --git a/Rewriter.html b/Rewriter.html
index c76c304..f318c22 100644
--- a/Rewriter.html
+++ b/Rewriter.html
@@ -4131,7 +4131,7 @@ Example
diff --git a/Scope.html b/Scope.html
index 4d76568..4c44cef 100644
--- a/Scope.html
+++ b/Scope.html
@@ -222,7 +222,7 @@ Parameters:
diff --git a/UnlessExistCondition.html b/UnlessExistCondition.html
index ba8ec03..0c6f100 100644
--- a/UnlessExistCondition.html
+++ b/UnlessExistCondition.html
@@ -351,7 +351,7 @@ processSyn
diff --git a/WithinScope.html b/WithinScope.html
index 2d80ab4..9802a04 100644
--- a/WithinScope.html
+++ b/WithinScope.html
@@ -402,7 +402,7 @@ processSyn
diff --git a/condition.js.html b/condition.js.html
index 469f9aa..72faa12 100644
--- a/condition.js.html
+++ b/condition.js.html
@@ -220,7 +220,7 @@ condition.js
diff --git a/configuration.js.html b/configuration.js.html
index 2bb1ca8..89ce437 100644
--- a/configuration.js.html
+++ b/configuration.js.html
@@ -69,7 +69,7 @@ configuration.js
diff --git a/engines_html.js.html b/engines_html.js.html
index 7121102..4afbec1 100644
--- a/engines_html.js.html
+++ b/engines_html.js.html
@@ -67,7 +67,7 @@ engines/html.js
diff --git a/engines_rails_erb.js.html b/engines_rails_erb.js.html
index f4c2273..9b392b6 100644
--- a/engines_rails_erb.js.html
+++ b/engines_rails_erb.js.html
@@ -67,7 +67,7 @@ engines/rails_erb.js
diff --git a/global.html b/global.html
index 4119697..398326d 100644
--- a/global.html
+++ b/global.html
@@ -2355,7 +2355,7 @@ <
diff --git a/helper.js.html b/helper.js.html
index 7e50663..12f1c9d 100644
--- a/helper.js.html
+++ b/helper.js.html
@@ -100,7 +100,7 @@ helper.js
diff --git a/index.html b/index.html
index 0aa75df..53352ff 100644
--- a/index.html
+++ b/index.html
@@ -168,7 +168,7 @@
diff --git a/instance.js.html b/instance.js.html
index bdf4cae..bfaafaa 100644
--- a/instance.js.html
+++ b/instance.js.html
@@ -891,7 +891,7 @@ instance.js
diff --git a/node-version.js.html b/node-version.js.html
index 8d860e1..c54b3d6 100644
--- a/node-version.js.html
+++ b/node-version.js.html
@@ -100,17 +100,23 @@ node-version.js
if (!configuration_1.default.strict) {
return true;
}
- let versionFile;
+ let version;
if ((0, utils_1.isValidFileSync)(path_1.default.join(configuration_1.default.rootPath, ".node-version"))) {
- versionFile = ".node-version";
+ version = fs_1.default.readFileSync(path_1.default.join(configuration_1.default.rootPath, ".node-version"), "utf-8");
}
else if ((0, utils_1.isValidFileSync)(path_1.default.join(configuration_1.default.rootPath, ".nvmrc"))) {
- versionFile = ".nvmrc";
+ version = fs_1.default.readFileSync(path_1.default.join(configuration_1.default.rootPath, ".nvmrc"), "utf-8");
}
- if (!versionFile) {
+ else if ((0, utils_1.isValidFileSync)(path_1.default.join(configuration_1.default.rootPath, "package.json"))) {
+ const packageFileContent = fs_1.default.readFileSync(path_1.default.join(configuration_1.default.rootPath, "package.json"), "utf-8");
+ const packageJson = JSON.parse(packageFileContent);
+ if (packageJson.engines && packageJson.engines.node) {
+ version = packageJson.engines.node.replace(/[^0-9.]/g, '');
+ }
+ }
+ if (!version) {
return true;
}
- const version = fs_1.default.readFileSync(path_1.default.join(configuration_1.default.rootPath, versionFile), "utf-8");
return compare_versions_1.default.compare(version, this.version, ">=");
}
/**
@@ -123,17 +129,23 @@ node-version.js
if (!configuration_1.default.strict) {
return true;
}
- let versionFile;
+ let version;
if (yield (0, utils_1.isValidFile)(path_1.default.join(configuration_1.default.rootPath, ".node-version"))) {
- versionFile = ".node-version";
+ version = yield fs_1.promises.readFile(path_1.default.join(configuration_1.default.rootPath, ".node-version"), "utf-8");
}
else if (yield (0, utils_1.isValidFile)(path_1.default.join(configuration_1.default.rootPath, ".nvmrc"))) {
- versionFile = ".nvmrc";
+ version = yield fs_1.promises.readFile(path_1.default.join(configuration_1.default.rootPath, ".nvmrc"), "utf-8");
+ }
+ else if (yield (0, utils_1.isValidFile)(path_1.default.join(configuration_1.default.rootPath, "package.json"))) {
+ const packageFileContent = yield fs_1.promises.readFile(path_1.default.join(configuration_1.default.rootPath, "package.json"), "utf-8");
+ const packageJson = JSON.parse(packageFileContent);
+ if (packageJson.engines && packageJson.engines.node) {
+ version = packageJson.engines.node.replace(/[^0-9.]/g, '');
+ }
}
- if (!versionFile) {
+ if (!version) {
return true;
}
- const version = yield fs_1.promises.readFile(path_1.default.join(configuration_1.default.rootPath, versionFile), "utf-8");
return compare_versions_1.default.compare(version, this.version, ">=");
});
}
@@ -151,7 +163,7 @@ node-version.js
diff --git a/npm-version.js.html b/npm-version.js.html
index 89a89a3..06c3534 100644
--- a/npm-version.js.html
+++ b/npm-version.js.html
@@ -302,7 +302,7 @@ npm-version.js
diff --git a/rewriter.js.html b/rewriter.js.html
index f7e1725..547db41 100644
--- a/rewriter.js.html
+++ b/rewriter.js.html
@@ -631,7 +631,7 @@ rewriter.js
diff --git a/scope.js.html b/scope.js.html
index 6f25c0a..b23a445 100644
--- a/scope.js.html
+++ b/scope.js.html
@@ -195,7 +195,7 @@ scope.js
diff --git a/utils.js.html b/utils.js.html
index 564e93d..1500f81 100644
--- a/utils.js.html
+++ b/utils.js.html
@@ -485,7 +485,7 @@ utils.js