mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 02:51:59 -04:00
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ async function installInContext (
|
||||
got: createGot(client, {
|
||||
networkConcurrency: opts.networkConcurrency,
|
||||
rawNpmConfig: opts.rawNpmConfig,
|
||||
alwaysAuth: opts.alwaysAuth,
|
||||
}),
|
||||
metaCache: opts.metaCache,
|
||||
resolvedDependencies,
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user