@metreeca/rack - v0.6.0
    Preparing search index...

    Function ln

    • Links the local checkouts of the dependencies of the package in the current folder into its node_modules.

      Runs on the command line as ush ln [<deps>]....

      The current package, and in a monorepo each of its workspace members, then builds and runs against the working trees of its dependencies instead of their registry releases. Dependencies are matched to checkouts by package name.

      • Deps: each folder searched is either a package or a folder holding packages as direct children; a monorepo found there contributes its workspace members as well, wherever its workspaces patterns place them
      • Selection: links every package named in the dependencies, devDependencies, peerDependencies or optionalDependencies of the current package or its members. Each linked package then brings in the checkouts named in its own dependencies, peerDependencies or optionalDependencies. A package shared along the chain is thus loaded once from its working tree, never also as a registry copy with distinct classes and symbols
      • Copies: installed copies of a linked package nested at any depth in the current package, and in a monorepo in its workspace members, are replaced with links, so that no registry copy is loaded next to the working tree
      • Commands: the bin commands of each linked package are linked into the .bin folder next to it and made executable, so that npm scripts run the working tree version of a command rather than its registry release
      • Precedence: where a name is found in more than one folder, the folder listed first wins
      • Versions: version ranges are ignored, as a working tree may carry a version that is not released yet

      Links replace whatever the current package has installed under the same name, and nothing outside the current package is touched: a linked checkout keeps resolving its own dependencies and peers from its own node_modules, as settled by its own setup, so that an install in one checkout never changes what another project loads, and a checkout shared by several projects serves all of them alike. Projects load a single copy of the packages a linked checkout shares with them through the symlinks hooks of @metreeca/rack/node when running under Node, and through the symlinks plugin of @metreeca/rack/vite when running under Vite or Vitest. Missing folders are skipped, so the same command runs unchanged on every machine, including machines where some of the named folders hold no local checkouts at all and the package runs against its registry dependencies.

      Each package link is printed on stdout relative to the current package, as in ln node_modules/@scope/name; links to bin commands are created silently, since they follow from the package links already listed above.

      Parameters

      • ...deps: readonly string[]

        The folders searched for local dependencies, in order of precedence; defaults to the parent folder (..)

      Returns void

      Linking the sibling checkouts of a package after a clean install, from an npm script:

      npm ci && ush ln
      

      Linking from a folder of local dependencies elsewhere:

      npm ci && ush ln ~/Metreeca/Packages
      

      Error If the current folder holds no package.json

    Index
    usage: string

    The command line synopsis of ln, printed by ush ln --help.