Skip to content

Commit 2652a6a

Browse files
feat(init): no install flag
1 parent 1c50b12 commit 2652a6a

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

src/command/init.rs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub fn create_pkg_dir(path: &str, step: &Step) -> result::Result<(), Error> {
2626
pub enum InitMode {
2727
Normal,
2828
Nobuild,
29+
Noinstall,
2930
}
3031

3132
pub struct Init {
@@ -78,9 +79,17 @@ impl Init {
7879
step_create_json,
7980
step_copy_readme,
8081
step_install_wasm_bindgen,
81-
step_running_wasm_bindgen,
82+
step_run_wasm_bindgen,
8283
],
8384
InitMode::Nobuild => steps![step_create_dir, step_create_json, step_copy_readme,],
85+
InitMode::Noinstall => steps![
86+
step_check_crate_config,
87+
step_build_wasm,
88+
step_create_dir,
89+
step_create_json,
90+
step_copy_readme,
91+
step_run_wasm_bindgen
92+
],
8493
}
8594
}
8695

@@ -211,7 +220,7 @@ impl Init {
211220
Ok(())
212221
}
213222

214-
fn step_running_wasm_bindgen(
223+
fn step_run_wasm_bindgen(
215224
&mut self,
216225
step: &Step,
217226
log: &Logger,
@@ -259,7 +268,7 @@ mod test {
259268
"step_create_json",
260269
"step_copy_readme",
261270
"step_install_wasm_bindgen",
262-
"step_running_wasm_bindgen"
271+
"step_run_wasm_bindgen"
263272
]
264273
);
265274
}
@@ -275,4 +284,23 @@ mod test {
275284
["step_create_dir", "step_create_json", "step_copy_readme"]
276285
);
277286
}
287+
288+
#[test]
289+
fn init_skip_install() {
290+
let steps: Vec<&str> = Init::get_process_steps(InitMode::Noinstall)
291+
.into_iter()
292+
.map(|(n, _)| n)
293+
.collect();
294+
assert_eq!(
295+
steps,
296+
[
297+
"step_check_crate_config",
298+
"step_build_wasm",
299+
"step_create_dir",
300+
"step_create_json",
301+
"step_copy_readme",
302+
"step_run_wasm_bindgen"
303+
]
304+
);
305+
}
278306
}

0 commit comments

Comments
 (0)