mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-30 05:01:33 +00:00
Generate TypeScript by default instead of JS
This is what's needed in the immediate future anyway, so let's do that!
This commit is contained in:
@ -16,14 +16,14 @@ Usage:
|
||||
|
||||
Options:
|
||||
-h --help Show this screen.
|
||||
--output-js FILE Output JS file
|
||||
--output-ts FILE Output TypeScript file
|
||||
--output-wasm FILE Output WASM file
|
||||
--nodejs Generate output for node.js, not the browser
|
||||
";
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Args {
|
||||
flag_output_js: Option<PathBuf>,
|
||||
flag_output_ts: Option<PathBuf>,
|
||||
flag_output_wasm: Option<PathBuf>,
|
||||
flag_nodejs: bool,
|
||||
arg_input: PathBuf,
|
||||
@ -38,10 +38,10 @@ fn main() {
|
||||
b.input_path(&args.arg_input);
|
||||
b.nodejs(args.flag_nodejs);
|
||||
let ret = b.generate().expect("failed to generate bindings");
|
||||
if let Some(ref js) = args.flag_output_js {
|
||||
ret.write_js_to(js).expect("failed to write JS output file");
|
||||
if let Some(ref ts) = args.flag_output_ts {
|
||||
ret.write_ts_to(ts).expect("failed to write TypeScript output file");
|
||||
} else {
|
||||
println!("{}", ret.generate_js());
|
||||
println!("{}", ret.generate_ts());
|
||||
}
|
||||
if let Some(ref wasm) = args.flag_output_wasm {
|
||||
ret.write_wasm_to(wasm).expect("failed to write wasm output file");
|
||||
|
Reference in New Issue
Block a user