R/available.R

Defines functions node_available

Documented in node_available

#' Are npm and node available?
#'
#' @return Warning if not available, nothing if available.
#' @export
#' @importFrom attempt warn_if
node_available <- function() {
  test <- suppressWarnings(
    system(
      "npm -v",
      ignore.stdout = TRUE,
      ignore.stderr = TRUE
    )
  )
  warn_if(
    test,
    ~ .x != 0,
    "Error launching npm"
  )
  test <- suppressWarnings(
    system(
      "node -v",
      ignore.stdout = TRUE,
      ignore.stderr = TRUE
    )
  )
  warn_if(
    test,
    ~ .x != 0,
    "Error launching Node"
  )
}
ColinFay/minifyr documentation built on June 29, 2023, 3:39 a.m.