CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-yarn

Fast, reliable, and secure dependency management tool for JavaScript/Node.js projects

Overview
Eval results
Files

information-commands.mddocs/

Information Commands

Commands for inspecting packages, dependencies, and project status to understand your project's dependency tree and package details.

Capabilities

Package Information

Show detailed information about packages from the registry.

yarn info <package> [field] [options]

# Options:
--json                   # Output in JSON format
--registry <url>         # Use specific registry

Usage Examples:

# Show all package information
yarn info react

# Show specific field
yarn info react version
yarn info react description
yarn info react dependencies
yarn info react peerDependencies

# Show information in JSON format
yarn info react --json

# Show information from specific registry
yarn info react --registry https://registry.npmjs.org

# Show information for scoped package
yarn info @types/react

# Show information for specific version
yarn info react@17.0.2

Available Fields:

  • name - Package name
  • version - Latest version
  • description - Package description
  • keywords - Package keywords
  • homepage - Homepage URL
  • repository - Repository information
  • author - Author information
  • license - License information
  • dependencies - Production dependencies
  • devDependencies - Development dependencies
  • peerDependencies - Peer dependencies
  • engines - Node.js/npm version requirements
  • scripts - Available scripts
  • dist - Distribution information
  • maintainers - Package maintainers

List Installed Packages

Display the dependency tree of installed packages.

yarn list [pattern] [options]

# Options:
--depth <number>         # Limit dependency depth (default: all levels)
--pattern <pattern>      # Filter packages by pattern
--json                  # Output in JSON format

Usage Examples:

# List all dependencies
yarn list

# List with limited depth
yarn list --depth=0      # Only direct dependencies
yarn list --depth=1      # Direct + one level deep

# Filter by pattern
yarn list --pattern "react*"
yarn list --pattern "@types/*"

# List in JSON format
yarn list --json

# List specific package and its dependencies
yarn list react

Output Format:

├─ package-a@1.0.0
│  ├─ dependency-1@2.0.0
│  └─ dependency-2@3.0.0
├─ package-b@2.0.0
└─ package-c@1.5.0
   └─ shared-dep@1.0.0

Why Package is Installed

Explain why a package is installed and show the dependency chain.

yarn why <package>

Usage Examples:

# Show why package is installed
yarn why lodash

# Show why specific version is installed
yarn why lodash@4.17.21

# Show why scoped package is installed
yarn why @babel/core

Output Example:

info Reasons this module exists
   - "eslint-config-airbnb" depends on it
   - Hoisted from "eslint-config-airbnb#lodash"
   - "webpack#uglifyjs-webpack-plugin" depends on it
   - Hoisted from "webpack#uglifyjs-webpack-plugin#lodash"

Show Outdated Packages

Display packages that have newer versions available.

yarn outdated [package] [options]

# Options:
--json                   # Output in JSON format

Usage Examples:

# Show all outdated packages
yarn outdated

# Check specific package
yarn outdated react

# Output in JSON format
yarn outdated --json

Output Format:

Package    Current  Wanted  Latest  Package Type
react      16.8.0   16.14.0 18.2.0  dependencies
@types/node 14.18.0  14.18.63 20.5.0  devDependencies
  • Current: Currently installed version
  • Wanted: Latest version matching semver range in package.json
  • Latest: Latest version available (may be outside semver range)

License Information

Show license information for installed packages.

yarn licenses list              # List all licenses
yarn licenses generate-disclaimer  # Generate license disclaimer text

Usage Examples:

# List all package licenses
yarn licenses list

# Generate disclaimer text for legal compliance
yarn licenses generate-disclaimer > LICENSES.txt

List Output:

├─ MIT
│  ├─ react@18.2.0
│  ├─ lodash@4.17.21
│  └─ express@4.18.2
├─ Apache-2.0
│  └─ @babel/core@7.22.0
└─ BSD-3-Clause
   └─ qs@6.11.0

Binary Locations

Show the location of package binaries.

yarn bin [package]

Usage Examples:

# Show bin directory path
yarn bin

# Show path to specific binary
yarn bin eslint
yarn bin @babel/cli

# Common usage in scripts
export PATH="$(yarn bin):$PATH"

Output:

  • Without package name: Shows the .bin directory path
  • With package name: Shows full path to the specific binary

Advanced Information Queries

Dependency Analysis

# Show dependency tree for specific package
yarn list --pattern "react*" --depth=2

# Find all packages depending on a specific package
yarn why lodash | grep "depends on it"

# Check for duplicate dependencies
yarn list --pattern "*" | grep -E "^\s+├─|^\s+└─" | sort | uniq -d

Version Range Analysis

# Check what version would be installed
yarn info react@^17.0.0 version

# Compare current vs available versions
yarn outdated | grep "^react "

# Check if package satisfies semver range
yarn info react versions --json | jq '.data[] | select(test("^17\\."))'

Registry Information

# Check package from different registry
yarn info react --registry https://registry.npmjs.org

# Show package download statistics (if supported by registry)
yarn info react dist

# Show package maintainers
yarn info react maintainers

Workspace Information

# List packages in workspace
yarn workspaces info

# Show workspace dependency tree
yarn workspaces info --json

# Check why package is installed in workspace context
yarn workspace my-package why lodash

JSON Output Format

Most information commands support --json flag for programmatic usage:

# Package info as JSON
yarn info react --json | jq '.data.version'

# List as JSON
yarn list --json | jq '.data.trees[].name'

# Outdated as JSON
yarn outdated --json | jq '.data.body[] | select(.current != .latest)'

# Workspaces as JSON
yarn workspaces info --json | jq 'keys[]'

Integration with Package Managers

CI/CD Integration

# Check for security vulnerabilities
yarn audit --json | jq '.data.vulnerabilities'

# Verify no packages are outdated in CI
yarn outdated --json | jq '.data.body | length' | xargs test 0 -eq

# Generate license report for compliance
yarn licenses generate-disclaimer > build/THIRD_PARTY_LICENSES.txt

Development Workflow

# Quick dependency health check  
yarn outdated && yarn audit

# Show package sizes (with additional tooling)
yarn list --json | jq -r '.data.trees[] | "\(.name)@\(.version)"' | xargs npm-check-size

# Find unused dependencies (with additional tooling)
npx depcheck --ignore-patterns="build/**"

Install with Tessl CLI

npx tessl i tessl/npm-yarn

docs

cache-management.md

configuration.md

index.md

information-commands.md

package-management.md

project-management.md

registry-operations.md

utility-commands.md

workspace-management.md

tile.json