@@ -368,6 +368,10 @@ function shouldWriteLockfileIfExists(flags: Object, args: Array<string>): boolea
368
368
*/
369
369
370
370
function shouldWriteLockfile ( flags : Object , args : Array < string > ) : boolean {
371
+ if ( ! flags . lockfile ) {
372
+ return false ;
373
+ }
374
+
371
375
if ( hasSaveFlags ( flags ) ) {
372
376
// we should write a new lockfile as we're introducing new dependencies
373
377
return true ;
@@ -390,13 +394,8 @@ export function setFlags(commander: Object) {
390
394
commander . option ( "-O, --save-optional" , "save package to your `optionalDependencies`" ) ;
391
395
commander . option ( "-E, --save-exact" , "" ) ;
392
396
commander . option ( "-T, --save-tilde" , "" ) ;
393
- commander . option ( "--tag [tag]" , "" ) ; // TODO
394
- commander . option ( "--dry-run" , "" ) ; // TODO
395
- commander . option ( "-f, --force" , "" ) ; // TODO
396
- commander . option ( "-g, --global" , "" ) ; // TODO
397
- commander . option ( "--link" ) ; // TODO
398
397
commander . option ( "--no-optional" ) ; // TODO
399
- commander . option ( "--no-lockfile" ) ; // TODO
398
+ commander . option ( "--no-lockfile" ) ;
400
399
commander . option ( "--init-mirror" , "initialise local package mirror and copy module tarballs" ) ;
401
400
}
402
401
@@ -406,10 +405,16 @@ export async function run(
406
405
flags : Object ,
407
406
args : Array < string >
408
407
) : Promise < void > {
409
- let lockfile = await Lockfile . fromDirectory ( config . cwd , reporter , {
410
- strictIfPresent : isStrictLockfile ( flags , args ) ,
411
- save : hasSaveFlags ( flags ) || flags . initMirror
412
- } ) ;
408
+ let lockfile ;
409
+ if ( flags . lockfile ) {
410
+ lockfile = await Lockfile . fromDirectory ( config . cwd , reporter , {
411
+ strictIfPresent : isStrictLockfile ( flags , args ) ,
412
+ save : hasSaveFlags ( flags ) || flags . initMirror
413
+ } ) ;
414
+ } else {
415
+ lockfile = new Lockfile ;
416
+ }
417
+
413
418
let install = new Install ( "install" , flags , args , config , reporter , lockfile ) ;
414
419
return install . init ( ) ;
415
420
}
0 commit comments