diff --git a/bin/README.md b/bin/README.md index f5b6c78..dc8ed9a 100644 --- a/bin/README.md +++ b/bin/README.md @@ -127,6 +127,14 @@ Sets whether the window is always at the top level, defaults to `false`. --always-on-top ``` +#### [app-version] + +Set the version number of the packaged application to be consistent with the naming format of version in package.json, defaulting to `1.0.0`. + +```shell +--app-version +``` + #### [dark-mode] Force Mac to package applications using dark mode, default is `false`. diff --git a/bin/README_CN.md b/bin/README_CN.md index 4d1f1f2..ce7eb30 100644 --- a/bin/README_CN.md +++ b/bin/README_CN.md @@ -127,6 +127,14 @@ pake [url] [options] --always-on-top ``` +#### [app-version] + +设置打包应用的版本号,和 package.json 里面 version 命名格式一致,默认为 `1.0.0`。 + +```shell +--app-version +``` + #### [dark-mode] 强制 Mac 打包应用使用黑暗模式,默认为 `false`。 diff --git a/bin/cli.ts b/bin/cli.ts index 55148c5..fda3ca5 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -38,6 +38,7 @@ program .addOption( new Option('--targets ', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp(), ) + .addOption(new Option('--app-version ', 'App version, the same as package.json version').default(DEFAULT.appVersion).hideHelp()) .addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT.alwaysOnTop).hideHelp()) .addOption(new Option('--dark-mode', 'Force Mac app to use dark mode').default(DEFAULT.darkMode).hideHelp()) .addOption( diff --git a/bin/defaults.ts b/bin/defaults.ts index e5278be..92dcd74 100644 --- a/bin/defaults.ts +++ b/bin/defaults.ts @@ -8,6 +8,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = { resizable: true, hideTitleBar: false, alwaysOnTop: false, + appVersion: '1.0.0', darkMode: false, disabledWebShortcuts: false, activationShortcut: '', diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.ts index cf1f489..96f14f2 100644 --- a/bin/helpers/merge.ts +++ b/bin/helpers/merge.ts @@ -14,6 +14,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon fullscreen, hideTitleBar, alwaysOnTop, + appVersion, darkMode, disabledWebShortcuts, activationShortcut, @@ -47,6 +48,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon tauriConf.productName = name; tauriConf.identifier = identifier; + tauriConf.version = appVersion; if (platform == 'win32') { tauriConf.bundle.windows.wix.language[0] = installerLanguage; diff --git a/bin/types.ts b/bin/types.ts index ac14e6a..c1a0be2 100644 --- a/bin/types.ts +++ b/bin/types.ts @@ -27,6 +27,9 @@ export interface PakeCliOptions { // Enable windows always on top, default false alwaysOnTop: boolean; + // App version, the same as package.json version, default 1.0.0 + appVersion: string; + // Force Mac to use dark mode, default false darkMode: boolean; diff --git a/dist/cli.js b/dist/cli.js index 2c0e43e..b7db743 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -20,7 +20,7 @@ import * as psl from 'psl'; import isUrl from 'is-url'; var name = "pake-cli"; -var version$1 = "3.0.3"; +var version$1 = "3.1.0"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。"; var engines = { node: ">=16.0.0" @@ -70,7 +70,7 @@ var dependencies = { "@tauri-apps/api": "^1.6.0", "@tauri-apps/cli": "^2.1.0", axios: "^1.7.9", - chalk: "^5.4.0", + chalk: "^5.4.1", commander: "^11.1.0", "file-type": "^18.7.0", "fs-extra": "^11.2.0", @@ -426,7 +426,7 @@ async function combineFiles(files, output) { } async function mergeConfig(url, options, tauriConf) { - const { width, height, fullscreen, hideTitleBar, alwaysOnTop, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, } = options; + const { width, height, fullscreen, hideTitleBar, alwaysOnTop, appVersion, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, } = options; const { platform } = process; // Set Windows parameters. const tauriConfWindowOptions = { @@ -443,6 +443,8 @@ async function mergeConfig(url, options, tauriConf) { Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions }); tauriConf.productName = name; tauriConf.identifier = identifier; + console.log('tauriConf appVersion>>>>>>>>>>>>>>>>>>>>>>>', appVersion); + tauriConf.version = appVersion; if (platform == 'win32') { tauriConf.bundle.windows.wix.language[0] = installerLanguage; } @@ -773,6 +775,7 @@ const DEFAULT_PAKE_OPTIONS = { resizable: true, hideTitleBar: false, alwaysOnTop: false, + appVersion: '1.0.0', darkMode: false, disabledWebShortcuts: false, activationShortcut: '', @@ -974,6 +977,7 @@ program .option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch) .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('--app-version ', 'App version, the same as package.json version').default(DEFAULT_PAKE_OPTIONS.appVersion).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') diff --git a/package.json b/package.json index d1cb826..66878d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pake-cli", - "version": "3.0.4", + "version": "3.1.0", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。", "engines": { "node": ">=16.0.0"