mk_lib/schema/
use_npm.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct UseNpmArgs {
  /// The package manager to use
  #[serde(default)]
  pub package_manager: String,

  /// The working directory to run the command in
  #[serde(default)]
  pub work_dir: Option<String>,
}

#[derive(Debug, Deserialize)]
#[serde(untagged)]
pub enum UseNpm {
  Bool(bool),
  UseNpm(Box<UseNpmArgs>),
}

impl UseNpm {
  pub fn capture(&self) -> anyhow::Result<()> {
    match self {
      UseNpm::Bool(true) => self.capture_tasks(),
      UseNpm::UseNpm(args) => args.capture_tasks(),
      _ => Ok(()),
    }
  }

  fn capture_tasks(&self) -> anyhow::Result<()> {
    unimplemented!()
  }
}

impl UseNpmArgs {
  pub fn capture_tasks(&self) -> anyhow::Result<()> {
    unimplemented!()
  }
}