Skip to main content

Configuration

Index

Properties

publicenv

env: Record<string, undefined | string> = {}

publicinvalid

invalid: Map<string, string> = ...

publicisCI

isCI: boolean = isCI

publiclimits

limits: Map<string, Limit> = ...

publicplugins

plugins: Map<string, Plugin> = ...

publicprojectCwd

projectCwd: null | PortablePath = null

publicsettings

settings: Map<string, SettingsDefinition> = ...

publicsources

sources: Map<string, string> = ...

publicstartingCwd

startingCwd: PortablePath

publicvalues

values: Map<string, any> = ...

publicstaticdeleteProperty

deleteProperty: symbol = ...

publicstatictelemetry

telemetry: null | TelemetryManager = null

Methods

activatePlugin

  • activatePlugin(name: string, plugin: Plugin): void
  • Parameters

    Returns void

firstHook

  • firstHook<U, V, HooksDefinition>(get: (hooks: HooksDefinition) => undefined | (...args: U) => Promise<V>, ...args: U): Promise<null | Exclude<V, void>>
  • Type parameters

    • U: any[]
    • V
    • HooksDefinition = Hooks

    Parameters

    • get: (hooks: HooksDefinition) => undefined | (...args: U) => Promise<V>
    • rest...args: U

    Returns Promise<null | Exclude<V, void>>

get

getLimit

  • getLimit<K>(key: K): Limit

getLinkers

getPackageExtensions

getSpecial

  • getSpecial<T>(key: string, __namedParameters: Partial<SettingTransforms>): T
  • Type parameters

    • T = any

    Parameters

    • key: string
    • __namedParameters: Partial<SettingTransforms>

    Returns T

getSubprocessStreams

  • getSubprocessStreams(logFile: PortablePath, __namedParameters: { header?: string; prefix: string; report: Report }): { stderr: Writable; stdout: Writable }
  • Parameters

    • logFile: PortablePath
    • __namedParameters: { header?: string; prefix: string; report: Report }

    Returns { stderr: Writable; stdout: Writable }

    • stderr: Writable
    • stdout: Writable

getSupportedArchitectures

makeFetcher

makeResolver

  • makeResolver(): MultiResolver
  • Returns MultiResolver

normalizeDependency

normalizeDependencyMap

normalizeLocator

normalizePackage

reduceHook

  • reduceHook<U, V, HooksDefinition>(get: (hooks: HooksDefinition) => undefined | (reduced: V, ...args: U) => Promise<V>, initialValue: V, ...args: U): Promise<V>
  • Type parameters

    • U: any[]
    • V
    • HooksDefinition = Hooks

    Parameters

    • get: (hooks: HooksDefinition) => undefined | (reduced: V, ...args: U) => Promise<V>
    • initialValue: V
    • rest...args: U

    Returns Promise<V>

triggerHook

  • triggerHook<U, V, HooksDefinition>(get: (hooks: HooksDefinition) => undefined | (...args: U) => V, ...args: U): Promise<void>
  • Type parameters

    • U: any[]
    • V
    • HooksDefinition = Hooks

    Parameters

    • get: (hooks: HooksDefinition) => undefined | (...args: U) => V
    • rest...args: U

    Returns Promise<void>

triggerMultipleHooks

  • triggerMultipleHooks<U, V, HooksDefinition>(get: (hooks: HooksDefinition) => undefined | (...args: U) => V, argsList: U[]): Promise<void>
  • Type parameters

    • U: any[]
    • V
    • HooksDefinition = Hooks

    Parameters

    • get: (hooks: HooksDefinition) => undefined | (...args: U) => V
    • argsList: U[]

    Returns Promise<void>

use

  • use(source: string, data: {}, folder: PortablePath, __namedParameters?: { overwrite?: boolean; strict?: boolean }): void
  • Parameters

    • source: string
    • data: {}
    • folder: PortablePath
    • __namedParameters: { overwrite?: boolean; strict?: boolean } = {}

    Returns void

useWithSource

  • useWithSource(source: string, data: {}, folder: PortablePath, opts?: { overwrite?: boolean; strict?: boolean }): void
  • Parameters

    • source: string
    • data: {}
    • folder: PortablePath
    • optionalopts: { overwrite?: boolean; strict?: boolean }

    Returns void

staticaddPlugin

  • addPlugin(cwd: PortablePath, pluginMetaList: PluginMeta[]): Promise<void>
  • Parameters

    Returns Promise<void>

staticcreate

  • Instantiate a new configuration object with the default values from the core. You typically don’t want to use this, as it will ignore the values configured in the rc files. Instead, prefer to use Configuration#find.


    Parameters

    Returns Configuration

staticfind

  • Instantiate a new configuration object exposing the configuration obtained from reading the various rc files and the environment settings.

    The pluginConfiguration parameter is expected to indicate:

    1. which modules should be made available to plugins when they require a package (this is the dynamic linking part - for example we want all the plugins to use the exact same version of @yarnpkg/core, which also is the version used by the running Yarn instance).
    2. which of those modules are actually plugins that need to be injected within the configuration.

    Note that some extra plugins will be automatically added based on the content of the rc files - with the rc plugins taking precedence over the other ones.

    One particularity: the plugin initialization order is quite strict, with plugins listed in /foo/bar/.yarnrc.yml taking precedence over plugins listed in /foo/.yarnrc.yml and /.yarnrc.yml. Additionally, while plugins can depend on one another, they can only depend on plugins that have been instantiated before them (so a plugin listed in /foo/.yarnrc.yml can depend on another one listed on /foo/bar/.yarnrc.yml, but not the other way around).


    Parameters

    Returns Promise<Configuration>

staticfindFolderRcFile

staticfindProjectCwd

staticfindRcFiles

staticupdateConfiguration

  • updateConfiguration(cwd: PortablePath, patch: {} | (current: {}) => {}, opts?: { immutable?: boolean }): Promise<boolean>
  • Parameters

    • cwd: PortablePath
    • patch: {} | (current: {}) => {}
    • opts: { immutable?: boolean } = {}

    Returns Promise<boolean>

staticupdateHomeConfiguration

  • updateHomeConfiguration(patch: {} | (current: {}) => {}): Promise<boolean>
  • Parameters

    • patch: {} | (current: {}) => {}

    Returns Promise<boolean>