aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Tartière <romain@FreeBSD.org>2022-08-09 04:27:50 +0000
committerRomain Tartière <romain@FreeBSD.org>2022-08-09 04:40:28 +0000
commit01c33f63b62fe112782908ab9f926a36ec144f09 (patch)
treeb5c5b81e7b448d32d03fddf3c0b820055dd9bc55
parent30af7d897b8a518a4803e0ea28c1f4fdd9bec080 (diff)
downloadports-01c33f63b62fe112782908ab9f926a36ec144f09.tar.gz
ports-01c33f63b62fe112782908ab9f926a36ec144f09.zip
textproc/opensearch-dashboards: Fix startup after node14 update
PR: 265717 With hat: opensearch
-rw-r--r--textproc/opensearch-dashboards/Makefile1
-rw-r--r--textproc/opensearch-dashboards/files/patch-src_setup__node__env_node__version__validator.js21
2 files changed, 22 insertions, 0 deletions
diff --git a/textproc/opensearch-dashboards/Makefile b/textproc/opensearch-dashboards/Makefile
index 8e0365f4e303..2ff215926a43 100644
--- a/textproc/opensearch-dashboards/Makefile
+++ b/textproc/opensearch-dashboards/Makefile
@@ -1,6 +1,7 @@
PORTNAME= opensearch-dashboards
DISTVERSION= 2.1.0
DISTVERSIONSUFFIX= -linux-x64
+PORTREVISION= 1
CATEGORIES= textproc www
MASTER_SITES= https://artifacts.opensearch.org/releases/bundle/${PORTNAME}/${DISTVERSION}/
diff --git a/textproc/opensearch-dashboards/files/patch-src_setup__node__env_node__version__validator.js b/textproc/opensearch-dashboards/files/patch-src_setup__node__env_node__version__validator.js
new file mode 100644
index 000000000000..b78a0bf27cc9
--- /dev/null
+++ b/textproc/opensearch-dashboards/files/patch-src_setup__node__env_node__version__validator.js
@@ -0,0 +1,21 @@
+--- src/setup_node_env/node_version_validator.js.orig 2022-06-30 21:38:00 UTC
++++ src/setup_node_env/node_version_validator.js
+@@ -36,13 +36,13 @@ var pkg = require('../../package.json'); // Note: This
+ var currentVersion = process && process.version || null;
+ var rawRequiredVersion = pkg && pkg.engines && pkg.engines.node || null;
+ var requiredVersion = rawRequiredVersion ? 'v' + rawRequiredVersion : rawRequiredVersion;
+-var currentVersionMajorMinorPatch = currentVersion.match(/^v(\d+)\.(\d+)\.(\d+)/);
+-var requiredVersionMajorMinorPatch = requiredVersion.match(/^v(\d+)\.(\d+)\.(\d+)/);
+-var isVersionValid = currentVersionMajorMinorPatch[1] === requiredVersionMajorMinorPatch[1] && currentVersionMajorMinorPatch[2] === requiredVersionMajorMinorPatch[2] && parseInt(currentVersionMajorMinorPatch[3], 10) >= parseInt(requiredVersionMajorMinorPatch[3], 10); // Validates current the NodeJS version compatibility when OpenSearch Dashboards starts.
++var currentVersionMajorMinorPatch = currentVersion.match(/^v(\d+)\.(\d+)\.(\d+)/).map(x => parseInt(x, 10));
++var requiredVersionMajorMinorPatch = requiredVersion.match(/^v(\d+)\.(\d+)\.(\d+)/).map(x => parseInt(x, 10));
++var isVersionValid = currentVersionMajorMinorPatch[1] === requiredVersionMajorMinorPatch[1] && currentVersionMajorMinorPatch[2] > requiredVersionMajorMinorPatch[2] || currentVersionMajorMinorPatch[1] === requiredVersionMajorMinorPatch[1] && currentVersionMajorMinorPatch[2] === requiredVersionMajorMinorPatch[2] && currentVersionMajorMinorPatch[3] >= requiredVersionMajorMinorPatch[3]; // Validates current the NodeJS version compatibility when OpenSearch Dashboards starts.
+
+ if (!isVersionValid) {
+ var errorMessage = `OpenSearch Dashboards was built with ${requiredVersion} and does not support the current Node.js version ${currentVersion}. ` + `Please use Node.js ${requiredVersion} or a higher patch version.`; // Actions to apply when validation fails: error report + exit.
+
+ console.error(errorMessage);
+ process.exit(1);
+-}
+\ No newline at end of file
++}