lerna
БесплатноБез исполняемых скриптовНе проверенBest practices for Lerna monorepo management, versioning, and publishing
от Mindrally★ 323 звезды на GitHubОб этом скилле
Lerna Monorepo Development
You are an expert in Lerna, the fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages.
Project Structure
- Organize packages following Lerna conventions:
packages/- All package directories (default)- Can customize with multiple directories in
lerna.json
- Each package should be self-contained with its own:
package.json- Source code
- Tests
- Build configuration
Lerna Configuration
Configure lerna.json at the root:
{
"$schema": "https://json.schemastore.org/lerna.json",
"version": "independent",
"npmClient": "npm",
"packages": ["packages/*"],
"useWorkspaces": true
}
- Choose versioning mode:
"version": "independent"- Each package versioned separately"version": "1.0.0"- Fixed/locked mode, all packages same version
- Enable workspaces integration with
useWorkspaces: true
Workspaces Integration
Configure npm/yarn/pnpm workspaces in root package.json:
{
"workspaces": ["packages/*"],
"private": true
}
- Let the package manager handle hoisting and linking
- Use Lerna for versioning, publishing, and running scripts
Task Execution
- Run scripts across packages:
lerna run build- Run build in all packageslerna run test --scope=@org/package- Run in specific packagelerna run lint --since main- Run only in changed packages
- Use
--streamfor real-time output - Use
--parallelfor concurrent execution
Versioning Workflow
- Update versions with
lerna version:lerna version patch- Bump patch versionlerna version minor- Bump minor versionlerna version major- Bump major versionlerna version- Interactive version selection
- Lerna automatically:
- Updates package.json versions
- Updates internal dependency versions
- Creates git tags
- Pushes to remote
Publishing Packages
- Publish with
lerna publish:lerna publish- Publish packages changed since last releaselerna publish from-git- Publish packages tagged in gitlerna publish from-package- Publish packages with unpublished versions
- Configure npm registry in
.npmrcorlerna.json - Use
--dist-tagfor pre-release versions
Change Detection
- Use
--sinceflag for changed packages:lerna run test --since mainlerna changed- List packages changed since last taglerna diff- Show diff since last release
- Leverage affected commands in CI for efficiency
Conventional Commits
Enable conventional commits for automated versioning:
{
"command": {
"version": {
"conventionalCommits": true,
"message": "chore(release): publish"
}
}
}
- Commits determine version bumps:
fix:- Patch versionfeat:- Minor versionBREAKING CHANGE:- Major version
- Automatic changelog generation
Dependency Management
- Use internal package references:
{ "dependencies": { "@org/shared-utils": "^1.0.0" } } - Lerna keeps internal dependencies in sync during versioning
- Hoist common dependencies to root with workspaces
CI/CD Integration
- Install dependencies once at root level
- Use
lerna runwith--sincefor efficient CI - Publish from CI with proper npm authentication
- Use
--yesflag for non-interactive publishing
Best Practices
- Keep packages focused and single-purpose
- Use consistent package naming:
@org/package-name - Maintain clear dependency boundaries between packages
- Document package APIs and usage
- Use TypeScript with project references for type checking
- Implement proper testing at package and integration levels
- Consider Nx integration for advanced caching and task execution
Установить lerna в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл lerna?
Best practices for Lerna monorepo management, versioning, and publishing
Как установить скилл lerna?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lerna запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic