nvm-vanilla 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nvm-vanilla",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/bin.js CHANGED
@@ -19,7 +19,8 @@ const main = async () => {
19
19
  argv: process.argv,
20
20
  cwd: process.cwd(),
21
21
  time: Date.now(),
22
- }));
22
+ pwsh: !!process.env.PSModulePath,
23
+ }, null, 4) + '\n');
23
24
 
24
25
  const homeDir = os.homedir();
25
26
 
package/src/nvm.ps1 CHANGED
@@ -10,12 +10,10 @@ function nvm {
10
10
  $global:_nvmAutoloadDir = ""
11
11
 
12
12
  function _nvmAutoloadHook {
13
- # 只在交互式 shell 中运行
14
13
  if (-not [Environment]::UserInteractive) { return }
15
-
14
+
16
15
  $currentDir = (Get-Location).Path
17
-
18
- # 如果目录没变,跳过
16
+
19
17
  if ($global:_nvmAutoloadDir -eq $currentDir) { return }
20
18
 
21
19
  nvm autoload
@@ -23,7 +21,6 @@ function _nvmAutoloadHook {
23
21
  $global:_nvmAutoloadDir = $currentDir
24
22
  }
25
23
 
26
- # 集成到 prompt 中
27
24
  $originalPrompt = Get-Item function:prompt -ErrorAction SilentlyContinue
28
25
  if ($originalPrompt) {
29
26
  $originalPrompt = $originalPrompt.ScriptBlock
@@ -32,7 +29,6 @@ if ($originalPrompt) {
32
29
  function global:prompt {
33
30
  _nvmAutoloadHook
34
31
 
35
- # 调用原始 prompt
36
32
  if ($originalPrompt) {
37
33
  & $originalPrompt
38
34
  } else {
package/src/nvm.sh CHANGED
@@ -21,14 +21,11 @@ _nvm_autoload_hook() {
21
21
  nvm_autoload_dir="$current_dir"
22
22
  }
23
23
 
24
- # 根据不同 shell 设置钩子
25
24
  case "$SHELL" in
26
25
  *bash*)
27
- # bash: 使用 PROMPT_COMMAND
28
26
  PROMPT_COMMAND="_nvm_autoload_hook; $PROMPT_COMMAND"
29
27
  ;;
30
28
  *zsh*)
31
- # zsh: 使用 chpwd 或 precmd 钩子
32
29
  autoload -U add-zsh-hook
33
30
  add-zsh-hook chpwd _nvm_autoload_hook
34
31
  ;;