增加Linux平台包名正则验证

This commit is contained in:
Tlntin
2022-12-24 12:14:45 +08:00
parent 3da780f33a
commit fbe9d7b01f
2 changed files with 2 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ export async function mergeTauriConfig(
// 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]*/");
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");

2
dist/cli.js vendored
View File

@@ -1635,7 +1635,7 @@ function mergeTauriConfig(url, options, tauriConf) {
// 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]*/");
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");