add: build skip update.json change in prerelease
This commit is contained in:
parent
abc6b658d9
commit
dc05fc6c96
|
|
@ -22,6 +22,8 @@ const t = new Date();
|
||||||
const buildTime = dateFormat("YYYY-mm-dd HH:MM:SS", new Date());
|
const buildTime = dateFormat("YYYY-mm-dd HH:MM:SS", new Date());
|
||||||
const buildDir = "build";
|
const buildDir = "build";
|
||||||
|
|
||||||
|
const isPreRelease = version.includes("-");
|
||||||
|
|
||||||
function copyFileSync(source, target) {
|
function copyFileSync(source, target) {
|
||||||
var targetFile = target;
|
var targetFile = target;
|
||||||
|
|
||||||
|
|
@ -136,13 +138,16 @@ function replaceString() {
|
||||||
`${buildDir}/addon/prefs.js`,
|
`${buildDir}/addon/prefs.js`,
|
||||||
`${buildDir}/addon/manifest.json`,
|
`${buildDir}/addon/manifest.json`,
|
||||||
`${buildDir}/addon/bootstrap.js`,
|
`${buildDir}/addon/bootstrap.js`,
|
||||||
"update.json",
|
|
||||||
],
|
],
|
||||||
from: replaceFrom,
|
from: replaceFrom,
|
||||||
to: replaceTo,
|
to: replaceTo,
|
||||||
countMatches: true,
|
countMatches: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!isPreRelease) {
|
||||||
|
optionsAddon.files.push("update.json");
|
||||||
|
}
|
||||||
|
|
||||||
const replaceResult = replaceInFileSync(optionsAddon);
|
const replaceResult = replaceInFileSync(optionsAddon);
|
||||||
|
|
||||||
const localeMessage = new Set();
|
const localeMessage = new Set();
|
||||||
|
|
@ -242,14 +247,20 @@ async function main() {
|
||||||
console.log(
|
console.log(
|
||||||
`[Build] BUILD_DIR=${buildDir}, VERSION=${version}, BUILD_TIME=${buildTime}, ENV=${[
|
`[Build] BUILD_DIR=${buildDir}, VERSION=${version}, BUILD_TIME=${buildTime}, ENV=${[
|
||||||
env.NODE_ENV,
|
env.NODE_ENV,
|
||||||
]}`,
|
]}, IS_PRE_RELEASE=${[env.IS_PRE_RELEASE]}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
clearFolder(buildDir);
|
clearFolder(buildDir);
|
||||||
|
|
||||||
copyFolderRecursiveSync("addon", buildDir);
|
copyFolderRecursiveSync("addon", buildDir);
|
||||||
|
|
||||||
copyFileSync("update-template.json", "update.json");
|
if (isPreRelease) {
|
||||||
|
console.log(
|
||||||
|
"[Build] [Warn] Running in pre-release mode. update.json will not be replaced.",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
copyFileSync("update-template.json", "update.json");
|
||||||
|
}
|
||||||
|
|
||||||
await esbuild();
|
await esbuild();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue