0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

feat(bundle): add --config flag (#5130)

This commit is contained in:
Bartek Iwańczuk 2020-05-07 17:02:03 +02:00 committed by GitHub
parent 0ba90c8c11
commit 53265fb6db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -367,6 +367,7 @@ fn install_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
fn bundle_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
ca_file_arg_parse(flags, matches);
config_arg_parse(flags, matches);
importmap_arg_parse(flags, matches);
unstable_arg_parse(flags, matches);
@ -698,6 +699,7 @@ fn bundle_subcommand<'a, 'b>() -> App<'a, 'b> {
.arg(ca_file_arg())
.arg(importmap_arg())
.arg(unstable_arg())
.arg(config_arg())
.about("Bundle module and dependencies into single file")
.long_about(
"Output a single JavaScript file with all dependencies.
@ -1925,6 +1927,30 @@ mod tests {
);
}
#[test]
fn bundle_with_config() {
let r = flags_from_vec_safe(svec![
"deno",
"bundle",
"--config",
"tsconfig.json",
"source.ts",
"bundle.js"
]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Bundle {
source_file: "source.ts".to_string(),
out_file: Some(PathBuf::from("bundle.js")),
},
allow_write: true,
config_path: Some("tsconfig.json".to_owned()),
..Flags::default()
}
);
}
#[test]
fn bundle_with_output() {
let r =