From bc25d3a4840faa34e4e1e6cae9e7709359ed05db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20Rold=C3=A1n?= Date: Wed, 1 Apr 2026 12:41:53 +0200 Subject: [PATCH] fix: route include-assets debug logs through verbose output Co-authored-by: Claude Code --- packages/app/src/cli/services/build/client-steps.test.ts | 8 -------- packages/app/src/cli/services/build/client-steps.ts | 1 - .../cli/services/build/steps/include-assets-step.test.ts | 1 - .../steps/include-assets/copy-config-key-entry.test.ts | 8 ++------ .../build/steps/include-assets/copy-config-key-entry.ts | 3 ++- .../build/steps/include-assets/generate-manifest.ts | 3 ++- 6 files changed, 6 insertions(+), 18 deletions(-) diff --git a/packages/app/src/cli/services/build/client-steps.test.ts b/packages/app/src/cli/services/build/client-steps.test.ts index ec7b4f9c671..e3227330e7a 100644 --- a/packages/app/src/cli/services/build/client-steps.test.ts +++ b/packages/app/src/cli/services/build/client-steps.test.ts @@ -41,14 +41,6 @@ describe('executeStep', () => { if (result.success) expect(result.output).toEqual({filesCopied: 3}) expect(result.duration).toBeGreaterThanOrEqual(0) }) - - test('logs step execution to stdout', async () => { - vi.mocked(stepsIndex.executeStepByType).mockResolvedValue({}) - - await executeStep(step, mockContext) - - expect(mockContext.options.stdout.write).toHaveBeenCalledWith('Executing step: Test Step\n') - }) }) describe('failure', () => { diff --git a/packages/app/src/cli/services/build/client-steps.ts b/packages/app/src/cli/services/build/client-steps.ts index 94fedfaf31c..67ac6535090 100644 --- a/packages/app/src/cli/services/build/client-steps.ts +++ b/packages/app/src/cli/services/build/client-steps.ts @@ -88,7 +88,6 @@ export async function executeStep(step: LifecycleStep, context: BuildContext): P const startTime = Date.now() try { - context.options.stdout.write(`Executing step: ${step.name}\n`) const output = await executeStepByType(step, context) return { diff --git a/packages/app/src/cli/services/build/steps/include-assets-step.test.ts b/packages/app/src/cli/services/build/steps/include-assets-step.test.ts index da019d8d22a..6429801a725 100644 --- a/packages/app/src/cli/services/build/steps/include-assets-step.test.ts +++ b/packages/app/src/cli/services/build/steps/include-assets-step.test.ts @@ -257,7 +257,6 @@ describe('executeIncludeAssetsStep', () => { // Then — no error, no copies expect(result.filesCopied).toBe(0) expect(fs.copyDirectoryContents).not.toHaveBeenCalled() - expect(mockStdout.write).toHaveBeenCalledWith(expect.stringContaining("No value for configKey 'static_root'")) }) test('skips path that does not exist on disk but logs a warning', async () => { diff --git a/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.test.ts b/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.test.ts index 340788450ea..f58cd750f7d 100644 --- a/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.test.ts +++ b/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.test.ts @@ -87,7 +87,7 @@ describe('copyConfigKeyEntry', () => { }) }) - test('skips with log message when configKey is absent from configuration', async () => { + test('skips when configKey is absent from configuration', async () => { await inTemporaryDirectory(async (tmpDir) => { const outDir = joinPath(tmpDir, 'out') await mkdir(outDir) @@ -100,7 +100,6 @@ describe('copyConfigKeyEntry', () => { expect(result.filesCopied).toBe(0) expect(result.pathMap.size).toBe(0) - expect(mockStdout.write).toHaveBeenCalledWith("No value for configKey 'static_root', skipping\n") }) }) @@ -199,7 +198,7 @@ describe('copyConfigKeyEntry', () => { }) }) - test('skips with no-value log when [] flatten resolves to a non-array (contract violated)', async () => { + test('skips when [] flatten resolves to a non-array (contract violated)', async () => { await inTemporaryDirectory(async (tmpDir) => { const outDir = joinPath(tmpDir, 'out') await mkdir(outDir) @@ -215,9 +214,6 @@ describe('copyConfigKeyEntry', () => { expect(result.filesCopied).toBe(0) expect(result.pathMap.size).toBe(0) - expect(mockStdout.write).toHaveBeenCalledWith( - expect.stringContaining("No value for configKey 'extensions[].targeting[].schema'"), - ) }) }) diff --git a/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.ts b/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.ts index 9c07fe97996..f178384dcd3 100644 --- a/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.ts +++ b/packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.ts @@ -1,5 +1,6 @@ import {joinPath, basename, relativePath, extname} from '@shopify/cli-kit/node/path' import {glob, copyFile, copyDirectoryContents, fileExists, mkdir, isDirectory} from '@shopify/cli-kit/node/fs' +import {outputDebug} from '@shopify/cli-kit/node/output' import type {BuildContext} from '../../client-steps.js' /** @@ -41,7 +42,7 @@ export async function copyConfigKeyEntry( } if (paths.length === 0) { - options.stdout.write(`No value for configKey '${key}', skipping\n`) + outputDebug(`No value for configKey '${key}', skipping\n`, context.options.stdout) return {filesCopied: 0, pathMap: new Map()} } diff --git a/packages/app/src/cli/services/build/steps/include-assets/generate-manifest.ts b/packages/app/src/cli/services/build/steps/include-assets/generate-manifest.ts index 9aad570ee99..c39cc8b9529 100644 --- a/packages/app/src/cli/services/build/steps/include-assets/generate-manifest.ts +++ b/packages/app/src/cli/services/build/steps/include-assets/generate-manifest.ts @@ -1,6 +1,7 @@ import {getNestedValue, tokenizePath} from './copy-config-key-entry.js' import {joinPath} from '@shopify/cli-kit/node/path' import {fileExists, mkdir, writeFile} from '@shopify/cli-kit/node/fs' +import {outputDebug} from '@shopify/cli-kit/node/output' import type {BuildContext} from '../../client-steps.js' interface ConfigKeyManifestEntry { @@ -120,7 +121,7 @@ export async function generateManifestFile( } await mkdir(outputDir) await writeFile(manifestPath, JSON.stringify(manifest, null, 2)) - options.stdout.write(`Generated manifest.json in ${outputDir}\n`) + outputDebug(`Generated manifest.json in ${outputDir}\n`, options.stdout) } /**