File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const error = msg => print(colors.red.bold(msg));
23
23
24
24
const cmds = {
25
25
isYarn : "ls yarn.lock" ,
26
+ isPackageLockPresent : "ls package-lock.json" ,
26
27
install : undefined , // defined after isYarn test
27
28
gitStatus : "git status --porcelain" ,
28
29
gitFetch : "git fetch --quiet" ,
@@ -56,7 +57,22 @@ const isYarn = exec(cmds.isYarn, execOpts).code === 0;
56
57
if ( isYarn ) {
57
58
log ( "Yarn detected." ) ;
58
59
}
59
- cmds . install = isYarn ? "yarn --frozen-lockfile" : "npm ci" ;
60
+
61
+ // check if package-lock is used
62
+ debug ( cmds . isPackageLockPresent ) ;
63
+ const isPackageLockPresent =
64
+ exec ( cmds . isPackageLockPresent , execOpts ) . code === 0 ;
65
+ if ( isPackageLockPresent ) {
66
+ log ( "package-lock.json detected." ) ;
67
+ }
68
+
69
+ if ( isYarn ) {
70
+ cmds . install = "yarn --frozen-lockfile" ;
71
+ } else if ( isPackageLockPresent ) {
72
+ cmds . install = "npm ci" ;
73
+ } else {
74
+ cmds . install = "npm install" ;
75
+ }
60
76
61
77
// check clean status
62
78
if ( argv [ "skip-status" ] ) {
You can’t perform that action at this time.
0 commit comments