From 24b36f644ab6c733cd57786a6d9e53f7f0955dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Leuth=C3=A4user?= <1417198+max-leuthaeuser@users.noreply.github.com> Date: Fri, 11 Nov 2022 12:48:10 +0100 Subject: [PATCH] Removed npm config for Python2.7 (#229) Python 2 came to EOF and is no longer supported by npm. This is for: https://github.com/ShiftLeftSecurity/product/issues/11238 --- .../preprocessing/TranspilingEnvironment.scala | 15 ++------------- .../js2cpg/preprocessing/VueTranspiler.scala | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/main/scala/io/shiftleft/js2cpg/preprocessing/TranspilingEnvironment.scala b/src/main/scala/io/shiftleft/js2cpg/preprocessing/TranspilingEnvironment.scala index 27cdd45e4..b31af775d 100644 --- a/src/main/scala/io/shiftleft/js2cpg/preprocessing/TranspilingEnvironment.scala +++ b/src/main/scala/io/shiftleft/js2cpg/preprocessing/TranspilingEnvironment.scala @@ -33,6 +33,7 @@ object TranspilingEnvironment { s"$PNPM --ignore-scripts install" val NPM_INSTALL: String = s"$NPM --no-audit --progress=false --ignore-scripts --legacy-peer-deps --save-dev install" + } trait TranspilingEnvironment { @@ -107,18 +108,6 @@ trait TranspilingEnvironment { } } - private def setNpmPython(): Boolean = { - logger.debug("\t+ Setting npm config ...") - ExternalCommand.run(s"${TranspilingEnvironment.NPM} config set python python2.7", projectPath.toString) match { - case Success(_) => - logger.debug("\t+ Set successfully") - true - case Failure(exception) => - logger.debug("\t- Failed setting npm config", exception) - false - } - } - protected def nodeVersion(): Option[String] = { logger.debug(s"\t+ Checking node ...") ExternalCommand.run("node -v", projectPath.toString) match { @@ -136,7 +125,7 @@ trait TranspilingEnvironment { value case None => nodeVersion() - isValid = Some((pnpmAvailable(dir) || yarnAvailable() || npmAvailable()) && setNpmPython()) + isValid = Some(pnpmAvailable(dir) || yarnAvailable() || npmAvailable()) isValid.get } diff --git a/src/main/scala/io/shiftleft/js2cpg/preprocessing/VueTranspiler.scala b/src/main/scala/io/shiftleft/js2cpg/preprocessing/VueTranspiler.scala index efe0c01fa..75e8218e8 100644 --- a/src/main/scala/io/shiftleft/js2cpg/preprocessing/VueTranspiler.scala +++ b/src/main/scala/io/shiftleft/js2cpg/preprocessing/VueTranspiler.scala @@ -40,7 +40,7 @@ class VueTranspiler(override val config: Config, override val projectPath: Path) private def nodeOptions(): Map[String, String] = { // TODO: keep this until https://github.com/webpack/webpack/issues/14532 is fixed - if (nodeVersion().exists(_.startsWith("v17"))) { + if (nodeVersion().exists(v => v.startsWith("v17") || v.startsWith("v18") || v.startsWith("v19"))) { Map("NODE_OPTIONS" -> "--openssl-legacy-provider") } else { Map.empty