idt/installers/
graphql_lsp.rs1use std::path::Path;
2
3use crate::Installer;
4
5pub struct GraphQlLsp<'a> {
6 pub dev_tools_dir: &'a Path,
7 pub bin_dir: &'a Path,
8}
9
10impl Installer for GraphQlLsp<'_> {
11 fn bin_name(&self) -> &'static str {
12 "graphql-lsp"
13 }
14
15 fn install(&self) -> color_eyre::Result<()> {
16 let target_dir = crate::downloaders::npm::run(
17 self.dev_tools_dir,
18 "graphql-language-service-cli",
19 &["graphql-language-service-cli"],
20 )?;
21
22 let target = target_dir.join(self.bin_name());
23 ytil_sys::file::ln_sf(&target, &self.bin_dir.join(self.bin_name()))?;
24 ytil_sys::file::chmod_x(target)?;
25
26 Ok(())
27 }
28}