executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
lernaBest practices for Lerna monorepo management, versioning, and publishing
Independent GitHub snapshot · Automated classification · Original documentation governs
You are an expert in Lerna, the fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages.
packages/ - All package directories (default)lerna.jsonpackage.jsonConfigure lerna.json at the root:
{
"$schema": "https://json.schemastore.org/lerna.json",
"version": "independent",
"npmClient": "npm",
"packages": ["packages/*"],
"useWorkspaces": true
}
"version": "independent" - Each package versioned separately"version": "1.0.0" - Fixed/locked mode, all packages same versionuseWorkspaces: trueConfigure npm/yarn/pnpm workspaces in root package.json:
{
"workspaces": ["packages/*"],
"private": true
}
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--stream for real-time output--parallel for concurrent executionlerna version:
lerna version patch - Bump patch versionlerna version minor - Bump minor versionlerna version major - Bump major versionlerna version - Interactive version selectionlerna 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.npmrc or lerna.json--dist-tag for pre-release versions--since flag for changed packages:
lerna run test --since mainlerna changed - List packages changed since last taglerna diff - Show diff since last releaseEnable conventional commits for automated versioning:
{
"command": {
"version": {
"conventionalCommits": true,
"message": "chore(release): publish"
}
}
}
fix: - Patch versionfeat: - Minor versionBREAKING CHANGE: - Major version{
"dependencies": {
"@org/shared-utils": "^1.0.0"
}
}
lerna run with --since for efficient CI--yes flag for non-interactive publishing@org/package-name