From 48bb97e53a2bb459809e9fc4d6bab8e1500dda58 Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 8 Jun 2024 16:31:21 +0800 Subject: [PATCH] fix(traverse): do not publish the build script --- crates/oxc_traverse/Cargo.toml | 1 + crates/oxc_traverse/build.rs | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/crates/oxc_traverse/Cargo.toml b/crates/oxc_traverse/Cargo.toml index bc5c11955..c77688a88 100644 --- a/crates/oxc_traverse/Cargo.toml +++ b/crates/oxc_traverse/Cargo.toml @@ -11,6 +11,7 @@ license.workspace = true repository.workspace = true rust-version.workspace = true categories.workspace = true +include = ["/src"] [lints] workspace = true diff --git a/crates/oxc_traverse/build.rs b/crates/oxc_traverse/build.rs index dd2a6bffe..54dc6e36c 100644 --- a/crates/oxc_traverse/build.rs +++ b/crates/oxc_traverse/build.rs @@ -1,20 +1,17 @@ -use std::{env, process::Command}; - fn main() { + // Exit if on CI. + // The built files should be checked into git, so want to run tests etc on what's actually in repo, + // rather than regenerating them. + if std::option_env!("CI") == Some("true") { + return; + } + // Re-run if NodeJS build script or AST types change println!("cargo:rerun-if-changed=scripts"); println!("cargo:rerun-if-changed=../oxc_ast/src/ast"); - // Exit if on CI. - // The built files should be checked into git, so want to run tests etc on what's actually in repo, - // rather than regenerating them. - match env::var("CI") { - Ok(value) if value == "true" => return, - _ => {} - } - // Run NodeJS build script - let status = Command::new("node") + let status = std::process::Command::new("node") .arg("./scripts/build.mjs") .status() .expect("Failed to run NodeJS build script");