Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Create a tailcall-prettier #1730

Closed
tusharmath opened this issue Apr 15, 2024 · 5 comments · Fixed by #1731
Closed

chore: Create a tailcall-prettier #1730

tusharmath opened this issue Apr 15, 2024 · 5 comments · Fixed by #1731

Comments

@tusharmath
Copy link
Contributor

We use prettier to format all our GraphQL, md, JSON & YAML files. Prettier is a purely Node.JS-based implementation that's opinionated about how text is formatted.

Requirements

  • Create a new workspace called tailcall-prettier

  • Tailcall prettier provides a Rust based programmable API that takes in content and formats it using Prettier.

  • Read files in rust and pipe them to Prettier. For eg:

    use std::process::{Command, Stdio};
    use std::io::Write;
    
    fn format_with_prettier(code: &str) -> Result<String, std::io::Error> {
        let mut child = Command::new("node")
            .arg("path_to_prettier_script.js")
            .stdin(Stdio::piped())
            .stdout(Stdio::piped())
            .spawn()?;
    
        if let Some(ref mut stdin) = child.stdin {
            stdin.write_all(code.as_bytes())?;
        }
    
        let output = child.wait_with_output()?;
        if output.status.success() {
            Ok(String::from_utf8_lossy(&output.stdout).to_string())
        } else {
            Err(std::io::Error::new(std::io::ErrorKind::Other, "Prettier formatting failed"))
        }
    }
  • Ensure the local version of prettier is used.

  • Execution should be fast and multithreaded if required.

@tusharmath
Copy link
Contributor Author

/bounty 100$

Copy link

algora-pbc bot commented Apr 15, 2024

💎 $100 bounty created by tailcallhq
🙋 If you start working on this, comment /attempt #1730 along with your implementation plan
👉 To claim this bounty, submit a pull request that includes the text /claim #1730 somewhere in its body

🙏 Thank you for contributing to tailcallhq/tailcall!.
🧐 Checkout our guidelines before you get started.

Attempt Started (GMT+0) Solution
🟢 @ssddOnTop Apr 15, 2024, 8:39:45 AM #1731

@ssddOnTop
Copy link
Member

ssddOnTop commented Apr 15, 2024

/attempt

Algora profile Completed bounties Tech Active attempts Options
@ssddOnTop 37 tailcallhq bounties
Rust, Java,
C & more
Cancel attempt

Copy link

algora-pbc bot commented Apr 15, 2024

💡 @ssddOnTop submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Apr 16, 2024

🎉🎈 @ssddOnTop has been awarded $100! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants