Skip to content

Commit 03890ae

Browse files
committed
refactor(script): clearer logging
1 parent 8b2c0e8 commit 03890ae

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

scripts/package_automation.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ async function getPackageVersion(ctx: Context): Promise<Result<string>> {
379379
/** Helper to manage build process with tracking */
380380
async function executeBuild(
381381
ctx: Context,
382+
actionName: string,
382383
buildPath: string,
383384
options: { tag?: string } = {},
384385
): Promise<Result<void>> {
@@ -393,7 +394,7 @@ async function executeBuild(
393394
}
394395

395396
log(
396-
`[build] ${buildPath}: ${processId}${options.tag ? ` (tag: ${options.tag})` : ""}`,
397+
`[${actionName}] ${buildPath}: ${processId}${options.tag ? ` (tag: ${options.tag})` : ""}`,
397398
);
398399
await ctx.tangram.processOutput(processId);
399400
return { ok: true, value: undefined };
@@ -462,14 +463,12 @@ async function buildAction(ctx: Context): Promise<Result<string[]>> {
462463
const exportSuffix = exportName !== "default" ? `#${exportName}` : "";
463464
const buildPath = `${ctx.packagePath}${exportSuffix}`;
464465

465-
log(`[build] ${buildPath}`);
466-
467466
if (ctx.dryRun) {
468467
built.push(buildPath);
469468
continue;
470469
}
471470

472-
const result = await executeBuild(ctx, buildPath);
471+
const result = await executeBuild(ctx, "build", buildPath);
473472
if (!result.ok) {
474473
return result as Result<string[]>;
475474
}
@@ -533,9 +532,7 @@ async function releaseAction(ctx: Context): Promise<Result<string>> {
533532
const tag = buildTag(ctx.packageName, version, exportName, ctx.platform);
534533
const buildSource = `${versionedName}${exportSuffix}`;
535534

536-
log(`[release] tagging ${tag}`);
537-
538-
const result = await executeBuild(ctx, buildSource, { tag });
535+
const result = await executeBuild(ctx, "release", buildSource, { tag });
539536
if (!result.ok) {
540537
return result as Result<string>;
541538
}
@@ -586,13 +583,12 @@ class Results {
586583

587584
async function testAction(ctx: Context): Promise<Result<void>> {
588585
const buildPath = `${ctx.packagePath}#test`;
589-
log(`[test] ${buildPath}`);
590586

591587
if (ctx.dryRun) {
592588
return { ok: true, value: undefined };
593589
}
594590

595-
return await executeBuild(ctx, buildPath);
591+
return await executeBuild(ctx, "test", buildPath);
596592
}
597593

598594
/** Ordered actions - dependencies implicit in order */

0 commit comments

Comments
 (0)