From 235ddcef19e9d6540a6584b30fbdde7bdbcc8ac5 Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Thu, 11 Mar 2021 17:36:28 +0100
Subject: [PATCH] [build] xtask: not use nvm

---
 rust-bins/xtask/src/main.rs | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/rust-bins/xtask/src/main.rs b/rust-bins/xtask/src/main.rs
index b5dbfc219..ebbfabb6f 100644
--- a/rust-bins/xtask/src/main.rs
+++ b/rust-bins/xtask/src/main.rs
@@ -19,7 +19,6 @@ use structopt::StructOpt;
 
 const MIN_RUST_VERTION: &str = "1.50.0";
 const NODE_VERSION: &str = "10.22.1";
-const NVM_VERSION: &str = "0.35.3";
 
 #[derive(StructOpt)]
 struct DuniterXTask {
@@ -54,19 +53,17 @@ fn main() -> Result<()> {
     Command::new("cargo").arg("--version").status()?;
 
     if !args.skip_npm {
-        println!("Check nvm …");
-        if exec_should_success(Command::new("nvm").arg("--version")).is_err() {
-            println!("Duniter requires nvm, but nvm is not found, please install it or add it to your PATH. Nvm installation link: https://raw.githubusercontent.com/nvm-sh/nvm/v{}/install.sh", NVM_VERSION);
-            std::process::abort();
-        }
         println!("Check node version …");
         if exec_and_get_stdout(Command::new("node").arg("-v"))
             .unwrap_or_default()
             .trim_end()
             != format!("v{}", NODE_VERSION)
         {
-            println!("Install node v{} …", NODE_VERSION);
-            install_and_use_node_version()?;
+            eprintln!(
+                "Duniter requires node v{} exactly. Please install node v{} (you can use nvm).",
+                NODE_VERSION, NODE_VERSION
+            );
+            std::process::exit(1);
         } else {
             println!("Node v{} already installed ✔", NODE_VERSION);
         }
@@ -77,11 +74,6 @@ fn main() -> Result<()> {
     }
 }
 
-fn install_and_use_node_version() -> Result<()> {
-    exec_should_success(Command::new("nvm").args(&["install", NODE_VERSION]))?;
-    exec_should_success(Command::new("nvm").args(&["use", NODE_VERSION]))
-}
-
 fn exec_and_get_stdout(command: &mut Command) -> Result<String> {
     let Output {
         status,
-- 
GitLab