Skip to main content

Hooks

Index

Properties

optionalafterWorkspaceDependencyAddition

afterWorkspaceDependencyAddition?: (workspace: Workspace, target: Target, descriptor: Descriptor, strategies: Strategy[]) => Promise<void>

Called when a new dependency is added to a workspace. Note that this hook is only called by the CLI commands like yarn add - manually adding the dependencies into the manifest and running yarn install won't trigger it.


Type declaration

    • Called when a new dependency is added to a workspace. Note that this hook is only called by the CLI commands like yarn add - manually adding the dependencies into the manifest and running yarn install won't trigger it.


      Parameters

      Returns Promise<void>

optionalafterWorkspaceDependencyRemoval

afterWorkspaceDependencyRemoval?: (workspace: Workspace, target: Target, descriptor: Descriptor) => Promise<void>

Called when a dependency range is removed from a workspace. Note that this hook is only called by the CLI commands like yarn remove - manually removing the dependencies from the manifest and running yarn install won't trigger it.


Type declaration

    • Called when a dependency range is removed from a workspace. Note that this hook is only called by the CLI commands like yarn remove - manually removing the dependencies from the manifest and running yarn install won't trigger it.


      Parameters

      Returns Promise<void>

optionalafterWorkspaceDependencyReplacement

afterWorkspaceDependencyReplacement?: (workspace: Workspace, target: Target, fromDescriptor: Descriptor, toDescriptor: Descriptor) => Promise<void>

Called when a dependency range is replaced inside a workspace. Note that this hook is only called by the CLI commands like yarn add - manually updating the dependencies from the manifest and running yarn install won't trigger it.


Type declaration

    • Called when a dependency range is replaced inside a workspace. Note that this hook is only called by the CLI commands like yarn add - manually updating the dependencies from the manifest and running yarn install won't trigger it.


      Parameters

      Returns Promise<void>

optionalfetchPackageInfo

fetchPackageInfo?: (pkg: Package, extra: Set<string>, registerData: (namespace: string, data: Tuple<NO_HINT | ID | NULL | SCOPE | NAME | RANGE | REFERENCE | NUMBER | PATH | URL | ADDED | REMOVED | CODE | INSPECT | DURATION | SIZE | SIZE_DIFF | IDENT | DESCRIPTOR | LOCATOR | RESOLUTION | DEPENDENT | PACKAGE_EXTENSION | SETTING | MARKDOWN | MARKDOWN_INLINE>[] | {}) => void) => Promise<void>

Called by yarn info. The extra field is the set of parameters passed to the -X,--extra flag. Calling registerData will add a new set of data that will be added to the package information.

For instance, an "audit" plugin could check in extra whether the user requested audit information (via -X audit), and call registerData with those information (retrieved dynamically) if they did.


Type declaration

    • (pkg: Package, extra: Set<string>, registerData: (namespace: string, data: Tuple<NO_HINT | ID | NULL | SCOPE | NAME | RANGE | REFERENCE | NUMBER | PATH | URL | ADDED | REMOVED | CODE | INSPECT | DURATION | SIZE | SIZE_DIFF | IDENT | DESCRIPTOR | LOCATOR | RESOLUTION | DEPENDENT | PACKAGE_EXTENSION | SETTING | MARKDOWN | MARKDOWN_INLINE>[] | {}) => void): Promise<void>
    • Called by yarn info. The extra field is the set of parameters passed to the -X,--extra flag. Calling registerData will add a new set of data that will be added to the package information.

      For instance, an "audit" plugin could check in extra whether the user requested audit information (via -X audit), and call registerData with those information (retrieved dynamically) if they did.


      Parameters

      • pkg: Package
      • extra: Set<string>
      • registerData: (namespace: string, data: Tuple<NO_HINT | ID | NULL | SCOPE | NAME | RANGE | REFERENCE | NUMBER | PATH | URL | ADDED | REMOVED | CODE | INSPECT | DURATION | SIZE | SIZE_DIFF | IDENT | DESCRIPTOR | LOCATOR | RESOLUTION | DEPENDENT | PACKAGE_EXTENSION | SETTING | MARKDOWN | MARKDOWN_INLINE>[] | {}) => void

      Returns Promise<void>