fix(extension): version string must be numbers and dots

(cherry picked from commit 3fd35b5d30037a6e156fdb75ca4124837b37d658)
This commit is contained in:
MengYX
2021-12-16 10:45:32 +08:00
parent 5d8a726746
commit 9c3e39502a
2 changed files with 6 additions and 3 deletions

View File

@ -15,9 +15,11 @@ const manifest = JSON.parse(manifestRaw)
const pkgRaw = fs.readFileSync("./package.json", "utf-8")
const pkg = JSON.parse(pkgRaw)
ver_str = pkg["version"]
if (ver_str.startsWith("v")) ver_str = ver_str.slice(1)
manifest["version"] = ver_str
verExt = pkg["version"]
if (verExt.startsWith("v")) verExt = verExt.slice(1)
if (verExt.includes("-")) verExt = verExt.split("-")[0]
manifest["version"] = `${verExt}.${pkg["ext_build"]}`
manifest["version_name"] = pkg["version"]
fs.writeFileSync("./dist/manifest.json", JSON.stringify(manifest), "utf-8")
console.log("Write: manifest.json")