@@ -121,6 +121,7 @@ pub struct AddFlags {
121121 pub default_registry : Option < DefaultRegistry > ,
122122 pub lockfile_only : bool ,
123123 pub save_exact : bool ,
124+ pub package_json : bool ,
124125}
125126
126127#[ derive( Clone , Debug , Default , Eq , PartialEq ) ]
@@ -145,6 +146,7 @@ pub struct AuditFlags {
145146pub struct RemoveFlags {
146147 pub packages : Vec < String > ,
147148 pub lockfile_only : bool ,
149+ pub package_json : bool ,
148150}
149151
150152#[ derive( Clone , Debug , Eq , PartialEq ) ]
@@ -2350,6 +2352,7 @@ Or multiple dependencies at once:
23502352 . help ( "Save exact version without the caret (^)" )
23512353 . action ( ArgAction :: SetTrue ) ,
23522354 )
2355+ . arg ( package_json_arg ( ) )
23532356 } )
23542357}
23552358
@@ -2520,6 +2523,7 @@ You can remove multiple dependencies at once:
25202523 )
25212524 . args ( lock_args ( ) )
25222525 . arg ( lockfile_only_arg ( ) )
2526+ . arg ( package_json_arg ( ) )
25232527 } )
25242528}
25252529
@@ -3717,6 +3721,7 @@ These must be added to the path manually if required."), UnstableArgsConfig::Res
37173721 . conflicts_with ( "global" ) ,
37183722 )
37193723 . arg ( lockfile_only_arg ( ) . conflicts_with ( "global" ) )
3724+ . arg ( package_json_arg ( ) . conflicts_with ( "entrypoint" ) . conflicts_with ( "global" ) )
37203725 . arg (
37213726 Arg :: new ( "os" )
37223727 . long ( "os" )
@@ -3758,6 +3763,15 @@ fn lockfile_only_arg() -> Arg {
37583763 . help ( "Install only updating the lockfile" )
37593764}
37603765
3766+ fn package_json_arg ( ) -> Arg {
3767+ Arg :: new ( "package-json" )
3768+ . long ( "package-json" )
3769+ . action ( ArgAction :: SetTrue )
3770+ . help (
3771+ "Force using package.json for dependency management instead of deno.json" ,
3772+ )
3773+ }
3774+
37613775fn json_reference_subcommand ( ) -> Command {
37623776 Command :: new ( "json_reference" ) . hide ( true )
37633777}
@@ -3975,6 +3989,7 @@ The installation root is determined, in order of precedence:
39753989 )
39763990 . args ( lock_args ( ) )
39773991 . arg ( lockfile_only_arg ( ) )
3992+ . arg ( package_json_arg ( ) . conflicts_with ( "global" ) )
39783993 } )
39793994}
39803995
@@ -6427,6 +6442,7 @@ fn add_parse_inner(
64276442 default_registry,
64286443 lockfile_only : matches. get_flag ( "lockfile-only" ) ,
64296444 save_exact : matches. get_flag ( "save-exact" ) ,
6445+ package_json : matches. get_flag ( "package-json" ) ,
64306446 }
64316447}
64326448
@@ -6435,6 +6451,7 @@ fn remove_parse(flags: &mut Flags, matches: &mut ArgMatches) {
64356451 flags. subcommand = DenoSubcommand :: Remove ( RemoveFlags {
64366452 packages : matches. remove_many :: < String > ( "packages" ) . unwrap ( ) . collect ( ) ,
64376453 lockfile_only : matches. get_flag ( "lockfile-only" ) ,
6454+ package_json : matches. get_flag ( "package-json" ) ,
64386455 } ) ;
64396456}
64406457
@@ -7345,6 +7362,7 @@ fn uninstall_parse(flags: &mut Flags, matches: &mut ArgMatches) {
73457362 UninstallKind :: Local ( RemoveFlags {
73467363 packages,
73477364 lockfile_only : matches. get_flag ( "lockfile-only" ) ,
7365+ package_json : matches. get_flag ( "package-json" ) ,
73487366 } )
73497367 } ;
73507368
@@ -11473,6 +11491,7 @@ mod tests {
1147311491 kind: UninstallKind :: Local ( RemoveFlags {
1147411492 packages: vec![ "@std/load" . to_string( ) ] ,
1147511493 lockfile_only: true ,
11494+ package_json: false ,
1147611495 } ) ,
1147711496 } ) ,
1147811497 frozen_lockfile: Some ( true ) ,
@@ -11489,6 +11508,7 @@ mod tests {
1148911508 kind: UninstallKind :: Local ( RemoveFlags {
1149011509 packages: vec![ "file_server" . to_string( ) , "@std/load" . to_string( ) ] ,
1149111510 lockfile_only: false ,
11511+ package_json: false ,
1149211512 } ) ,
1149311513 } ) ,
1149411514 ..Flags :: default ( )
@@ -14596,6 +14616,7 @@ mod tests {
1459614616 default_registry: Some ( DefaultRegistry :: Npm ) ,
1459714617 lockfile_only: false ,
1459814618 save_exact: false ,
14619+ package_json: false ,
1459914620 } )
1460014621 ) ;
1460114622 }
@@ -14614,6 +14635,7 @@ mod tests {
1461414635 default_registry : Some ( DefaultRegistry :: Npm ) ,
1461514636 lockfile_only : true ,
1461614637 save_exact : false ,
14638+ package_json : false ,
1461714639 } ) ;
1461814640 expected_flags. frozen_lockfile = Some ( true ) ;
1461914641 assert_eq ! ( r. unwrap( ) , expected_flags) ;
@@ -14628,6 +14650,7 @@ mod tests {
1462814650 default_registry: Some ( DefaultRegistry :: Npm ) ,
1462914651 lockfile_only: false ,
1463014652 save_exact: false ,
14653+ package_json: false ,
1463114654 } ) ,
1463214655 ) ;
1463314656 }
@@ -14641,6 +14664,7 @@ mod tests {
1464114664 default_registry: Some ( DefaultRegistry :: Npm ) ,
1464214665 lockfile_only: false ,
1464314666 save_exact: false ,
14667+ package_json: false ,
1464414668 } ) ,
1464514669 ) ;
1464614670 }
@@ -14654,6 +14678,7 @@ mod tests {
1465414678 default_registry: Some ( DefaultRegistry :: Jsr ) ,
1465514679 lockfile_only: false ,
1465614680 save_exact: false ,
14681+ package_json: false ,
1465714682 } ) ,
1465814683 ) ;
1465914684 }
@@ -14672,6 +14697,7 @@ mod tests {
1467214697 subcommand: DenoSubcommand :: Remove ( RemoveFlags {
1467314698 packages: svec![ "@david/which" ] ,
1467414699 lockfile_only: false ,
14700+ package_json: false ,
1467514701 } ) ,
1467614702 ..Flags :: default ( )
1467714703 }
@@ -14691,6 +14717,7 @@ mod tests {
1469114717 subcommand: DenoSubcommand :: Remove ( RemoveFlags {
1469214718 packages: svec![ "@david/which" , "@luca/hello" ] ,
1469314719 lockfile_only: true ,
14720+ package_json: false ,
1469414721 } ) ,
1469514722 frozen_lockfile: Some ( true ) ,
1469614723 ..Flags :: default ( )
0 commit comments