From c81afb88bf28c43f622e1861f429952262f859a5 Mon Sep 17 00:00:00 2001 From: junkisai Date: Wed, 18 Dec 2024 09:29:57 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88=20Add=20Google=20Tag=20Manager=20s?= =?UTF-8?q?cripts=20to=20update=5Fdist=5Fcontent.mjs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/update_dist_content.mjs | 50 ++++++++++++------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/frontend/apps/erd-sample/scripts/update_dist_content.mjs b/frontend/apps/erd-sample/scripts/update_dist_content.mjs index b153acb5..d1747843 100644 --- a/frontend/apps/erd-sample/scripts/update_dist_content.mjs +++ b/frontend/apps/erd-sample/scripts/update_dist_content.mjs @@ -1,43 +1,55 @@ -import fs from 'fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; +import fs from 'fs' +import path from 'path' +import { fileURLToPath } from 'url' // Get the directory name of the current module -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) // Path to the target HTML file -const filePath = path.join(__dirname, '..', 'dist', 'index.html'); +const filePath = path.join(__dirname, '..', 'dist', 'index.html') // Content to insert into const contentToInsertHead = ` - -`; + + + +` // Content to insert into const contentToInsertBody = ` - -`; + + + +` // Read the file fs.readFile(filePath, 'utf8', (err, data) => { if (err) { - console.error('Failed to read file:', err); - return; + console.error('Failed to read file:', err) + return } // Insert content immediately after the tag - let updatedData = data.replace(//, `\n ${contentToInsertHead}`); + let updatedData = data.replace(//, `\n ${contentToInsertHead}`) // Insert content immediately after the tag - updatedData = updatedData.replace(//, `\n ${contentToInsertBody}`); + updatedData = updatedData.replace( + //, + `\n ${contentToInsertBody}`, + ) // Write the updated data back to the file fs.writeFile(filePath, updatedData, 'utf8', (err) => { if (err) { - console.error('Failed to write file:', err); - return; + console.error('Failed to write file:', err) + return } - console.log('Content successfully inserted into and .'); - }); -}); + console.log('Content successfully inserted into and .') + }) +})