Skip to content

Commit ae899b1

Browse files
committed
Show notice when --verbose and --concurrency > 1
1 parent 5ec9381 commit ae899b1

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

packages/ferric/src/build.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ const verboseOption = new Option(
134134
"Print more output from underlying compiler & tools",
135135
).default(process.env.CI ? true : false, `false in general and true on CI`);
136136

137+
function logNotice(message: string, ...params: string[]) {
138+
console.log(`${chalk.yellow("ℹ︎")} ${message}`, ...params);
139+
}
140+
137141
export const buildCommand = new Command("build")
138142
.description("Build Rust Node-API module")
139143
.addOption(targetOption)
@@ -168,13 +172,16 @@ export const buildCommand = new Command("build")
168172
{
169173
text: "Cleaning target directory",
170174
successText: "Cleaned target directory",
171-
failText: (error) =>
172-
`Failed to cleaning target directory: ${error}`,
175+
failText: (error) => `Failed to clean target directory: ${error}`,
173176
},
174177
);
175178
}
176-
// Force a limit of 1 concurrent task to avoid interleaving output
177-
const limit = pLimit(verbose ? 1 : concurrency);
179+
if (verbose && concurrency > 1) {
180+
logNotice(
181+
`Consider passing ${chalk.blue("--concurrency")} 1 when running in verbose mode`,
182+
);
183+
}
184+
const limit = pLimit(concurrency);
178185
const targets = new Set([...targetArg]);
179186
if (apple) {
180187
for (const target of APPLE_TARGETS) {
@@ -200,15 +207,12 @@ export const buildCommand = new Command("build")
200207
targets.add("aarch64-apple-ios-sim");
201208
}
202209
}
203-
console.error(
204-
chalk.yellowBright("ℹ"),
205-
chalk.dim(
206-
`Using default targets, pass ${chalk.italic(
207-
"--android",
208-
)}, ${chalk.italic("--apple")} or individual ${chalk.italic(
209-
"--target",
210-
)} options, to avoid this.`,
211-
),
210+
logNotice(
211+
`Using default targets, pass ${chalk.blue(
212+
"--android",
213+
)}, ${chalk.blue("--apple")} or individual ${chalk.blue(
214+
"--target",
215+
)} options, choose exactly what to target`,
212216
);
213217
}
214218
ensureCargo();

0 commit comments

Comments
 (0)