增加Linux平台包名正则验证

This commit is contained in:
Tlntin
2022-12-24 12:11:07 +08:00
parent 2b4d3ef088
commit 3da780f33a
2 changed files with 22 additions and 1 deletions

View File

@@ -37,6 +37,17 @@ export async function mergeTauriConfig(
transparent,
resizable,
};
// Package name is valid ?
// for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other
if (process.platform === "linux") {
const reg = new RegExp("/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/");
if (!reg.test(name)) {
logger.error("package name is illegal it must be lowercase, numbers, dashes.")
logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read");
process.exit();
}
}
Object.assign(tauriConf.tauri.windows[0], { url, ...tauriConfWindowOptions });
tauriConf.package.productName = name;