Skip to content

Commit b133204

Browse files
committed
small improvement
1 parent b44930b commit b133204

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/commands/wrapper/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ function setupCommand (name, description, argv, importMeta) {
5252
const { enable, disable } = cli.flags
5353

5454
if (argv[0] === '--postinstall') {
55-
installSafeNpm(`The Socket CLI is now successfully installed! 🎉
55+
// Check if the wrapper is already enabled before showing the postinstall prompt
56+
const socketWrapperEnabled = (fs.existsSync(BASH_FILE) && checkSocketWrapperAlreadySetup(BASH_FILE)) || (fs.existsSync(ZSH_BASH_FILE) && checkSocketWrapperAlreadySetup(BASH_FILE))
5657

57-
To better protect yourself against supply-chain attacks, our "safe npm" wrapper can warn you about malicious packages whenever you run 'npm install'.
58+
if (!socketWrapperEnabled) {
59+
installSafeNpm(`The Socket CLI is now successfully installed! 🎉
5860
59-
Do you want to install "safe npm" (this will create an alias to the socket-npm command)? (y/n)`)
61+
To better protect yourself against supply-chain attacks, our "safe npm" wrapper can warn you about malicious packages whenever you run 'npm install'.
62+
63+
Do you want to install "safe npm" (this will create an alias to the socket-npm command)? (y/n)`)
64+
}
6065

6166
return
6267
}

0 commit comments

Comments
 (0)