Merge branch 'tw93:master' into master

This commit is contained in:
Tlntin
2023-01-08 10:40:10 +08:00
committed by GitHub
21 changed files with 192 additions and 255 deletions

View File

@@ -1,3 +1,4 @@
name: Build Contribute List
on: on:
push: push:
branches: branches:

View File

@@ -1,4 +1,4 @@
name: Check if the codebase matches the EditorConfig rules name: Check EditorConfig
on: on:
push: push:

View File

@@ -1,10 +1,9 @@
name: build name: Build App
on: on:
push: push:
# Sequence of patterns matched against refs/tags # Sequence of patterns matched against refs/tags
tags: tags:
- "V*" - "V*"
workflow_dispatch:
jobs: jobs:
build: build:
@@ -66,24 +65,6 @@ jobs:
run: | run: |
npm run build:all-windows npm run build:all-windows
# - name: Create Release and Upload Release Asset
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# tag_name: ${{ github.ref }}
# name: Release ${{ github.ref }}
# body: TODO New Release.
# draft: false
# prerelease: false
# files: |
# output/*/*.*
# - uses: ncipollo/release-action@v1
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# allowUpdates: true
# artifacts: "output/*/*.*"
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload files - name: Upload files
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,4 +1,4 @@
name: Check, test and format the Rust part of codebase name: Check Rust Code
on: on:
push: push:
@@ -40,9 +40,7 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
uses: awalsh128/cache-apt-pkgs-action@latest uses: awalsh128/cache-apt-pkgs-action@latest
with: with:
packages: > packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
version: 1.0 version: 1.0
- name: Run unit & integration tests with nextest - name: Run unit & integration tests with nextest
run: cargo hack --feature-powerset nextest run run: cargo hack --feature-powerset nextest run
@@ -69,9 +67,7 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
uses: awalsh128/cache-apt-pkgs-action@latest uses: awalsh128/cache-apt-pkgs-action@latest
with: with:
packages: > packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
version: 1.0 version: 1.0
- name: Run all-features code quality checks - name: Run all-features code quality checks
run: cargo hack --feature-powerset --no-dev-deps clippy run: cargo hack --feature-powerset --no-dev-deps clippy

View File

@@ -262,21 +262,28 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
<sub><b>Dengju Deng</b></sub> <sub><b>Dengju Deng</b></sub>
</a> </a>
</td> </td>
<td align="center">
<a href="https://github.com/Fechin">
<img src="https://avatars.githubusercontent.com/u/2541482?v=4" width="90;" alt="Fechin"/>
<br />
<sub><b>Fechin</b></sub>
</a>
</td>
<td align="center"> <td align="center">
<a href="https://github.com/princemaple"> <a href="https://github.com/princemaple">
<img src="https://avatars.githubusercontent.com/u/1329716?v=4" width="90;" alt="princemaple"/> <img src="https://avatars.githubusercontent.com/u/1329716?v=4" width="90;" alt="princemaple"/>
<br /> <br />
<sub><b>Po Chen</b></sub> <sub><b>Po Chen</b></sub>
</a> </a>
</td> </td></tr>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/houhoz"> <a href="https://github.com/houhoz">
<img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/> <img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
<br /> <br />
<sub><b>Hyzhao</b></sub> <sub><b>Hyzhao</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/liusishan"> <a href="https://github.com/liusishan">
<img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/> <img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>

View File

@@ -8,5 +8,6 @@ chatgpt,ChatGPT,ChatGPT,https://chat.openai.com/chat
flomo,Flomo,浮墨,https://v.flomoapp.com/mine flomo,Flomo,浮墨,https://v.flomoapp.com/mine
qwerty,Qwerty,Qwerty,https://qwerty.kaiyi.cool/ qwerty,Qwerty,Qwerty,https://qwerty.kaiyi.cool/
zlibrary,ZLibrary,ZLibrary,https://zlib.cydiar.com/ zlibrary,ZLibrary,ZLibrary,https://zlib.cydiar.com/
tableconvert,TableConvert,TableConvert,https://tableconvert.com/
lizhi,LiZhi,李志,https://lizhi.turkyden.com/?from=pake lizhi,LiZhi,李志,https://lizhi.turkyden.com/?from=pake
weread,WeRead,微信阅读,https://weread.qq.com/ weread,WeRead,微信阅读,https://weread.qq.com/
1 name(Linux) name(Mac/Windows) name_zh url
8 flomo Flomo 浮墨 https://v.flomoapp.com/mine
9 qwerty Qwerty Qwerty https://qwerty.kaiyi.cool/
10 zlibrary ZLibrary ZLibrary https://zlib.cydiar.com/
11 tableconvert TableConvert TableConvert https://tableconvert.com/
12 lizhi LiZhi 李志 https://lizhi.turkyden.com/?from=pake
13 weread WeRead 微信阅读 https://weread.qq.com/

View File

@@ -46,31 +46,31 @@ export default class LinuxBuilder implements IBuilder {
const { name } = options; const { name } = options;
await mergeTauriConfig(url, options, tauriConf); await mergeTauriConfig(url, options, tauriConf);
const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); await shellExec(`cd ${npmDirectory} && npm install && npm run build`);
let arch = "";
let arch: string;
if (process.arch === "x64") { if (process.arch === "x64") {
arch = "amd64"; arch = "amd64";
} else { } else {
arch = process.arch; arch = process.arch;
} }
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName); const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
const distPath = path.resolve(`${name}.deb`); const distPath = path.resolve(`${name}.deb`);
await fs.copyFile(appPath, distPath); await fs.copyFile(appPath, distPath);
await fs.unlink(appPath); await fs.unlink(appPath);
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`; const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName); const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
const distAppPath = path.resolve(`${name}.AppImage`); const distAppPath = path.resolve(`${name}.AppImage`);
await fs.copyFile(appImagePath, distAppPath); await fs.copyFile(appImagePath, distAppPath);
await fs.unlink(appImagePath); await fs.unlink(appImagePath);
logger.success('Build success!'); logger.success('Build success!');
logger.success('You can find the deb 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); logger.success('You can find the AppImage app installer in', distAppPath);
} }
getBuildedAppPath(npmDirectory: string,packageType: string, packageName: string) { getBuildAppPath(npmDirectory: string, packageType: string, packageName: string) {
return path.join( return path.join(
npmDirectory, npmDirectory,
'src-tauri/target/release/bundle/', 'src-tauri/target/release/bundle/',
@@ -78,4 +78,4 @@ export default class LinuxBuilder implements IBuilder {
packageName packageName
); );
} }
} }

View File

@@ -29,7 +29,7 @@ export default class MacBuilder implements IBuilder {
// TODO 国内有可能会超时 // TODO 国内有可能会超时
await installRust(); await installRust();
} else { } else {
log.error('Error: Pake need Rust to package your webapp!!!'); log.error('Error: Pake need Rust to package your webapp!');
process.exit(2); process.exit(2);
} }
} }
@@ -40,15 +40,11 @@ export default class MacBuilder implements IBuilder {
await mergeTauriConfig(url, options, tauriConf); await mergeTauriConfig(url, options, tauriConf);
const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); //这里直接使用 universal-apple-darwin 的打包,而非当前系统的包
let arch = "x64"; await shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
if (process.arch === "arm64") {
arch = "aarch64"; const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
} else { const appPath = this.getBuildAppPath(npmDirectory, dmgName);
arch = process.arch;
}
const dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
const distPath = path.resolve(`${name}.dmg`); const distPath = path.resolve(`${name}.dmg`);
await fs.copyFile(appPath, distPath); await fs.copyFile(appPath, distPath);
await fs.unlink(appPath); await fs.unlink(appPath);
@@ -57,10 +53,10 @@ export default class MacBuilder implements IBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
} }
getBuildedAppPath(npmDirectory: string, dmgName: string) { getBuildAppPath(npmDirectory: string, dmgName: string) {
return path.join( return path.join(
npmDirectory, npmDirectory,
'src-tauri/target/release/bundle/dmg', 'src-tauri/target/universal-apple-darwin/release/bundle/dmg',
dmgName dmgName
); );
} }

View File

@@ -5,11 +5,9 @@ import { checkRustInstalled, installRust } from '@/helpers/rust.js';
import { PakeAppOptions } from '@/types.js'; import { PakeAppOptions } from '@/types.js';
import { IBuilder } from './base.js'; import { IBuilder } from './base.js';
import { shellExec } from '@/utils/shell.js'; import { shellExec } from '@/utils/shell.js';
// @ts-expect-error 加上resolveJsonModule rollup会打包报错 // @ts-expect-error
// import tauriConf from '../../src-tauri/tauri.windows.conf.json';
import tauriConf from './tauriConf.js'; import tauriConf from './tauriConf.js';
import { fileURLToPath } from 'url';
import logger from '@/options/logger.js'; import logger from '@/options/logger.js';
import { mergeTauriConfig } from './common.js'; import { mergeTauriConfig } from './common.js';
import { npmDirectory } from '@/utils/dir.js'; import { npmDirectory } from '@/utils/dir.js';
@@ -47,11 +45,11 @@ export default class WinBuilder implements IBuilder {
await mergeTauriConfig(url, options, tauriConf); await mergeTauriConfig(url, options, tauriConf);
const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); await shellExec(`cd ${npmDirectory} && npm install && npm run build`);
const language = tauriConf.tauri.bundle.windows.wix.language[0]; const language = tauriConf.tauri.bundle.windows.wix.language[0];
const arch = process.arch; const arch = process.arch;
const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`;
const appPath = this.getBuildedAppPath(npmDirectory, msiName); const appPath = this.getBuildAppPath(npmDirectory, msiName);
const distPath = path.resolve(`${name}.msi`); const distPath = path.resolve(`${name}.msi`);
await fs.copyFile(appPath, distPath); await fs.copyFile(appPath, distPath);
await fs.unlink(appPath); await fs.unlink(appPath);
@@ -59,7 +57,7 @@ export default class WinBuilder implements IBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
} }
getBuildedAppPath(npmDirectory: string, dmgName: string) { getBuildAppPath(npmDirectory: string, dmgName: string) {
return path.join( return path.join(
npmDirectory, npmDirectory,
'src-tauri/target/release/bundle/msi', 'src-tauri/target/release/bundle/msi',

View File

@@ -51,7 +51,7 @@ export async function mergeTauriConfig(
const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/); const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
if (!reg.test(name) || reg.exec(name)[0].length != name.length) { if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
logger.error("package name is illegal it must be letters, numbers, and it must contain the letters") logger.error("package name is illegal it must be letters, numbers, and it must contain the letters")
logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead"); logger.error("E.g 123pan,123Pan,Pan123,weread,WeRead,WERead");
process.exit(); process.exit();
} }
} }
@@ -113,7 +113,7 @@ export async function mergeTauriConfig(
break; break;
} }
} }
let bundleConf = {tauri: {bundle: tauriConf.tauri.bundle}}; let bundleConf = {tauri: {bundle: tauriConf.tauri.bundle}};
await fs.writeFile( await fs.writeFile(
configPath, configPath,

7
bin/cli.ts vendored
View File

@@ -1,6 +1,5 @@
import { program } from 'commander'; import { program } from 'commander';
import log from 'loglevel'; import log from 'loglevel';
import chalk from 'chalk';
import { DEFAULT_PAKE_OPTIONS } from './defaults.js'; import { DEFAULT_PAKE_OPTIONS } from './defaults.js';
import { PakeCliOptions } from './types.js'; import { PakeCliOptions } from './types.js';
import { validateNumberInput, validateUrlInput } from './utils/validate.js'; import { validateNumberInput, validateUrlInput } from './utils/validate.js';
@@ -9,7 +8,6 @@ import BuilderFactory from './builders/BuilderFactory.js';
import { checkUpdateTips } from './helpers/updater.js'; import { checkUpdateTips } from './helpers/updater.js';
// @ts-expect-error // @ts-expect-error
import packageJson from '../package.json'; import packageJson from '../package.json';
import logger from './options/logger.js';
program.version(packageJson.version).description('A cli application can package a web page to desktop application.'); program.version(packageJson.version).description('A cli application can package a web page to desktop application.');
@@ -25,7 +23,8 @@ program
.option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
.option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent) .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
.action(async (url: string, options: PakeCliOptions) => { .action(async (url: string, options: PakeCliOptions) => {
checkUpdateTips();
await checkUpdateTips();
if (!url) { if (!url) {
// 直接 pake 不需要出现url提示 // 直接 pake 不需要出现url提示
@@ -42,7 +41,7 @@ program
const appOptions = await handleInputOptions(options, url); const appOptions = await handleInputOptions(options, url);
builder.build(url, appOptions); await builder.build(url, appOptions);
}); });
program.parse(); program.parse();

37
bin/options/icon.ts vendored
View File

@@ -33,43 +33,6 @@ export async function getDefaultIcon() {
return path.join(npmDirectory, iconPath); return path.join(npmDirectory, iconPath);
} }
// export async function getIconFromPageUrl(url: string) {
// const icon = await pageIcon(url);
// console.log(icon);
// if (icon.ext === '.ico') {
// const a = await ICO.parse(icon.data);
// icon.data = Buffer.from(a[0].buffer);
// }
// const iconDir = (await dir()).path;
// const iconPath = path.join(iconDir, `/icon.icns`);
// const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
// await fs.writeFile(iconPath, out);
// return iconPath;
// }
// export async function getIconFromMacosIcons(name: string) {
// const data = {
// query: name,
// filters: 'approved:true',
// hitsPerPage: 10,
// page: 1,
// };
// const res = await axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
// headers: {
// 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
// 'x-algolia-application-id': 'P1TXH7ZFB3',
// },
// });
// if (!res.data.hits.length) {
// return '';
// } else {
// return downloadIcon(res.data.hits[0].icnsUrl);
// }
// }
export async function downloadIcon(iconUrl: string) { export async function downloadIcon(iconUrl: string) {
let iconResponse; let iconResponse;
try { try {

74
dist/cli.js vendored
View File

@@ -1646,7 +1646,7 @@ function mergeTauriConfig(url, options, tauriConf) {
const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/); const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
if (!reg.test(name) || reg.exec(name)[0].length != name.length) { if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
logger.error("package name is illegal it must be letters, numbers, and it must contain the letters"); logger.error("package name is illegal it must be letters, numbers, and it must contain the letters");
logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead"); logger.error("E.g 123pan,123Pan,Pan123,weread,WeRead,WERead");
process.exit(); process.exit();
} }
} }
@@ -1752,38 +1752,6 @@ function getDefaultIcon() {
return path.join(npmDirectory, iconPath); return path.join(npmDirectory, iconPath);
}); });
} }
// export async function getIconFromPageUrl(url: string) {
// const icon = await pageIcon(url);
// console.log(icon);
// if (icon.ext === '.ico') {
// const a = await ICO.parse(icon.data);
// icon.data = Buffer.from(a[0].buffer);
// }
// const iconDir = (await dir()).path;
// const iconPath = path.join(iconDir, `/icon.icns`);
// const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
// await fs.writeFile(iconPath, out);
// return iconPath;
// }
// export async function getIconFromMacosIcons(name: string) {
// const data = {
// query: name,
// filters: 'approved:true',
// hitsPerPage: 10,
// page: 1,
// };
// const res = await axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
// headers: {
// 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
// 'x-algolia-application-id': 'P1TXH7ZFB3',
// },
// });
// if (!res.data.hits.length) {
// return '';
// } else {
// return downloadIcon(res.data.hits[0].icnsUrl);
// }
// }
function downloadIcon(iconUrl) { function downloadIcon(iconUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let iconResponse; let iconResponse;
@@ -2038,7 +2006,7 @@ class MacBuilder {
yield installRust(); yield installRust();
} }
else { else {
log.error('Error: Pake need Rust to package your webapp!!!'); log.error('Error: Pake need Rust to package your webapp!');
process.exit(2); process.exit(2);
} }
}); });
@@ -2048,16 +2016,10 @@ class MacBuilder {
log.debug('PakeAppOptions', options); log.debug('PakeAppOptions', options);
const { name } = options; const { name } = options;
yield mergeTauriConfig(url, options, tauriConf); yield mergeTauriConfig(url, options, tauriConf);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); //这里直接使用 universal-apple-darwin 的打包,而非当前系统的包
let arch = "x64"; yield shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
if (process.arch === "arm64") { const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
arch = "aarch64"; const appPath = this.getBuildAppPath(npmDirectory, dmgName);
}
else {
arch = process.arch;
}
const dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
const distPath = path.resolve(`${name}.dmg`); const distPath = path.resolve(`${name}.dmg`);
yield fs.copyFile(appPath, distPath); yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath); yield fs.unlink(appPath);
@@ -2065,8 +2027,8 @@ class MacBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
}); });
} }
getBuildedAppPath(npmDirectory, dmgName) { getBuildAppPath(npmDirectory, dmgName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/dmg', dmgName); return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
} }
} }
@@ -2102,7 +2064,7 @@ class WinBuilder {
const language = tauriConf.tauri.bundle.windows.wix.language[0]; const language = tauriConf.tauri.bundle.windows.wix.language[0];
const arch = process.arch; const arch = process.arch;
const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`;
const appPath = this.getBuildedAppPath(npmDirectory, msiName); const appPath = this.getBuildAppPath(npmDirectory, msiName);
const distPath = path.resolve(`${name}.msi`); const distPath = path.resolve(`${name}.msi`);
yield fs.copyFile(appPath, distPath); yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath); yield fs.unlink(appPath);
@@ -2110,7 +2072,7 @@ class WinBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
}); });
} }
getBuildedAppPath(npmDirectory, dmgName) { getBuildAppPath(npmDirectory, dmgName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/msi', dmgName); return path.join(npmDirectory, 'src-tauri/target/release/bundle/msi', dmgName);
} }
} }
@@ -2144,7 +2106,7 @@ class LinuxBuilder {
const { name } = options; const { name } = options;
yield mergeTauriConfig(url, options, tauriConf); yield mergeTauriConfig(url, options, tauriConf);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
let arch = ""; let arch;
if (process.arch === "x64") { if (process.arch === "x64") {
arch = "amd64"; arch = "amd64";
} }
@@ -2152,21 +2114,21 @@ class LinuxBuilder {
arch = process.arch; arch = process.arch;
} }
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName); const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
const distPath = path.resolve(`${name}.deb`); const distPath = path.resolve(`${name}.deb`);
yield fs.copyFile(appPath, distPath); yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath); yield fs.unlink(appPath);
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`; const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName); const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
const distAppPath = path.resolve(`${name}.AppImage`); const distAppPath = path.resolve(`${name}.AppImage`);
yield fs.copyFile(appImagePath, distAppPath); yield fs.copyFile(appImagePath, distAppPath);
yield fs.unlink(appImagePath); yield fs.unlink(appImagePath);
logger.success('Build success!'); logger.success('Build success!');
logger.success('You can find the deb 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); logger.success('You can find the AppImage app installer in', distAppPath);
}); });
} }
getBuildedAppPath(npmDirectory, packageType, packageName) { getBuildAppPath(npmDirectory, packageType, packageName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName); return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
} }
} }
@@ -2187,7 +2149,7 @@ class BuilderFactory {
} }
var name = "pake-cli"; var name = "pake-cli";
var version = "1.0.1"; var version = "1.2.1";
var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust."; var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";
var engines = { var engines = {
node: "^14.13 || >=16.0.0" node: "^14.13 || >=16.0.0"
@@ -2303,7 +2265,7 @@ program
.option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
.option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent) .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
.action((url, options) => __awaiter(void 0, void 0, void 0, function* () { .action((url, options) => __awaiter(void 0, void 0, void 0, function* () {
checkUpdateTips(); yield checkUpdateTips();
if (!url) { if (!url) {
// 直接 pake 不需要出现url提示 // 直接 pake 不需要出现url提示
program.help(); program.help();
@@ -2315,6 +2277,6 @@ program
const builder = BuilderFactory.create(); const builder = BuilderFactory.create();
yield builder.prepare(); yield builder.prepare();
const appOptions = yield handleOptions(options, url); const appOptions = yield handleOptions(options, url);
builder.build(url, appOptions); yield builder.build(url, appOptions);
})); }));
program.parse(); program.parse();

View File

@@ -1,6 +1,6 @@
{ {
"name": "pake-cli", "name": "pake-cli",
"version": "1.1.0", "version": "1.2.1",
"description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.", "description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.",
"engines": { "engines": {
"node": "^14.13 || >=16.0.0" "node": "^14.13 || >=16.0.0"

3
script/build.sh vendored
View File

@@ -45,7 +45,6 @@ if [[ "$OSTYPE" =~ ^linux ]]; then
# for linux, package name may be com.xxx.xxx # for linux, package name may be com.xxx.xxx
echo "rename package name" echo "rename package name"
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop" export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
$sd "\"productName\": \"WeRead\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json $sd "\"productName\": \"WeRead\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
fi fi
@@ -109,7 +108,6 @@ do
if [[ "$OSTYPE" =~ ^darwin ]]; then if [[ "$OSTYPE" =~ ^darwin ]]; then
npm run tauri build -- --target universal-apple-darwin npm run tauri build -- --target universal-apple-darwin
# mv src-tauri/target/release/bundle/dmg/*.dmg output/macos/${package_title}_x64.dmg
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/${package_title}.dmg mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/${package_title}.dmg
fi fi
@@ -119,4 +117,3 @@ done
echo "build all package success!" echo "build all package success!"
echo "you run 'rm src-tauri/assets/*.desktop && git checkout src-tauri' to recovery code" echo "you run 'rm src-tauri/assets/*.desktop && git checkout src-tauri' to recovery code"
# rm src-tauri/assets/*.desktop && git checkout src-tauri

219
src-tauri/Cargo.lock generated
View File

@@ -34,9 +34,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.66" version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]] [[package]]
name = "app" name = "app"
@@ -139,11 +139,12 @@ dependencies = [
[[package]] [[package]]
name = "bstr" name = "bstr"
version = "0.2.17" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b"
dependencies = [ dependencies = [
"memchr", "memchr",
"serde",
] ]
[[package]] [[package]]
@@ -196,9 +197,9 @@ dependencies = [
[[package]] [[package]]
name = "cargo_toml" name = "cargo_toml"
version = "0.13.0" version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa0e3586af56b3bfa51fca452bd56e8dbbbd5d8d81cbf0b7e4e35b695b537eb8" checksum = "497049e9477329f8f6a559972ee42e117487d01d1e8c2cc9f836ea6fa23a9e1a"
dependencies = [ dependencies = [
"serde", "serde",
"toml", "toml",
@@ -206,9 +207,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.77" version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
[[package]] [[package]]
name = "cesu8" name = "cesu8"
@@ -522,6 +523,15 @@ dependencies = [
"crypto-common", "crypto-common",
] ]
[[package]]
name = "dirs"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
dependencies = [
"dirs-sys",
]
[[package]] [[package]]
name = "dirs-next" name = "dirs-next"
version = "2.0.0" version = "2.0.0"
@@ -532,6 +542,17 @@ dependencies = [
"dirs-sys-next", "dirs-sys-next",
] ]
[[package]]
name = "dirs-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]] [[package]]
name = "dirs-sys-next" name = "dirs-sys-next"
version = "0.1.2" version = "0.1.2"
@@ -860,7 +881,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"rustversion", "rustversion",
"windows", "windows 0.39.0",
] ]
[[package]] [[package]]
@@ -984,15 +1005,15 @@ dependencies = [
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]] [[package]]
name = "globset" name = "globset"
version = "0.4.9" version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"bstr", "bstr",
@@ -1069,9 +1090,9 @@ dependencies = [
[[package]] [[package]]
name = "half" name = "half"
version = "2.1.0" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad6a9459c9c30b177b925162351f97e7d967c7ea8bab3b8352805327daf45554" checksum = "6c467d36af040b7b2681f5fddd27427f6da8d3d072f575a265e181d2f8e8d157"
dependencies = [ dependencies = [
"crunchy", "crunchy",
] ]
@@ -1099,9 +1120,9 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@@ -1137,7 +1158,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
"itoa 1.0.4", "itoa 1.0.5",
] ]
[[package]] [[package]]
@@ -1174,11 +1195,10 @@ dependencies = [
[[package]] [[package]]
name = "ignore" name = "ignore"
version = "0.4.18" version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" checksum = "a05705bc64e0b66a806c3740bd6578ea66051b157ec42dc219c785cbf185aef3"
dependencies = [ dependencies = [
"crossbeam-utils",
"globset", "globset",
"lazy_static", "lazy_static",
"log", "log",
@@ -1245,9 +1265,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.4" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]] [[package]]
name = "javascriptcore-rs" name = "javascriptcore-rs"
@@ -1347,9 +1367,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.138" version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]] [[package]]
name = "line-wrap" name = "line-wrap"
@@ -1562,9 +1582,9 @@ dependencies = [
[[package]] [[package]]
name = "num_cpus" name = "num_cpus"
version = "1.14.0" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi",
"libc", "libc",
@@ -1621,9 +1641,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.16.0" version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
[[package]] [[package]]
name = "overload" name = "overload"
@@ -1681,9 +1701,9 @@ dependencies = [
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.10" version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b" checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
@@ -1693,9 +1713,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]] [[package]]
name = "pest" name = "pest"
version = "2.5.1" version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0" checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4"
dependencies = [ dependencies = [
"thiserror", "thiserror",
"ucd-trie", "ucd-trie",
@@ -1912,24 +1932,24 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-hack" name = "proc-macro-hack"
version = "0.5.19" version = "0.5.20+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.47" version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.21" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@@ -2116,20 +2136,20 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [ dependencies = [
"semver 1.0.14", "semver 1.0.16",
] ]
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.9" version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.11" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]] [[package]]
name = "safemem" name = "safemem"
@@ -2195,9 +2215,9 @@ dependencies = [
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.14" version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@@ -2213,18 +2233,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.150" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.150" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2233,20 +2253,20 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.89" version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
dependencies = [ dependencies = [
"itoa 1.0.4", "itoa 1.0.5",
"ryu", "ryu",
"serde", "serde",
] ]
[[package]] [[package]]
name = "serde_repr" name = "serde_repr"
version = "0.1.9" version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2434,9 +2454,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.105" version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2471,9 +2491,9 @@ dependencies = [
[[package]] [[package]]
name = "tao" name = "tao"
version = "0.15.7" version = "0.15.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1fa15735311b4816d030ff54da58560b047daca0970e1031aed5502e84231a8" checksum = "ac8e6399427c8494f9849b58694754d7cc741293348a6836b6c8d2c5aa82d8e6"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cairo-rs", "cairo-rs",
@@ -2510,7 +2530,7 @@ dependencies = [
"serde", "serde",
"unicode-segmentation", "unicode-segmentation",
"uuid 1.2.2", "uuid 1.2.2",
"windows", "windows 0.39.0",
"windows-implement", "windows-implement",
"x11-dl", "x11-dl",
] ]
@@ -2528,9 +2548,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "1.2.2" version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8ea1d785ab2164373703817bff144c4610a69ad3f659becaca0e1ea004b98d8" checksum = "5b48820ee3bb6a5031a83b2b6e11f8630bdc5a2f68cb841ab8ebc7a15a916679"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cocoa", "cocoa",
@@ -2550,7 +2570,7 @@ dependencies = [
"percent-encoding", "percent-encoding",
"rand 0.8.5", "rand 0.8.5",
"raw-window-handle", "raw-window-handle",
"semver 1.0.14", "semver 1.0.16",
"serde", "serde",
"serde_json", "serde_json",
"serde_repr", "serde_repr",
@@ -2568,7 +2588,7 @@ dependencies = [
"uuid 1.2.2", "uuid 1.2.2",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
"windows", "windows 0.39.0",
] ]
[[package]] [[package]]
@@ -2581,7 +2601,7 @@ dependencies = [
"cargo_toml", "cargo_toml",
"heck 0.4.0", "heck 0.4.0",
"json-patch", "json-patch",
"semver 1.0.14", "semver 1.0.16",
"serde_json", "serde_json",
"tauri-utils", "tauri-utils",
"winres", "winres",
@@ -2601,7 +2621,7 @@ dependencies = [
"png", "png",
"proc-macro2", "proc-macro2",
"quote", "quote",
"semver 1.0.14", "semver 1.0.16",
"serde", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
@@ -2643,7 +2663,7 @@ dependencies = [
"thiserror", "thiserror",
"uuid 1.2.2", "uuid 1.2.2",
"webview2-com", "webview2-com",
"windows", "windows 0.39.0",
] ]
[[package]] [[package]]
@@ -2662,7 +2682,7 @@ dependencies = [
"uuid 1.2.2", "uuid 1.2.2",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
"windows", "windows 0.39.0",
"wry", "wry",
] ]
@@ -2684,14 +2704,14 @@ dependencies = [
"phf 0.10.1", "phf 0.10.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"semver 1.0.14", "semver 1.0.16",
"serde", "serde",
"serde_json", "serde_json",
"serde_with", "serde_with",
"thiserror", "thiserror",
"url", "url",
"walkdir", "walkdir",
"windows", "windows 0.39.0",
] ]
[[package]] [[package]]
@@ -2727,18 +2747,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.37" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.37" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2780,7 +2800,7 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
dependencies = [ dependencies = [
"itoa 1.0.4", "itoa 1.0.5",
"serde", "serde",
"time-core", "time-core",
"time-macros", "time-macros",
@@ -2818,9 +2838,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.23.0" version = "1.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",
@@ -2832,9 +2852,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.9" version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@@ -2930,9 +2950,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
@@ -3095,18 +3115,20 @@ dependencies = [
[[package]] [[package]]
name = "webbrowser" name = "webbrowser"
version = "0.8.2" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a0cc7962b5aaa0dfcebaeef0161eec6edf5f4606c12e6777fd7d392f52033a5" checksum = "e74f5ff7786c4c21f61ba8e30ea29c9745f06fca0a4a02d083b3c662583399e8"
dependencies = [ dependencies = [
"core-foundation",
"dirs",
"jni", "jni",
"log",
"ndk-context", "ndk-context",
"objc", "objc",
"raw-window-handle", "raw-window-handle",
"url", "url",
"web-sys", "web-sys",
"widestring", "windows 0.43.0",
"winapi",
] ]
[[package]] [[package]]
@@ -3164,7 +3186,7 @@ checksum = "b4a769c9f1a64a8734bde70caafac2b96cada12cd4aefa49196b3a386b8b4178"
dependencies = [ dependencies = [
"webview2-com-macros", "webview2-com-macros",
"webview2-com-sys", "webview2-com-sys",
"windows", "windows 0.39.0",
"windows-implement", "windows-implement",
] ]
@@ -3189,7 +3211,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
"windows", "windows 0.39.0",
"windows-bindgen", "windows-bindgen",
"windows-metadata", "windows-metadata",
] ]
@@ -3200,12 +3222,6 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]]
name = "widestring"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8"
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"
@@ -3251,6 +3267,21 @@ dependencies = [
"windows_x86_64_msvc 0.39.0", "windows_x86_64_msvc 0.39.0",
] ]
[[package]]
name = "windows"
version = "0.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.0",
"windows_i686_gnu 0.42.0",
"windows_i686_msvc 0.42.0",
"windows_x86_64_gnu 0.42.0",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.0",
]
[[package]] [[package]]
name = "windows-bindgen" name = "windows-bindgen"
version = "0.39.0" version = "0.39.0"
@@ -3413,7 +3444,7 @@ dependencies = [
"webkit2gtk", "webkit2gtk",
"webkit2gtk-sys", "webkit2gtk-sys",
"webview2-com", "webview2-com",
"windows", "windows 0.39.0",
"windows-implement", "windows-implement",
] ]

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -93,9 +93,14 @@ fn main() -> wry::Result<()> {
None None
}) })
.with_inner_size(wry::application::dpi::LogicalSize::new(width, height)); .with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let window = { let window = {
let icon_path = format!("png/{}_32.ico", package_name); let mut icon_path = format!("png/{}_32.ico", package_name);
// 假如没有设置,就使用默认的即可
if !std::path::Path::new(&icon_path).exists() {
icon_path = "png/icon_32.ico".to_string();
}
let icon = load_icon(std::path::Path::new(&icon_path)); let icon = load_icon(std::path::Path::new(&icon_path));
common_window common_window
.with_decorations(true) .with_decorations(true)