mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
fix(config): global bin directory on Windows
This commit is contained in:
5
.changeset/silent-geckos-chew.md
Normal file
5
.changeset/silent-geckos-chew.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/config": patch
|
||||
---
|
||||
|
||||
Finding global bin directory on Windows.
|
||||
@@ -43,6 +43,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pnpm/config": "link:",
|
||||
"@pnpm/prepare": "workspace:^0.0.16",
|
||||
"@types/mz": "^2.7.3",
|
||||
"@types/ramda": "^0.27.32",
|
||||
"@types/which": "^1.3.2",
|
||||
|
||||
@@ -6,8 +6,8 @@ export default function findBestGlobalPrefixOnWindows (
|
||||
env: { [key: string]: string | undefined }
|
||||
) {
|
||||
if (
|
||||
(env.LOCALAPPDATA && isSubdir(env.LOCALAPPDATA, defaultNpmGlobalPrefix)) ??
|
||||
(env.APPDATA && isSubdir(env.APPDATA, defaultNpmGlobalPrefix))
|
||||
(env.LOCALAPPDATA != null && isSubdir(env.LOCALAPPDATA, defaultNpmGlobalPrefix)) ||
|
||||
(env.APPDATA != null && isSubdir(env.APPDATA, defaultNpmGlobalPrefix))
|
||||
) {
|
||||
return defaultNpmGlobalPrefix
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference path="../../../typings/index.d.ts"/>
|
||||
import getConfig from '@pnpm/config'
|
||||
import PnpmError from '@pnpm/error'
|
||||
import prepare from '@pnpm/prepare'
|
||||
|
||||
import './findBestGlobalPrefixOnWindows'
|
||||
import fs = require('mz/fs')
|
||||
@@ -198,9 +199,8 @@ test('registries of scoped packages are read', async () => {
|
||||
})
|
||||
|
||||
test('registries in current directory\'s .npmrc have bigger priority then global config settings', async () => {
|
||||
const tmp = tempy.directory()
|
||||
prepare()
|
||||
|
||||
process.chdir(tmp)
|
||||
await fs.writeFile('.npmrc', 'registry=https://pnpm.js.org/', 'utf8')
|
||||
|
||||
const { config } = await getConfig({
|
||||
@@ -539,9 +539,8 @@ test('normalize the value of the color flag', async () => {
|
||||
})
|
||||
|
||||
test('read only supported settings from config', async () => {
|
||||
const tmp = tempy.directory()
|
||||
prepare()
|
||||
|
||||
process.chdir(tmp)
|
||||
await fs.writeFile('.npmrc', 'store-dir=__store__\nfoo=bar', 'utf8')
|
||||
|
||||
const { config } = await getConfig({
|
||||
|
||||
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@@ -227,6 +227,7 @@ importers:
|
||||
which: 2.0.2
|
||||
devDependencies:
|
||||
'@pnpm/config': 'link:'
|
||||
'@pnpm/prepare': 'link:../../privatePackages/prepare'
|
||||
'@types/mz': 2.7.3
|
||||
'@types/ramda': 0.27.32
|
||||
'@types/which': 1.3.2
|
||||
@@ -237,6 +238,7 @@ importers:
|
||||
'@pnpm/constants': 'workspace:4.1.0'
|
||||
'@pnpm/error': 'workspace:1.4.0'
|
||||
'@pnpm/global-bin-dir': 'workspace:^1.2.5'
|
||||
'@pnpm/prepare': 'workspace:^0.0.16'
|
||||
'@pnpm/types': 'workspace:6.3.1'
|
||||
'@types/mz': ^2.7.3
|
||||
'@types/ramda': ^0.27.32
|
||||
|
||||
Reference in New Issue
Block a user