Projects STRLCPY dum Commits 8f6335e6
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    CHANGELOG.md
     1 +## v0.1.17
     2 + 
     3 +- fixed a regression where `dum <bin>` stopped working
     4 + 
    1 5  ## v0.1.16
    2 6   
    3 7  - Resolve `-c <dir>` to absolute path, previously it always searches package.json from current directory even if `-c` contains `../`.
    skipped 52 lines
  • ■ ■ ■ ■
    Cargo.lock
    skipped 93 lines
    94 94   
    95 95  [[package]]
    96 96  name = "dum"
    97  -version = "0.1.16"
     97 +version = "0.1.17"
    98 98  dependencies = [
    99 99   "ansi_term",
    100 100   "ctrlc",
    skipped 317 lines
  • ■ ■ ■ ■
    Cargo.toml
    1 1  [package]
    2 2  name = "dum"
    3  -version = "0.1.16"
     3 +version = "0.1.17"
    4 4  edition = "2021"
    5 5  license = "MIT"
    6 6  description = "An npm scripts runner"
    skipped 13 lines
  • ■ ■ ■ ■ ■ ■
    src/run.rs
    skipped 128 lines
    129 129   let v: Value = serde_json::from_str(&contents).expect("failed to parse package.json");
    130 130   
    131 131   let scripts = v["scripts"].as_object();
    132  - if scripts.is_none() {
    133  - println!("No scripts found.");
    134  - return;
    135  - }
    136  - 
    137 132   let mut script_name = app_args.script_name.clone();
    138 133   let mut forwarded = app_args.forwarded.clone();
    139 134   
    skipped 18 lines
    158 153   return;
    159 154   }
    160 155   
     156 + if scripts.is_none() {
     157 + eprintln!("No scripts found in package.json");
     158 + exit(1);
     159 + }
     160 + 
    161 161   // Choose an script interactively
    162 162   // Convert keys of scripts to a vector of &str
    163 163   let names_vec = scripts
    skipped 21 lines
    185 185   }
    186 186   
    187 187   let npm_script = scripts
    188  - .unwrap()
    189  - .get(script_name.as_str())
     188 + .and_then(|s| s.get(script_name.as_str()))
    190 189   .and_then(|script| {
    191 190   let script = script.as_str().map(|script| script.to_string());
    192 191   Some(script.unwrap_or_default())
    193 192   });
    194  - 
    195 193   if npm_script.is_some() {
    196 194   let script = npm_script.unwrap();
    197 195   println!(
    skipped 17 lines
    215 213   );
    216 214   return;
    217 215   }
    218  - 
    219 216   let resolved_bin = resolve_bin_path(script_name.as_str(), &bin_dirs);
    220 217   if resolved_bin.is_some() {
    221 218   let bin_path = resolved_bin.unwrap();
    skipped 19 lines
Please wait...
Page is in error, reload to recover