Back to list
mcclowes

npm-workspaces

by mcclowes

OAS Markdown Grammar is a human-first domain-specific language for API specification

1🍴 0📅 Jan 12, 2026

SKILL.md


name: npm-workspaces

prettier-ignore

description: Use when managing npm workspaces monorepos - package dependencies, build ordering, cross-package development, and publishing workflows

npm Workspaces

Quick Start

// Root package.json
{
  "name": "my-monorepo",
  "private": true,
  "workspaces": ["packages/*"],
  "scripts": {
    "build": "npm run build --workspaces",
    "test": "npm run test --workspaces"
  }
}

Core Commands

CommandPurpose
npm installInstall all workspace deps
npm run build --workspacesRun in all workspaces
npm run build -w pkg-nameRun in specific workspace
npm run build --if-presentSkip if script missing

Cross-Package Dependencies

// packages/compiler/package.json
{
  "name": "my-compiler",
  "dependencies": {
    "my-parser": "^1.0.0"  // Reference sibling package
  }
}
  • Use semver (not file:) for publishable packages
  • npm symlinks local packages automatically
  • Build order matters: dependencies before dependents

Build Ordering

// Root package.json - explicit order
{
  "scripts": {
    "build": "npm run build -w my-parser && npm run build -w my-compiler && npm run build -w my-cli"
  }
}

Or use a tool like wireit or turbo for dependency-aware builds.

Publishing

# Update versions (from root)
npm version patch -w my-parser
npm version patch -w my-compiler

# Publish all
npm publish --workspaces

# Publish specific
npm publish -w my-parser

Tips

  • Use "private": true in root to prevent accidental publish
  • Run npm ls to verify dependency resolution
  • Use npm explain <pkg> to debug why a package is installed
  • Add engines field to enforce Node version
  • Use --include-workspace-root to also run in root

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon