Skip to content

Commit

Permalink
chore: update prettier config reading logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed May 22, 2024
1 parent 715266f commit ac841c2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tailcall-prettier/src/prettier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use super::Parser;

pub struct Prettier {
runtime: tokio::runtime::Runtime,
config_path: String,
config_path: Option<String>,
}

impl Prettier {
Expand All @@ -20,9 +20,8 @@ impl Prettier {
.unwrap();

let config_path = fs::canonicalize(Path::new("./.prettierrc"))
.unwrap()
.display()
.to_string();
.map(|a| a.display().to_string())
.ok();
Self { runtime, config_path }
}

Expand All @@ -34,12 +33,13 @@ impl Prettier {
let mut command = command();
let mut child = command
.arg("--stdin-filepath")
.arg(format!("file.{}", parser))
.arg("--config")
.arg(config)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn()?;
.arg(format!("file.{}", parser));

if let Some(config) = config {
child = child.arg("--config").arg(config);
}

let mut child = child.stdin(Stdio::piped()).stdout(Stdio::piped()).spawn()?;

if let Some(ref mut stdin) = child.stdin {
stdin.write_all(source.as_bytes())?;
Expand Down

1 comment on commit ac841c2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running 30s test @ http://localhost:8000/graphql

4 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev
Latency 6.66ms 3.00ms 80.25ms 71.94%
Req/Sec 3.80k 200.10 4.15k 90.33%

453201 requests in 30.00s, 2.27GB read

Requests/sec: 15104.37

Transfer/sec: 77.53MB

Please sign in to comment.