Skip to content

Commit 491bf63

Browse files
committed
refactor(@maz-ui/node): choose log level of execPromise
1 parent f67ddc6 commit 491bf63

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

packages/changelogen-monorepo/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Changelogen adapter for monorepo management with selective, unified and independ
2020
- 🎨 Optional changelog formatting with custom commands
2121
- ⚙️ Optional Lerna integration (updates `lerna.json` if present)
2222

23+
## Warning
24+
25+
The independent mode has not been fully tested, some edge cases may not be handled correctly. Use it with caution and before running the release flow with `--dry-run` to see what will happen.
26+
2327
## Installation
2428

2529
```bash
@@ -455,7 +459,7 @@ The tool automatically detects and bumps packages that depend on other packages
455459

456460
**Example Scenario:**
457461

458-
```
462+
```bash
459463
Packages:
460464
- @maz-ui/utils@1.0.0
461465
- @maz-ui/components@2.0.0 (depends on @maz-ui/utils)
@@ -500,7 +504,7 @@ export default defineConfig({
500504

501505
**Behavior example:**
502506

503-
```txt
507+
```bash
504508
Commits:
505509
- feat(ui): add button component → ui has commits
506510
- fix(utils): fix date parser → utils has commits

packages/changelogen-monorepo/src/commands/publish.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function publish(options: PublishOptions) {
3636
const patterns = options.packages ?? config.publish.packages ?? config.monorepo.packages
3737
logger.debug(`Package patterns: ${patterns.join(', ')}`)
3838

39-
const packages = getPackages({
39+
const packages = options.bumpedPackages || getPackages({
4040
cwd: config.cwd,
4141
patterns,
4242
ignorePackageNames: config.monorepo.ignorePackageNames,
@@ -49,7 +49,7 @@ export async function publish(options: PublishOptions) {
4949
const packagesWithDeps = getPackagesWithDependencies(packages)
5050
const sortedPackages = topologicalSort(packagesWithDeps)
5151

52-
let publishedPackages: PackageInfo[] = options.bumpedPackages || []
52+
let publishedPackages: PackageInfo[] = packages || []
5353

5454
if (publishedPackages.length === 0 && config.monorepo.versionMode === 'independent') {
5555
logger.debug('Determining packages to publish in independent mode...')

packages/node/src/execPromise.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ export async function execPromise(
1818
noSuccess = false,
1919
noStdout = false,
2020
noStderr = false,
21-
silent = false,
2221
logLevel = 'default',
2322
}: {
2423
logger?: CustomLogger
2524
packageName?: string
2625
noSuccess?: boolean
2726
noStdout?: boolean
2827
noStderr?: boolean
29-
silent?: boolean
3028
logLevel?: LogLevel
3129
} = {},
3230
): Promise<{ stdout: string, stderr: string }> {
@@ -40,14 +38,19 @@ export async function execPromise(
4038
return await new Promise((resolve, reject) => {
4139
// eslint-disable-next-line sonarjs/os-command
4240
exec(command, (error, stdout, stderr) => {
43-
internalLogger.debug(`${command} stdout output:`, stdout)
44-
internalLogger.debug(`${command} stderr output:`, stderr)
41+
if (stdout) {
42+
internalLogger.debug(`${command} - stdout output:`, stdout)
43+
}
44+
45+
if (stderr) {
46+
internalLogger.debug(`${command} - stderr output:`, stderr)
47+
}
4548

46-
if (stdout && !noStdout && !silent) {
49+
if (stdout && !noStdout) {
4750
internalLogger.log(`${packageNameStr}stdout -`, stdout.trim())
4851
}
4952

50-
if (stderr && !noStderr && !silent) {
53+
if (stderr && !noStderr) {
5154
internalLogger.log(`${packageNameStr}stderr -`, stderr.trim())
5255
}
5356

@@ -56,8 +59,8 @@ export async function execPromise(
5659
reject(error)
5760
}
5861
else {
59-
if (!noSuccess && !silent) {
60-
internalLogger.info(`${packageNameStr}${command} success`)
62+
if (!noSuccess) {
63+
internalLogger.info(`${packageNameStr}${command} - Success!`)
6164
}
6265
resolve({ stdout, stderr })
6366
}

0 commit comments

Comments
 (0)