@@ -197,55 +197,6 @@ impl PackageJson {
197
197
Err ( PackageJsonError :: NoScript ( command. to_string ( ) ) )
198
198
}
199
199
}
200
-
201
- pub fn list ( & self , dependency_group : DependencyGroup , node_modules_path : & PathBuf , depth : u32 ) -> Result < String , PackageJsonError > {
202
- let mut scope: String = String :: new ( ) ;
203
- let default = Value :: default ( ) ;
204
- match dependency_group {
205
- DependencyGroup :: Dev => {
206
- let mut dependencies = self
207
- . value
208
- . get ( "devDependencies" )
209
- . unwrap_or ( & default)
210
- . as_object ( )
211
- . into_iter ( ) ;
212
-
213
- let dep = dependencies. next ( ) ;
214
- while !dep. is_none ( ) {
215
- let tree: String = dep. unwrap ( )
216
- . into_iter ( )
217
- . map ( |( name, version) | {
218
- let mut res = format ! ( "{}@{}" , name, version) ;
219
-
220
- if depth > 1 {
221
- let nested = PackageJson :: from_path ( & node_modules_path. join ( name) )
222
- . unwrap ( ) ;
223
- let unwraped = nested. list ( DependencyGroup :: Dev , node_modules_path, depth) ;
224
- res = format ! ( "\n \t {}" , unwraped. unwrap( ) )
225
- }
226
-
227
- res
228
- } ) . collect ( ) ;
229
- scope = format ! ( "{:?}\n " , tree) ;
230
- }
231
-
232
- } ,
233
- DependencyGroup :: Default => scope = "dependencies" . to_string ( ) ,
234
- _ => scope = "all" . to_string ( )
235
- }
236
-
237
- // let binding = Value::default();
238
- // let mut dependencies = self.value.get(scope).unwrap_or(&binding).as_object().into_iter();
239
-
240
- // let mut dep = dependencies.next();
241
- // while !dep.is_none() {
242
- // println!("{:?}", dep);
243
- // dep = dependencies.next();
244
- // }
245
-
246
- Ok ( scope. clone ( ) )
247
- }
248
-
249
200
}
250
201
251
202
#[ cfg( test) ]
0 commit comments