@balazsorban/monorepo-release
Advanced tools
Comparing version 0.2.4 to 0.3.0
@@ -9,2 +9,3 @@ import { bold } from "yoctocolors"; | ||
import { getDependentsGraph } from "@changesets/get-dependents-graph"; | ||
import { exit } from "./index.js"; | ||
export async function analyze(config) { | ||
@@ -44,7 +45,7 @@ const { BREAKING_COMMIT_MSG, RELEASE_COMMIT_MSG, RELEASE_COMMIT_TYPES } = config; | ||
log.info(commitsSinceLatestTag.length, pluralize("commit", commitsSinceLatestTag), `found since \`${bold(latestTag)}\``); | ||
log.debug("Analyzing the following commits:", commitsSinceLatestTag.map((c) => ` ${c.subject}`).join("\n")); | ||
log.debug("Analyzing the following commits:", ...commitsSinceLatestTag.map((c) => ` ${c.subject}`)); | ||
const lastCommit = commitsSinceLatestTag[0]; | ||
if (lastCommit?.parsed.raw === RELEASE_COMMIT_MSG) { | ||
log.debug("Already released."); | ||
process.exit(0); | ||
exit(); | ||
} | ||
@@ -119,3 +120,3 @@ log.debug("Identifying commits that modified package code."); | ||
log.info("No need to release, exiting."); | ||
process.exit(0); | ||
exit(); | ||
} | ||
@@ -142,3 +143,8 @@ const packagesToRelease = new Map(); | ||
} | ||
return Array.from(packagesToRelease.values()); | ||
const result = Array.from(packagesToRelease.values()); | ||
if (config.peek) { | ||
log.peekInfo("Following packages can be released:\n", ...result.map((p) => ` - ${bold(p.name)}: ${p.oldVersion} -> ${p.newVersion}`)); | ||
exit(); | ||
} | ||
return result; | ||
} | ||
@@ -145,0 +151,0 @@ function addToPackagesToRelease(packageList, pkgName, releaseType, packagesToRelease, commits) { |
@@ -9,3 +9,4 @@ export interface Config { | ||
verbose: boolean; | ||
peek: boolean; | ||
} | ||
export declare const defaultConfig: Config; |
@@ -13,3 +13,4 @@ import { pkgJson } from "./utils.js"; | ||
verbose: !!process.env.VERBOSE || process.argv.includes("--verbose"), | ||
peek: !!process.env.PEEK || process.argv.includes("--peek"), | ||
...json.release, | ||
}; |
@@ -1,1 +0,1 @@ | ||
export {}; | ||
export declare function exit(): void; |
@@ -6,16 +6,21 @@ import { defaultConfig } from "./config.js"; | ||
import { log } from "./utils.js"; | ||
import { bold, green } from "yoctocolors"; | ||
import { bold } from "yoctocolors"; | ||
const userConfig = {}; // TODO: Allow user config | ||
const config = { ...defaultConfig, ...userConfig }; | ||
console.time(green(bold("Done"))); | ||
const endMsg = bold("Done"); | ||
console.time(endMsg); | ||
export function exit() { | ||
console.log(); | ||
console.timeEnd(endMsg); | ||
process.exit(0); | ||
} | ||
if (config.dryRun) { | ||
log.info(bold(green("Performing dry run, no packages will be released!\n"))); | ||
log.peekInfo(bold("Performing dry run, no packages will be released!\n")); | ||
} | ||
else { | ||
log.info(bold(green("Let's release some packages!\n"))); | ||
log.info(bold("Let's release some packages!\n")); | ||
} | ||
log.debug("Configuration:", JSON.stringify(config, null, 2)); | ||
if (shouldSkip({ releaseBranches: config.releaseBranches })) { | ||
process.exit(0); | ||
} | ||
if (shouldSkip({ releaseBranches: config.releaseBranches })) | ||
exit(); | ||
if (config.dryRun) { | ||
@@ -22,0 +27,0 @@ log.debug("Dry run, skipping token validation..."); |
@@ -1,3 +0,4 @@ | ||
import { bold, green } from "yoctocolors"; | ||
import { bold } from "yoctocolors"; | ||
import { log, pkgJson, execSync } from "./utils.js"; | ||
import { exit } from "./index.js"; | ||
/** Make sure that packages that depend on other packages are released last. */ | ||
@@ -68,3 +69,3 @@ async function sortByDependency(pkgs) { | ||
} | ||
console.timeEnd(green(bold("Done"))); | ||
exit(); | ||
} | ||
@@ -71,0 +72,0 @@ function createChangelog(pkg) { |
@@ -17,2 +17,4 @@ /// <reference types="node" resolution-mode="require"/> | ||
info(...args: any[]): void; | ||
/** Runs even if `config.peek` is set */ | ||
peekInfo(...args: any[]): void; | ||
error(error: Error): void; | ||
@@ -19,0 +21,0 @@ }; |
@@ -27,4 +27,10 @@ import { gray, blue, red, magenta, bold } from "yoctocolors"; | ||
info(...args) { | ||
if (defaultConfig.peek) | ||
return; | ||
console.log(blue("[info]"), ...purpleNumber(args)); | ||
}, | ||
/** Runs even if `config.peek` is set */ | ||
peekInfo(...args) { | ||
console.log(args.join("\n")); | ||
}, | ||
error(error) { | ||
@@ -31,0 +37,0 @@ console.error(red("\n[error]"), error, "\n"); |
{ | ||
"name": "@balazsorban/monorepo-release", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"description": "Similar to `semantic-release`, but for monorepos.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/balazsorban44/monorepo-release", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
21130
515
10