Skip to content
PHP Ecosystem
Explore

YarnManager

API reference › Foxy › Asset › YarnManager

Integrates Yarn with Foxy’s install, update, Plug’n’Play, and audit workflows.

PropertyTypeDescriptionDefined by
$config protected constructorFoxy\Config\ConfigFoxy configuration.AbstractManifestAssetManager
$executor protected constructorComposer\Util\ProcessExecutorProcess executor used to invoke the manager.AbstractAssetManager
$fs protected constructorComposer\Util\FilesystemFilesystem used to resolve and update manifest paths.AbstractManifestAssetManager
$io protected constructorComposer\IO\IOInterfaceComposer output used for progress messages.AbstractManifestAssetManager
$updatable protectedboolWhether an existing frontend installation may be updated. Default: true.AbstractManifestAssetManager
$versionConverter protected constructorFoxy\Converter\VersionConverterInterface|nullConverter for manager version output. Default: null.AbstractAssetManager
MethodDescriptionDefined by
__construct()Creates a manager that executes frontend commands for the configured asset manifest.AbstractAssetManager
addDependencies()Merges Composer asset dependencies into the frontend package manifest.AbstractManifestAssetManager
audit()Runs the manager audit command against the current lock file.AbstractAssetManager
getAuditParser()Returns the parser for Yarn audit JSON output.YarnManager
getLockPackageName()Returns Yarn’s lock-file name.YarnManager
getName()Returns the manager name used in Foxy configuration.YarnManager
getPackageJsonPath()Returns the frontend package manifest path.AbstractManifestAssetManager
getPackageName()Returns the frontend package manifest filename.AbstractManifestAssetManager
getVersionConstraint()Returns the Yarn versions supported by this integration.YarnManager
hasLockFile()Returns whether the manager lock file exists.AbstractManifestAssetManager
isAvailable()Returns whether the manager executable reports a detectable version.AbstractAssetManager
isInstalled()Returns whether the manifest and lock file exist with either node_modules or Plug’n’Play output.YarnManager
isUpdatable()Returns whether an existing frontend installation may be updated.AbstractManifestAssetManager
run()Installs or updates frontend dependencies according to the manager state and configuration.AbstractAssetManager
setUpdatable()Enables or disables updates of an existing frontend installation.AbstractManifestAssetManager
validate()Validates the installed manager version against Foxy’s supported and configured constraints.AbstractAssetManager
actionWhenComposerDependenciesAreAlreadyInstalled() protectedHandles dependencies already present in the frontend installation.AbstractManifestAssetManager
actionWhenComposerDependenciesAreMerged() protectedRuns after the Composer asset dependencies are merged and before the asset package is written.AbstractManifestAssetManager
buildCommand() protectedReturns the manager command run by the configured or default binary, followed by the manager-options and manager-{action}-options values.AbstractAssetManager
buildUnconfiguredCommand() protectedReturns the manager command run by the configured or default binary, without the install and update options.AbstractAssetManager
getAuditCommand() protectedReturns the Yarn recursive audit command for all or production dependencies.YarnManager
getAuditEnvironment() protectedReturns environment overrides that prevent exclusions from Yarn audit results.YarnManager
getDefaultBinary() protectedReturns the executable used when manager-bin is not configured; defaults to the manager name.AbstractAssetManager
getInstallCommand() protectedReturns the command that installs the asset dependencies, followed by the manager-options and manager-install-options values.AbstractAssetManager
getLockFilePath() protectedReturns the manager lock-file path under the root package directory.AbstractManifestAssetManager
getManagerConfig() protectedReturns the configuration scoped to this manager, so manager-* map entries resolve to its own value.AbstractManifestAssetManager
getManagerWorkingDirectory() protectedReturns the configured manager working directory, or null to use the process default.AbstractManifestAssetManager
getNodeModulesPath() protectedReturns the node_modules path under the root package directory.AbstractManifestAssetManager
getRootPackageDir() protectedReturns the resolved root package directory.AbstractManifestAssetManager
getRootPackagePath() protectedResolves a path under the root package directory.AbstractManifestAssetManager
getUpdateCommand() protectedReturns Yarn’s dependency update command.YarnManager
getVersion() protectedReturns the normalized manager version, or null when it cannot be detected.AbstractAssetManager
getVersionCommand() protectedReturns the command that prints the manager version, without the install and update options.AbstractAssetManager
normalizeVersionOutput() protectedNormalizes the trimmed output of the version command before it is converted.AbstractAssetManager
validateAuditConfiguration() protectedValidate manager configuration that can change the audit scope.AbstractAssetManager
withManagerTimeout() protected finalRuns the callback with the process timeout set to the manager-timeout option and restores the previous timeout afterward, even when the callback throws.AbstractAssetManager
ConstantValueDescriptionDefined by
NODE_MODULES_PATH'./node_modules'AbstractManifestAssetManager
public function getAuditParser(): Foxy\Audit\AuditParserInterface

Returns the parser for Yarn audit JSON output.

public function getLockPackageName(): string

Returns Yarn’s lock-file name.

Returns

string

public function getName(): string

Returns the manager name used in Foxy configuration.

Returns

string

public function getVersionConstraint(): string

Returns the Yarn versions supported by this integration.

Returns

string

public function isInstalled(): bool

Returns whether the manifest and lock file exist with either node_modules or Plug’n’Play output.

Returns

bool

protected function getAuditCommand(bool $noDev): string

Returns the Yarn recursive audit command for all or production dependencies.

Parameters

ParameterTypeDescription
$noDevbool

Returns

string

protected function getAuditEnvironment(): array

Returns environment overrides that prevent exclusions from Yarn audit results.

Returns

array

protected function getUpdateCommand(): string

Returns Yarn’s dependency update command.

Returns

string