From 213275458b23bcbe04de43d94e8b30e79868f947 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Wed, 10 Jul 2024 10:22:30 +0200 Subject: [PATCH] Remove code duplication in LavaMoat build script (#2564) --- .../scripts/build.js | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/packages/snaps-execution-environments/scripts/build.js b/packages/snaps-execution-environments/scripts/build.js index ef4f1290fd..93a88b05ac 100644 --- a/packages/snaps-execution-environments/scripts/build.js +++ b/packages/snaps-execution-environments/scripts/build.js @@ -95,30 +95,23 @@ async function main() { JSON.stringify(lavamoatSecurityOptionsBrowser), ); - const htmlFile = ` - - - - - MetaMask Snaps Execution Environment - - - - - -`; - - const createInlinedHTML = (bundleSource) => ` - - - - MetaMask Snaps Execution Environment - - - - - -`; + const createHtml = (scriptTag) => ` + + + + + MetaMask Snaps Execution Environment + + + + ${scriptTag} + + `; + + const htmlFile = createHtml(''); + + const createInlinedHTML = (bundleSource) => + createHtml(``); await Promise.all( Object.entries(ENTRY_POINTS).map(async ([key, config]) => {