Skip to content

Commit f50898d

Browse files
committed
tidy: in ci, use npm ci.
1 parent 9737648 commit f50898d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::ffi::OsStr;
55
use std::path::{Path, PathBuf};
66
use std::process::Command;
77

8+
use build_helper::ci::CiEnv;
89
use ignore::DirEntry;
910

1011
use crate::walk::walk_no_read;
@@ -14,15 +15,21 @@ pub(super) fn npm_install() -> Result<(), super::Error> {
1415
// disable a bunch of things we don't want.
1516
// this makes tidy output less noisy, and also significantly improves runtime
1617
// of repeated tidy invokations.
17-
let mut child = Command::new("npm")
18-
.args(&["install", "--audit=false", "--save=false", "--fund=false"])
19-
.spawn()?;
18+
let mut cmd = Command::new("npm");
19+
if CiEnv::is_ci() {
20+
// `npm ci` redownloads every time and thus is too slow for local development.
21+
cmd.arg("ci");
22+
} else {
23+
cmd.arg("install");
24+
}
25+
cmd.args(&["--audit=false", "--save=false", "--fund=false"]);
26+
let mut child = cmd.spawn()?;
2027
match child.wait() {
2128
Ok(exit_status) => {
2229
if exit_status.success() {
2330
return Ok(());
2431
}
25-
Err(super::Error::FailedCheck("npm install failed"))
32+
Err(super::Error::FailedCheck("npm install"))
2633
}
2734
Err(error) => Err(super::Error::Generic(format!("npm install failed: {error:?}"))),
2835
}

0 commit comments

Comments
 (0)