Skip to content

Commit

Permalink
build(xstask): remove deps fs_extra and filetime (#2562)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos authored Apr 22, 2024
1 parent d6f1f2b commit b150000
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 48 deletions.
20 changes: 0 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions xtask/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ version = "0.0.0"
[dependencies]
anyhow = "1.0.82"
bpaf = { workspace = true, features = ["derive"] }
filetime = "0.2.23"
fs_extra = "1.3.0"
git2 = { version = "0.18.3", default-features = false }
proc-macro2 = { workspace = true, features = ["span-locations"] }
pulldown-cmark = { version = "0.9", default-features = false, optional = true }
Expand Down
6 changes: 2 additions & 4 deletions xtask/codegen/src/parser_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{
collections::HashMap,
fs, mem,
path::{Path, PathBuf},
time::SystemTime,
};

use crate::{update, Mode};
Expand Down Expand Up @@ -94,10 +95,7 @@ pub fn generate_parser_tests(mode: Mode) -> Result<()> {
)?;

if some_file_was_updated {
let _ = filetime::set_file_mtime(
"crates/biome_js_parser/src/tests.rs",
filetime::FileTime::now(),
);
fs::File::open("crates/biome_js_parser/src/tests.rs")?.set_modified(SystemTime::now())?;
}

Ok(())
Expand Down
26 changes: 4 additions & 22 deletions xtask/codegen/src/promote_rule.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use biome_string_case::Case;
use fs_extra::dir::{create, move_dir, CopyOptions};
use fs_extra::file;
use fs_extra::file::move_file;
use std::env;
use std::fs;
use std::path::PathBuf;

const KNOWN_GROUPS: [&str; 7] = [
Expand Down Expand Up @@ -75,14 +73,9 @@ pub fn promote_rule(rule_name: &str, new_group: &str) {
categories.replace_range(lint_start_index..lint_end_index, &new_lint_rule_text);

if !new_group_path.exists() {
create(new_rule_path.clone(), false).expect("To create the group folder");
fs::create_dir(new_rule_path.clone()).expect("To create the group folder");
}
move_file(
rule_path.clone(),
new_rule_path.clone(),
&file::CopyOptions::default(),
)
.unwrap_or_else(|_| {
fs::rename(rule_path.clone(), new_rule_path.clone()).unwrap_or_else(|_| {
panic!(
"To copy {} to {}",
rule_path.display(),
Expand All @@ -98,18 +91,7 @@ pub fn promote_rule(rule_name: &str, new_group: &str) {
.join("crates/biome_js_analyze/tests/specs")
.join(new_group)
.join(rule_name);

std::fs::create_dir(new_test_path).unwrap();
move_dir(
old_test_path.display().to_string(),
current_dir
.join("crates/biome_js_analyze/tests/specs")
.join(new_group)
.display()
.to_string(),
&CopyOptions::new(),
)
.unwrap();
fs::rename(old_test_path, new_test_path).unwrap();
} else {
panic!("Couldn't find the rule {}", rule_name);
}
Expand Down

0 comments on commit b150000

Please sign in to comment.