Skip to content

Unlink Packages

This document provides instructions on how to remove links between packages in the monorepo.

By using the detach command, you can unlink packages in the monorepo. This command will remove the specified packages from the dependencies, devDependencies, peerDependencies, or optionalDependencies field in the package.json file of the target package.

Command

Use the following commands to unlink packages:

bash
monopkg detach <packages...> [options]
bash
bun x monopkg detach <packages...> [options]
bash
npx monopkg detach <packages...> [options]
bash
yarn dlx monopkg detach <packages...> [options]

Options

  • -w, --workspace - Root workspace of the packages.
  • -f, --filter - Include specific packages.
  • -e, --exclude - Exclude specific packages.

Examples

Unlink ui package from the web package.

bash
monopkg detach ui -f web
bash
bun x monopkg detach ui -f web
bash
npx monopkg detach ui -f web
bash
yarn dlx monopkg detach ui -f web

Output

The updated package.json file of the web package will look like this:

json
{
  "devDependencies": {
    "eslint": "^7.32.0",
    "ui": "workspace:*"
  }
}

Released under the MIT License.