fix(setup): suggest to source the config (#5165)

This commit is contained in:
Zoltan Kochan
2022-08-06 15:58:30 +03:00
committed by GitHub
parent 4ee3600399
commit fe53c2986e
3 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-setup": patch
"pnpm": patch
---
On POSIX `pnpm setup` should suggest users to source the config instead of restarting the terminal.

View File

@@ -102,7 +102,13 @@ function renderSetupOutput (report: PathExtenderReport) {
}
output.push(`Next configuration changes were made:
${report.newSettings}`)
output.push('Setup complete. Open a new terminal to start using pnpm.')
if (report.configFile == null) {
output.push('Setup complete. Open a new terminal to start using pnpm.')
} else if (report.configFile.changeType !== 'skipped') {
output.push(`To start using pnpm, run:
source ${report.configFile.path}
`)
}
return output.join('\n\n')
}

View File

@@ -32,7 +32,9 @@ test('setup makes changes on POSIX', async () => {
Next configuration changes were made:
export PNPM_HOME=dir2
Setup complete. Open a new terminal to start using pnpm.`)
To start using pnpm, run:
source ~/.bashrc
`)
})
test('setup makes changes on Windows', async () => {