From 3da780f33a772ca988159af3f72175a5a27e7fc9 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 24 Dec 2022 12:11:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Linux=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=8C=85=E5=90=8D=E6=AD=A3=E5=88=99=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/builders/common.ts | 11 +++++++++++ dist/cli.js | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bin/builders/common.ts b/bin/builders/common.ts index b081e35..d2819d8 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -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; diff --git a/dist/cli.js b/dist/cli.js index 0415c56..09f4e5b 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1632,6 +1632,16 @@ function mergeTauriConfig(url, options, tauriConf) { 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], Object.assign({ url }, tauriConfWindowOptions)); tauriConf.package.productName = name; tauriConf.tauri.bundle.identifier = identifier; @@ -2209,7 +2219,7 @@ var scripts = { tauri: "tauri", cli: "rollup -c rollup.config.js --watch", "cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js", - "cli:publish": "npm run cli:build && npm publish" + prepublishOnly: "npm run cli:build" }; var type = "module"; var exports = "./dist/pake.js";