From 718280fe5987dbd6dc14d6eabec3c7e1bd398737 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 10 Dec 2022 20:41:50 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_EN.md | 2 +- bin/builders/LinuxBuilder.ts | 2 +- bin/builders/MacBuilder.ts | 2 +- bin/builders/WinBulider.ts | 2 +- dist/cli.js | 8 ++++---- package.json | 1 - 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8992e26..340ac2f 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ npm i npm run dev // ζ‰“εŒ…εΊ”η”¨ -npm run build:release +npm run build ``` diff --git a/README_EN.md b/README_EN.md index 3ed8feb..f829fd5 100644 --- a/README_EN.md +++ b/README_EN.md @@ -146,7 +146,7 @@ npm i npm run dev // Pack application -npm run build:release +npm run build ``` diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.ts index a6a88f2..426e01a 100644 --- a/bin/builders/LinuxBuilder.ts +++ b/bin/builders/LinuxBuilder.ts @@ -61,7 +61,7 @@ Terminal=false Type=Application ` await fs.writeFile(assertPath, desktopStr); - const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); let arch = ""; if (process.arch === "x64") { arch = "amd64"; diff --git a/bin/builders/MacBuilder.ts b/bin/builders/MacBuilder.ts index e914d7c..8a5fdcb 100644 --- a/bin/builders/MacBuilder.ts +++ b/bin/builders/MacBuilder.ts @@ -40,7 +40,7 @@ export default class MacBuilder implements IBuilder { await mergeTauriConfig(url, options, tauriConf); - const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); let arch = "x64"; if (process.arch === "arm64") { arch = "aarch64"; diff --git a/bin/builders/WinBulider.ts b/bin/builders/WinBulider.ts index a6978b2..2ca2958 100644 --- a/bin/builders/WinBulider.ts +++ b/bin/builders/WinBulider.ts @@ -47,7 +47,7 @@ export default class WinBuilder implements IBuilder { await mergeTauriConfig(url, options, tauriConf); - const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); const language = tauriConf.tauri.bundle.windows.wix.language[0]; const arch = process.arch; const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; diff --git a/dist/cli.js b/dist/cli.js index 73ef94b..bd33f4a 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1996,7 +1996,7 @@ class MacBuilder { log.debug('PakeAppOptions', options); const { name } = options; yield mergeTauriConfig(url, options, tauriConf); - yield shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); let arch = "x64"; if (process.arch === "arm64") { arch = "aarch64"; @@ -2046,7 +2046,7 @@ class WinBuilder { logger.debug('PakeAppOptions', options); const { name } = options; yield mergeTauriConfig(url, options, tauriConf); - yield shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); const language = tauriConf.tauri.bundle.windows.wix.language[0]; const arch = process.arch; const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; @@ -2106,7 +2106,7 @@ Terminal=false Type=Application `; yield fs.writeFile(assertPath, desktopStr); - yield shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); let arch = ""; if (process.arch === "x64") { arch = "amd64"; @@ -2168,7 +2168,7 @@ var scripts = { start: "npm run dev", dev: "npm run tauri dev", "dev:debug": "npm run tauri dev -- --features devtools", - "build:release": "npm run tauri build --release", + build: "npm run tauri build --release", "build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh", "build:all-windows": ".\\script\\build.bat", tauri: "tauri", diff --git a/package.json b/package.json index 8d936de..75ff93c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "dev": "npm run tauri dev", "dev:debug": "npm run tauri dev -- --features devtools", "build": "npm run tauri build --release", - "build:release": "npm run tauri build --release", "build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh", "build:all-windows": ".\\script\\build.bat", "tauri": "tauri", From 6dfa8e7a2ff7f2d02cf09675a7abf41b294e9b09 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 10 Dec 2022 22:09:46 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Linux=20appimage=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/build.sh | 3 ++- src-tauri/tauri.linux.conf.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/script/build.sh b/script/build.sh index b53b55b..3f0f77f 100755 --- a/script/build.sh +++ b/script/build.sh @@ -102,7 +102,8 @@ do if [[ "$OSTYPE" =~ ^linux ]]; then npm run tauri build - mv src-tauri/target/release/bundle/deb/*.deb output/linux/${package_title}_amd64.deb + mv src-tauri/target/release/bundle/deb/${package_prefix}-${package_name}*.deb output/linux/${package_title}_amd64.deb + mv src-tauri/target/release/bundle/appimage/${package_prefix}-${package_name}*.AppImage output/linux/${package_title}_amd64.AppImage fi if [[ "$OSTYPE" =~ ^darwin ]]; then diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index 3235abd..6ea486e 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -28,7 +28,7 @@ "longDescription": "", "resources": [], "shortDescription": "", - "targets": ["deb"] + "targets": ["deb", "appimage"] } } } From ebc90798b0ae113afe017e59012ee9d4a92d7d11 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 10 Dec 2022 22:43:31 +0800 Subject: [PATCH 3/3] =?UTF-8?q?pake-cli=E6=B7=BB=E5=8A=A0Linux=20appimage?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + bin/builders/LinuxBuilder.ts | 19 ++++++++++++++----- dist/cli.js | 17 ++++++++++++----- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 31b9985..3b06664 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ dist-ssr output *.msi *.deb +*.AppImage *.dmg package-lock.json diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.ts index 426e01a..ed55ab9 100644 --- a/bin/builders/LinuxBuilder.ts +++ b/bin/builders/LinuxBuilder.ts @@ -69,19 +69,28 @@ Type=Application arch = process.arch; } const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; - const appPath = this.getBuildedAppPath(npmDirectory, debName); + const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName); const distPath = path.resolve(`${name}.deb`); await fs.copyFile(appPath, distPath); await fs.unlink(appPath); + + + const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`; + const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName); + const distAppPath = path.resolve(`${name}.AppImage`); + await fs.copyFile(appImagePath, distAppPath); + await fs.unlink(appImagePath); logger.success('Build success!'); - logger.success('You can find the app installer in', distPath); + logger.success('You can find the deb app installer in', distPath); + logger.success('You can find the Appimage app installer in', distAppPath); } - getBuildedAppPath(npmDirectory: string, dmgName: string) { + getBuildedAppPath(npmDirectory: string,packageType: string, packageName: string) { return path.join( npmDirectory, - 'src-tauri/target/release/bundle/deb', - dmgName + 'src-tauri/target/release/bundle/', + packageType, + packageName ); } } \ No newline at end of file diff --git a/dist/cli.js b/dist/cli.js index bd33f4a..dfafabf 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1943,7 +1943,8 @@ var tauri = { ], shortDescription: "", targets: [ - "deb" + "deb", + "appimage" ] } }; @@ -2115,16 +2116,22 @@ Type=Application arch = process.arch; } const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; - const appPath = this.getBuildedAppPath(npmDirectory, debName); + const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName); const distPath = path.resolve(`${name}.deb`); yield fs.copyFile(appPath, distPath); yield fs.unlink(appPath); + const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`; + const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName); + const distAppPath = path.resolve(`${name}.AppImage`); + yield fs.copyFile(appImagePath, distAppPath); + yield fs.unlink(appImagePath); logger.success('Build success!'); - logger.success('You can find the app installer in', distPath); + logger.success('You can find the deb app installer in', distPath); + logger.success('You can find the Appimage app installer in', distAppPath); }); } - getBuildedAppPath(npmDirectory, dmgName) { - return path.join(npmDirectory, 'src-tauri/target/release/bundle/deb', dmgName); + getBuildedAppPath(npmDirectory, packageType, packageName) { + return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName); } }