const fs = require('fs'); const packageJson = require('./package.json'); function writeJsonFile(filePath, data) { fs.writeFileSync(filePath, JSON.stringify(data)); } function readHtmlFile(filePath) { return fs.readFileSync(filePath, 'utf8'); } function writeHtmlFile(filePath, data) { fs.writeFileSync(filePath, data); } const welcomePagePath = 'build/index.html'; let indexHtml = readHtmlFile(welcomePagePath); const scriptTagRegex = /`; indexHtml = indexHtml .replace(scriptTagRegex, '') .replace('', `${scriptTag}`); writeHtmlFile(welcomePagePath, indexHtml); const versionData = { version: packageJson.version, }; writeJsonFile('build/version.json', versionData); writeJsonFile('version.json', versionData);