fix: always-auth config value is not ignored anymore

Ref #708
This commit is contained in:
zkochan
2017-04-26 14:49:17 +03:00
parent 5d04767778
commit b1635735ca
4 changed files with 12 additions and 3 deletions

View File

@@ -34,6 +34,7 @@ const defaults = (opts: PnpmOptions) => {
registry: 'https://registry.npmjs.org/',
userAgent: `${pnpmPkgJson.name}/${pnpmPkgJson.version} npm/? node/${process.version} ${process.platform} ${process.arch}`,
rawNpmConfig: {},
alwaysAuth: false,
}
}

View File

@@ -201,6 +201,7 @@ async function installInContext (
got: createGot(client, {
networkConcurrency: opts.networkConcurrency,
rawNpmConfig: opts.rawNpmConfig,
alwaysAuth: opts.alwaysAuth,
}),
metaCache: opts.metaCache,
resolvedDependencies,

View File

@@ -8,11 +8,13 @@ import path = require('path')
import createWriteStreamAtomic = require('fs-write-stream-atomic')
export type AuthInfo = {
token: string
alwaysAuth: boolean,
} & ({
token: string,
} | {
username: string,
password: string,
}
})
export type HttpResponse = {
body: string
@@ -38,6 +40,7 @@ export default (
opts: {
networkConcurrency: number,
rawNpmConfig: Object,
alwaysAuth: boolean,
}
): Got => {
const limit = pLimit(opts.networkConcurrency)
@@ -118,10 +121,12 @@ export default (
switch (authInfo.type) {
case 'Bearer':
return {
token: authInfo.token
alwaysAuth: opts.alwaysAuth,
token: authInfo.token,
}
case 'Basic':
return {
alwaysAuth: opts.alwaysAuth,
username: authInfo.username,
password: authInfo.password,
}

View File

@@ -44,6 +44,7 @@ export type PnpmOptions = {
tag?: string,
metaCache?: Map<string, PackageMeta>,
alwaysAuth?: boolean,
}
export type StrictPnpmOptions = {
@@ -89,6 +90,7 @@ export type StrictPnpmOptions = {
tag: string,
metaCache: Map<string, PackageMeta>,
alwaysAuth: boolean,
}
export type Dependencies = {