2024-04-25 16:01:08: merge [main:7f9a52684105c7ff0a068812245c462ceb6d553e];
This commit is contained in:
1 parent
5a5f104174
commit
a31c44eb7b
121 files changed
+14802
-84
No files matched your search
@@ -0,0 +1,33 @@
|
||||
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 = /<script type="module">window\.AppVersion\s*=\s*'.*';<\/script>/;
|
||||
const scriptTag = `<script type="module">window.AppVersion = '${packageJson.version}';</script>`;
|
||||
indexHtml = indexHtml
|
||||
.replace(scriptTagRegex, '')
|
||||
.replace('</head>', `${scriptTag}</head>`);
|
||||
|
||||
writeHtmlFile(welcomePagePath, indexHtml);
|
||||
|
||||
const versionData = {
|
||||
version: packageJson.version,
|
||||
};
|
||||
|
||||
writeJsonFile('build/version.json', versionData);
|
||||
writeJsonFile('version.json', versionData);
|
||||
Reference in new issue
Block a user