UNPKG

lerna

Version:

Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository

78 lines (76 loc) 3.06 kB
import "../../chunk-MLKGABMK.js"; // packages/lerna/src/migrations/update-options-from-legacy-deprecate-config/update-options-from-legacy-deprecate-config.ts import { formatFiles, readJson, writeJson } from "@nx/devkit"; async function generator(tree) { const lernaJson = readJson(tree, "lerna.json"); if (lernaJson.commands) { lernaJson.command = { ...lernaJson.commands, // Prefer already correctly named config when merging ...lernaJson.command }; delete lernaJson.commands; } updateIncludeFilteredDependencies(lernaJson); updateIncludeFilteredDependents(lernaJson); updateGithubRelease(lernaJson); updateLegacyVersionOptions(lernaJson); writeJson(tree, "lerna.json", lernaJson); await formatFiles(tree); } function updateIncludeFilteredDependencies(json) { const commandsToCheck = ["add", "bootstrap", "clean", "list", "run", "exec"]; for (const command of commandsToCheck) { if (json.command?.[command]?.["includeFilteredDependencies"] !== void 0) { json.command[command]["includeDependencies"] = json.command?.[command]?.["includeFilteredDependencies"]; delete json.command[command]["includeFilteredDependencies"]; } } } function updateIncludeFilteredDependents(json) { const commandsToCheck = ["add", "bootstrap", "clean", "list", "run", "exec"]; for (const command of commandsToCheck) { if (json.command?.[command]?.["includeFilteredDependents"] !== void 0) { json.command[command]["includeDependents"] = json.command?.[command]?.["includeFilteredDependents"]; delete json.command[command]["includeFilteredDependents"]; } } } function updateGithubRelease(json) { const commandsToCheck = ["version", "publish"]; for (const command of commandsToCheck) { if (json.command?.[command]?.["githubRelease"] === true) { json.command[command]["createRelease"] = "github"; } delete json.command?.[command]?.["githubRelease"]; } } function updateLegacyVersionOptions(json) { const commandsToCheck = ["version", "publish"]; for (const command of commandsToCheck) { if (json.command?.[command]?.["skipGit"] === true) { json.command[command]["push"] = false; json.command[command]["gitTagVersion"] = false; } delete json.command?.[command]?.["skipGit"]; if (json.command?.[command]?.["repoVersion"]) { json.command[command]["bump"] = json.command[command]["repoVersion"]; } delete json.command?.[command]?.["repoVersion"]; if (json.command?.[command]?.["cdVersion"]) { json.command[command]["bump"] = json.command[command]["cdVersion"]; } delete json.command?.[command]?.["cdVersion"]; if (json.command?.[command]?.["npmTag"]) { json.command[command]["distTag"] = json.command[command]["npmTag"]; } delete json.command?.[command]?.["npmTag"]; if (json.command?.[command]?.["ignore"]) { json.command[command]["ignoreChanges"] = json.command[command]["ignore"]; } delete json.command?.[command]?.["ignore"]; } } export { generator as default };