Skip to content
Mopsgamer edited this page Aug 23, 2026 · 2 revisions

Yarn Target (Yarn Berry v2+)

The makeYarn() target emulates the workspace packaging behavior of modern Yarn (Berry v2+).

Source Code & Reference Links

Original Algorithm & CLI Logic

Modern Yarn uses @yarnpkg/plugin-pack to package workspaces:

  • Applies case-insensitive matching rules to package manifests and standard documentation (README*, LICENSE*, CHANGELOG*).
  • Extracts ignore lists from .npmignore and fallback .gitignore files.
  • Prevents packaging of Yarn workspace metadata (such as .yarnrc.yml, .yarn, output .tgz files, and .pnpm-store).
  • Respects files field when present in package.json.

How view-ignored Emulates Yarn

  • Maps Berry's exact exclude and include lists.
  • Parses entry fields (main, module, bin, browser).
  • Performs case-insensitive rule extraction across local ignore manifests.

Verification CLI Command

To verify view-ignored results against Yarn Berry:

yarn pack --dry-run

Diagnostic CLI command:

vign-diff yarn

Usage Example

import * as vign from "view-ignored"
import { makeYarn } from "view-ignored/targets"

const ctx = await vign.scan({
	target: makeYarn(),
})

console.log(ctx.paths.has(".yarnrc.yml")) // false (ignored)
console.log(ctx.paths.has("package.json")) // true

Related Wiki Pages

Clone this wiki locally