From a566bb2849be905b4e19614576c514db509fc81e Mon Sep 17 00:00:00 2001 From: Tw93 Date: Mon, 16 Dec 2024 14:21:34 +0800 Subject: [PATCH] :bug: update prerequisites url --- README.md | 4 +- README_CN.md | 4 +- README_JP.md | 4 +- bin/README.md | 2 +- bin/README_CN.md | 2 +- bin/builders/BaseBuilder.ts | 2 +- dist/cli.js | 106 ++++++++++++++++++++---------------- 7 files changed, 69 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 0a9069d..216da9e 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ In addition, double-click the title bar to switch to full-screen mode. For Mac u ## Before starting 1. **For beginners**: Play with Popular Packages to find out Pake's capabilities, or try to pack your application with [GitHub Actions](). Don't hesitate to reach for assistance at [Discussion](https://github.com/tw93/Pake/discussions)! -2. **For developers**: “Command-Line Packaging” supports macOS fully. For Windows/Linux users, it requires some tinkering. [Configure your environment](https://tauri.app/v1/guides/getting-started/prerequisites) before getting started. +2. **For developers**: “Command-Line Packaging” supports macOS fully. For Windows/Linux users, it requires some tinkering. [Configure your environment](https://tauri.app/start/prerequisites/) before getting started. 3. **For hackers**: For people who are good at both front-end development and Rust, how about customizing your apps' function more with the following [Customized Development](#development)? ## Command-Line Packaging @@ -163,7 +163,7 @@ If you are new to the command line, you can compile packages online with _GitHub ## Development -Prepare your environment before starting. Make sure you have Rust `>=1.63` and Node `>=16` (e.g., `16.18.1`) installed on your computer. For installation guidance, see [Tauri documentation](https://tauri.app/v1/guides/getting-started/prerequisites). +Prepare your environment before starting. Make sure you have Rust `>=1.63` and Node `>=16` (e.g., `16.18.1`) installed on your computer. For installation guidance, see [Tauri documentation](https://tauri.app/start/prerequisites/). If you are unfamiliar with these, it is better to try out the above tool to pack with one click. diff --git a/README_CN.md b/README_CN.md index bcc2199..5a26b9b 100644 --- a/README_CN.md +++ b/README_CN.md @@ -138,7 +138,7 @@ ## 开始之前 1. **小白用户**:使用 「常用包下载」 方式来把玩 Pake 的能力,可去 [讨论群](https://github.com/tw93/Pake/discussions) 寻求帮助,也可试试 [Action](https://github.com/tw93/Pake/wiki/%E5%9C%A8%E7%BA%BF%E7%BC%96%E8%AF%91%EF%BC%88%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E4%BD%BF%E7%94%A8%EF%BC%89) 方式。 -2. **开发用户**:使用 「命令行一键打包」,对 Mac 比较友好,Windows / Linux 需折腾下 [环境配置](https://tauri.app/v1/guides/getting-started/prerequisites)。 +2. **开发用户**:使用 「命令行一键打包」,对 Mac 比较友好,Windows / Linux 需折腾下 [环境配置](https://tauri.app/start/prerequisites/)。 3. **折腾用户**:假如你前端和 Rust 都会,那可试试下面的 「[定制开发](#定制开发)」,可深度二次开发定制你的功能。 ## 命令行一键打包 @@ -162,7 +162,7 @@ pake https://weekly.tw93.fun --name Weekly --hide-title-bar ## 定制开发 -开始前请确保电脑已经安装了 Rust `>=1.63` 和 Node `>=16 如 16.18.1` 的环境,此外需参考 [Tauri 文档](https://tauri.app/v1/guides/getting-started/prerequisites) 快速配置好环境才可以开始使用,假如你太不懂,使用上面的命令行打包会更加合适。 +开始前请确保电脑已经安装了 Rust `>=1.63` 和 Node `>=16 如 16.18.1` 的环境,此外需参考 [Tauri 文档](https://tauri.app/start/prerequisites/) 快速配置好环境才可以开始使用,假如你太不懂,使用上面的命令行打包会更加合适。 ```sh # 安装依赖 diff --git a/README_JP.md b/README_JP.md index d73781c..113f4e6 100644 --- a/README_JP.md +++ b/README_JP.md @@ -138,7 +138,7 @@ ## 始める前に 1. **初心者の方へ**: 「人気のパッケージ」を使用して Pake の機能を試してみてください。または、[GitHub Actions]()を使用してアプリケーションをパッケージ化してみてください。[ディスカッション](https://github.com/tw93/Pake/discussions)で助けを求めることもできます! -2. **開発者の方へ**: 「コマンドラインパッケージング」を使用してください。macOS では完全にサポートされています。Windows/Linux ユーザーは、[環境を設定](https://tauri.app/v1/guides/getting-started/prerequisites)する必要があります。 +2. **開発者の方へ**: 「コマンドラインパッケージング」を使用してください。macOS では完全にサポートされています。Windows/Linux ユーザーは、[環境を設定](https://tauri.app/start/prerequisites/)する必要があります。 3. **ハッカーの方へ**: フロントエンド開発と Rust の両方が得意な方は、以下の[カスタマイズ開発](#開発)でアプリの機能をさらにカスタマイズしてみてください。 ## コマンドラインパッケージング @@ -162,7 +162,7 @@ pake https://weekly.tw93.fun --name Weekly --hide-title-bar ## 開発 -開始する前に、Rust `>=1.63` と Node `>=16` (例: `16.18.1`) がコンピュータにインストールされていることを確認してください。インストールガイドについては、[Tauri ドキュメント](https://tauri.app/v1/guides/getting-started/prerequisites)を参照してください。 +開始する前に、Rust `>=1.63` と Node `>=16` (例: `16.18.1`) がコンピュータにインストールされていることを確認してください。インストールガイドについては、[Tauri ドキュメント](https://tauri.app/start/prerequisites/)を参照してください。 これらに不慣れな場合は、上記のツールを使用してワンクリックでパッケージを作成することをお勧めします。 diff --git a/bin/README.md b/bin/README.md index 92c5f14..15c6cfa 100644 --- a/bin/README.md +++ b/bin/README.md @@ -10,7 +10,7 @@ npm install pake-cli -g ## Considerations for Windows & Linux Users -- **CRITICAL**: Consult [Tauri prerequisites](https://tauri.app/v1/guides/getting-started/prerequisites) before proceeding. +- **CRITICAL**: Consult [Tauri prerequisites](https://tauri.app/start/prerequisites/) before proceeding. - For Windows users (ensure that `Win10 SDK (10.0.19041.0)` and `Visual Studio build tool 2022 (>=17.2)` are installed), additional installations are required: 1. Microsoft Visual C++ 2015-2022 Redistributable (x64) diff --git a/bin/README_CN.md b/bin/README_CN.md index 9898402..35cefd5 100644 --- a/bin/README_CN.md +++ b/bin/README_CN.md @@ -10,7 +10,7 @@ npm install pake-cli -g ## Windows/Linux 注意事项 -- **非常重要**:请参阅 Tauri 的 [依赖项指南](https://tauri.app/v1/guides/getting-started/prerequisites)。 +- **非常重要**:请参阅 Tauri 的 [依赖项指南](https://tauri.app/start/prerequisites/)。 - 对于 Windows 用户,请确保至少安装了 `Win10 SDK(10.0.19041.0)` 和 `Visual Studio Build Tools 2022(版本 17.2 或更高)`,此外还需要安装以下组件: 1. Microsoft Visual C++ 2015-2022 Redistributable (x64) diff --git a/bin/builders/BaseBuilder.ts b/bin/builders/BaseBuilder.ts index 65ecdfa..6f06c13 100644 --- a/bin/builders/BaseBuilder.ts +++ b/bin/builders/BaseBuilder.ts @@ -28,7 +28,7 @@ export default abstract class BaseBuilder { if (!IS_MAC && !tauriTargetPathExists) { logger.warn('✼ The first use requires installing system dependencies.'); - logger.warn('✼ See more in https://tauri.app/v1/guides/getting-started/prerequisites.'); + logger.warn('✼ See more in https://tauri.app/guides/getting-started/prerequisites.'); } if (!checkRustInstalled()) { diff --git a/dist/cli.js b/dist/cli.js index 822d230..b1061c5 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -16,11 +16,11 @@ import updateNotifier from 'update-notifier'; import axios from 'axios'; import { dir } from 'tmp-promise'; import { fileTypeFromBuffer } from 'file-type'; -import psl from 'psl'; +import * as psl from 'psl'; import isUrl from 'is-url'; var name = "pake-cli"; -var version$1 = "2.5.2"; +var version$1 = "3.0.0-beta"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。"; var engines = { node: ">=16.0.0" @@ -67,31 +67,31 @@ var type = "module"; var exports = "./dist/pake.js"; var license = "MIT"; var dependencies = { - "@tauri-apps/api": "^1.5.4", - "@tauri-apps/cli": "^2.0.0-beta.22", - axios: "^1.6.8", + "@tauri-apps/api": "^1.6.0", + "@tauri-apps/cli": "^2.1.0", + axios: "^1.7.8", chalk: "^5.3.0", commander: "^11.1.0", "file-type": "^18.7.0", "fs-extra": "^11.2.0", "is-url": "^1.2.4", - loglevel: "^1.9.1", + loglevel: "^1.9.2", ora: "^7.0.1", prompts: "^2.4.2", - psl: "^1.9.0", + psl: "^1.15.0", shelljs: "^0.8.5", "tmp-promise": "^3.0.3", - "update-notifier": "^7.0.0" + "update-notifier": "^7.3.1" }; var devDependencies = { - "@rollup/plugin-alias": "^5.1.0", - "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-alias": "^5.1.1", + "@rollup/plugin-commonjs": "^25.0.8", "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-replace": "^5.0.5", + "@rollup/plugin-replace": "^5.0.7", "@rollup/plugin-terser": "^0.4.4", "@types/fs-extra": "^11.0.4", "@types/is-url": "^1.2.32", - "@types/node": "^20.12.10", + "@types/node": "^20.17.9", "@types/page-icon": "^0.3.6", "@types/prompts": "^2.4.9", "@types/psl": "^1.1.3", @@ -100,10 +100,10 @@ var devDependencies = { "@types/update-notifier": "^6.0.8", "app-root-path": "^3.1.0", "cross-env": "^7.0.3", - rollup: "^4.17.2", + rollup: "^4.28.0", "rollup-plugin-typescript2": "^0.36.0", - tslib: "^2.6.2", - typescript: "^5.4.5" + tslib: "^2.8.1", + typescript: "^5.7.2" }; var packageJson = { name: name, @@ -133,6 +133,7 @@ var windows = [ height: 780, resizable: true, always_on_top: false, + dark_mode: false, activation_shortcut: "", disabled_web_shortcuts: false } @@ -147,43 +148,49 @@ var system_tray = { linux: true, windows: true }; +var system_tray_path = "icons/icon.png"; var inject = [ ]; +var proxy_url = ""; var pakeConf = { windows: windows, user_agent: user_agent, system_tray: system_tray, - inject: inject + system_tray_path: system_tray_path, + inject: inject, + proxy_url: proxy_url }; -var build = { - beforeBuildCommand: "", - frontendDist: "../dist", - beforeDevCommand: "" -}; +var productName$1 = "WeRead"; +var identifier = "com.pake.weread"; +var version = "2.0.0"; var plugins = { }; -var productName = "WeRead"; -var version = "1.0.0"; var app = { security: { csp: null }, trayIcon: { - iconPath: "png/icon_512.png", - iconAsTemplate: false + iconPath: "png/weread_512.png", + iconAsTemplate: false, + id: "pake-tray" }, withGlobalTauri: true }; +var build = { + beforeBuildCommand: "", + frontendDist: "../dist", + beforeDevCommand: "" +}; var CommonConf = { - build: build, - plugins: plugins, - productName: productName, + productName: productName$1, + identifier: identifier, version: version, - app: app + plugins: plugins, + app: app, + build: build }; -var identifier$2 = "com.pake.weread"; var bundle$2 = { icon: [ "png/weread_256.ico", @@ -215,11 +222,9 @@ var bundle$2 = { } }; var WinConf = { - identifier: identifier$2, bundle: bundle$2 }; -var identifier$1 = "com.pake.weread"; var bundle$1 = { icon: [ "icons/weread.icns" @@ -246,11 +251,10 @@ var bundle$1 = { ] }; var MacConf = { - identifier: identifier$1, bundle: bundle$1 }; -var identifier = "com.pake.weread"; +var productName = "weread"; var bundle = { icon: [ "png/weread_512.png" @@ -281,7 +285,7 @@ var bundle = { ] }; var LinuxConf = { - identifier: identifier, + productName: productName, bundle: bundle }; @@ -300,7 +304,7 @@ let tauriConfig = { ...CommonConf.app, trayIcon: { ...CommonConf.app.trayIcon, - ...platformConfig.app.trayIcon, + ...(platformConfig?.app?.trayIcon ?? {}), }, }, build: CommonConf.build, @@ -460,7 +464,7 @@ async function combineFiles(files, output) { } async function mergeConfig(url, options, tauriConf) { - const { width, height, fullscreen, hideTitleBar, alwaysOnTop, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, } = options; + const { width, height, fullscreen, hideTitleBar, alwaysOnTop, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, } = options; const { platform } = process; // Set Windows parameters. const tauriConfWindowOptions = { @@ -471,11 +475,15 @@ async function mergeConfig(url, options, tauriConf) { hide_title_bar: hideTitleBar, activation_shortcut: activationShortcut, always_on_top: alwaysOnTop, + dark_mode: darkMode, disabled_web_shortcuts: disabledWebShortcuts, }; Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions }); - tauriConf.productName = name; - tauriConf.identifier = identifier; + tauriConf.package.productName = name; + tauriConf.tauri.bundle.identifier = identifier; + if (platform == "win32") { + tauriConf.tauri.bundle.windows.wix.language[0] = installerLanguage; + } //Judge the type of URL, whether it is a file or a website. const pathExists = await fsExtra.pathExists(url); if (pathExists) { @@ -516,9 +524,9 @@ async function mergeConfig(url, options, tauriConf) { // Processing targets are currently only open to Linux. if (platform === 'linux') { delete tauriConf.bundle.linux.deb.files; - const validTargets = ['all', 'deb', 'appimage']; + const validTargets = ['all', 'deb', 'appimage', 'rpm']; if (validTargets.includes(options.targets)) { - tauriConf.bundle.targets = options.targets === 'all' ? ['deb', 'appimage'] : [options.targets]; + tauriConf.bundle.targets = options.targets === 'all' ? ['deb', 'appimage', 'rpm'] : [options.targets]; } else { logger.warn(`✼ The target must be one of ${validTargets.join(', ')}, the default 'deb' will be used.`); @@ -594,6 +602,8 @@ async function mergeConfig(url, options, tauriConf) { } } tauriConf.app.trayIcon.iconPath = trayIconPath; + tauriConf.pake.system_tray_path = trayIconPath; + delete tauriConf.app.trayIcon; const injectFilePath = path.join(npmDirectory, `src-tauri/src/inject/custom.js`); // inject js or css files if (inject?.length > 0) { @@ -609,6 +619,7 @@ async function mergeConfig(url, options, tauriConf) { tauriConf.pake.inject = []; await fsExtra.writeFile(injectFilePath, ''); } + tauriConf.pake.proxy_url = proxyUrl || ""; // Save config file. const platformConfigPaths = { win32: 'tauri.windows.conf.json', @@ -617,6 +628,7 @@ async function mergeConfig(url, options, tauriConf) { }; const configPath = path.join(tauriConfigDirectory, platformConfigPaths[platform]); const bundleConf = { bundle: tauriConf.bundle }; + console.log('pakeConfig', tauriConf.pake); await fsExtra.outputJSON(configPath, bundleConf, { spaces: 4 }); const pakeConfigPath = path.join(tauriConfigDirectory, 'pake.json'); await fsExtra.outputJSON(pakeConfigPath, tauriConf.pake, { spaces: 4 }); @@ -636,7 +648,7 @@ class BaseBuilder { const tauriTargetPathExists = await fsExtra.pathExists(tauriTargetPath); if (!IS_MAC && !tauriTargetPathExists) { logger.warn('✼ The first use requires installing system dependencies.'); - logger.warn('✼ See more in https://tauri.app/v1/guides/getting-started/prerequisites.'); + logger.warn('✼ See more in https://tauri.app/guides/getting-started/prerequisites.'); } if (!checkRustInstalled()) { const res = await prompts({ @@ -799,6 +811,7 @@ const DEFAULT_PAKE_OPTIONS = { resizable: true, hideTitleBar: false, alwaysOnTop: false, + darkMode: false, disabledWebShortcuts: false, activationShortcut: '', userAgent: '', @@ -807,9 +820,10 @@ const DEFAULT_PAKE_OPTIONS = { targets: 'deb', useLocalFile: false, systemTrayIcon: '', + proxyUrl: "", debug: false, inject: [], - safeDomain: [], + installerLanguage: 'en-US', }; async function checkUpdateTips() { @@ -995,17 +1009,17 @@ program .option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch) .option('--inject [injects...]', 'Injection of .js or .css Files', DEFAULT_PAKE_OPTIONS.inject) .option('--debug', 'Debug build and more output', DEFAULT_PAKE_OPTIONS.debug) + .option('--proxy-url', "Proxy URL", DEFAULT_PAKE_OPTIONS.proxyUrl) .addOption(new Option('--user-agent ', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp()) .addOption(new Option('--targets ', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT_PAKE_OPTIONS.targets).hideHelp()) .addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_PAKE_OPTIONS.alwaysOnTop).hideHelp()) + .addOption(new Option('--dark-mode', 'Force Mac app to use dark mode').default(DEFAULT_PAKE_OPTIONS.darkMode).hideHelp()) .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts') .default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts) .hideHelp()) - .addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration') - .default(DEFAULT_PAKE_OPTIONS.safeDomain) - .hideHelp()) .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp()) .addOption(new Option('--system-tray-icon ', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp()) + .addOption(new Option('--installer-language ', 'Installer language').default(DEFAULT_PAKE_OPTIONS.installerLanguage).hideHelp()) .version(packageJson.version, '-v, --version', 'Output the current version') .action(async (url, options) => { await checkUpdateTips();