Skip to content

Commit

Permalink
Removed npm config for Python2.7 (#229)
Browse files Browse the repository at this point in the history
Python 2 came to EOF and is no longer supported by npm.

This is for: ShiftLeftSecurity/product#11238
  • Loading branch information
max-leuthaeuser authored Nov 11, 2022
1 parent 61aafea commit 24b36f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 24b36f6

Please sign in to comment.