From ae7ca54526f9c339b48b37ef9f888380d67e5c8f Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sat, 6 Apr 2024 15:23:28 +0200 Subject: [PATCH 1/3] framework-tools: warn about missing metafile --- packages/framework-tools/src/buildDefaults.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/framework-tools/src/buildDefaults.ts b/packages/framework-tools/src/buildDefaults.ts index 3f6222a14af5..3644af92e0d4 100644 --- a/packages/framework-tools/src/buildDefaults.ts +++ b/packages/framework-tools/src/buildDefaults.ts @@ -71,7 +71,16 @@ export async function build({ ...buildOptions, }) - await fs.writeJSON(path.join(cwd, metafileName), result.metafile, { - spaces: 2, - }) + if (!result.metafile) { + console.warn( + 'No metafile found in esbuild result\n\n' + + 'This is unexpected and probably means something is wrong with the ' + + 'build\n\n' + + '---\n\n', + ) + } else { + await fs.writeJSON(path.join(cwd, metafileName), result.metafile, { + spaces: 2, + }) + } } From 14f40672ef161ec6ed3ecda9039f1efa09a8a35d Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sat, 6 Apr 2024 16:26:38 +0200 Subject: [PATCH 2/3] flip the if logic --- packages/framework-tools/src/buildDefaults.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/framework-tools/src/buildDefaults.ts b/packages/framework-tools/src/buildDefaults.ts index 3644af92e0d4..867ca3d041cf 100644 --- a/packages/framework-tools/src/buildDefaults.ts +++ b/packages/framework-tools/src/buildDefaults.ts @@ -71,16 +71,16 @@ export async function build({ ...buildOptions, }) - if (!result.metafile) { + if (result.metafile) { + await fs.writeJSON(path.join(cwd, metafileName), result.metafile, { + spaces: 2, + }) + } else { console.warn( - 'No metafile found in esbuild result\n\n' + + 'No metafile found in esbuild result.\n\n' + 'This is unexpected and probably means something is wrong with the ' + - 'build\n\n' + + 'build.\n\n' + '---\n\n', ) - } else { - await fs.writeJSON(path.join(cwd, metafileName), result.metafile, { - spaces: 2, - }) } } From 5731cc7aa3f4af0549e8a4ece6ae3b1721c80a6f Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sat, 6 Apr 2024 17:35:49 +0200 Subject: [PATCH 3/3] tweak output text --- packages/framework-tools/src/buildDefaults.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/framework-tools/src/buildDefaults.ts b/packages/framework-tools/src/buildDefaults.ts index 867ca3d041cf..d292442b6d74 100644 --- a/packages/framework-tools/src/buildDefaults.ts +++ b/packages/framework-tools/src/buildDefaults.ts @@ -76,11 +76,10 @@ export async function build({ spaces: 2, }) } else { + console.warn("No metafile found in esbuild's result.") console.warn( - 'No metafile found in esbuild result.\n\n' + - 'This is unexpected and probably means something is wrong with the ' + - 'build.\n\n' + - '---\n\n', + 'This is unexpected and probably means something is wrong with the ' + + 'build.', ) } }