MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / should_run_npm_ci

Function should_run_npm_ci

vmm/build.rs:118–129  ·  view source on GitHub ↗
(ui_dir: &Path)

Source from the content-addressed store, hash-verified

116}
117
118fn should_run_npm_ci(ui_dir: &Path) -> Result<bool, Box<dyn std::error::Error>> {
119 let package_json = ui_dir.join("package.json");
120 let package_lock = ui_dir.join("package-lock.json");
121 let marker = ui_dir.join("node_modules/.package-lock.json");
122
123 if !marker.exists() {
124 return Ok(true);
125 }
126
127 let marker_time = modified_time(&marker)?;
128 Ok(modified_time(&package_json)? > marker_time || modified_time(&package_lock)? > marker_time)
129}
130
131fn modified_time(path: &Path) -> Result<SystemTime, Box<dyn std::error::Error>> {
132 Ok(fs::metadata(path)?.modified()?)

Callers 1

build_consoleFunction · 0.85

Calls 1

modified_timeFunction · 0.85

Tested by

no test coverage detected