MCPcopy Create free account
hub / github.com/LyonSyonII/dioxus-tailwindcss / install_packages

Function install_packages

build.rs:30–43  ·  view source on GitHub ↗

Installs required packages and selects toolchain to use. It will prioritize `yarn` over `npm`. # Panic Will panic if none of the toolchains is installed.

()

Source from the content-addressed store, hash-verified

28/// # Panic
29/// Will panic if none of the toolchains is installed.
30fn install_packages() -> &'static str {
31 let yarn = if_windows("yarn.cmd", "yarn");
32 let npm = if_windows("npm.cmd", "npm");
33 let npx = if_windows("npx.cmd", "npx");
34
35 if std::process::Command::new(yarn).arg("install").spawn().is_ok() {
36 return yarn
37 }
38
39 match std::process::Command::new(npm).arg("install").spawn() {
40 Ok(_) => npx,
41 Err(e) => panic!("ERROR: Npm or Yarn installation is needed.\n{e}"),
42 }
43}
44
45const fn if_windows(windows: &'static str, unix: &'static str) -> &'static str {
46 #[cfg(windows)]

Callers 1

mainFunction · 0.85

Calls 1

if_windowsFunction · 0.85

Tested by

no test coverage detected