mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-05 07:46:10 -04:00
fix(setup): print an info message (#3698)
This commit is contained in:
5
.changeset/twenty-clocks-sniff.md
Normal file
5
.changeset/twenty-clocks-sniff.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-setup": major
|
||||
---
|
||||
|
||||
Print info message about the requirment to open a new terminal.
|
||||
@@ -61,17 +61,27 @@ export async function handler (
|
||||
if (execPath.match(/\.[cm]?js$/) == null) {
|
||||
moveCli(execPath, opts.pnpmHomeDir)
|
||||
}
|
||||
const updateOutput = await updateShell(currentShell, opts.pnpmHomeDir)
|
||||
if (updateOutput === false) {
|
||||
return 'Could not infer shell type.'
|
||||
}
|
||||
return `${updateOutput}
|
||||
|
||||
Setup complete. Open a new terminal to start using pnpm.`
|
||||
}
|
||||
|
||||
async function updateShell (currentShell: string | null, pnpmHomeDir: string): Promise<string | false> {
|
||||
switch (currentShell) {
|
||||
case 'bash': {
|
||||
const configFile = path.join(os.homedir(), '.bashrc')
|
||||
return setupShell(configFile, opts.pnpmHomeDir)
|
||||
return setupShell(configFile, pnpmHomeDir)
|
||||
}
|
||||
case 'zsh': {
|
||||
const configFile = path.join(os.homedir(), '.zshrc')
|
||||
return setupShell(configFile, opts.pnpmHomeDir)
|
||||
return setupShell(configFile, pnpmHomeDir)
|
||||
}
|
||||
case 'fish': {
|
||||
return setupFishShell(opts.pnpmHomeDir)
|
||||
return setupFishShell(pnpmHomeDir)
|
||||
}
|
||||
}
|
||||
return 'Could not infer shell type.'
|
||||
|
||||
Reference in New Issue
Block a user