✨ CLI support set app version
This commit is contained in:
8
bin/README.md
vendored
8
bin/README.md
vendored
@@ -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 <string>
|
||||
```
|
||||
|
||||
#### [dark-mode]
|
||||
|
||||
Force Mac to package applications using dark mode, default is `false`.
|
||||
|
||||
8
bin/README_CN.md
vendored
8
bin/README_CN.md
vendored
@@ -127,6 +127,14 @@ pake [url] [options]
|
||||
--always-on-top
|
||||
```
|
||||
|
||||
#### [app-version]
|
||||
|
||||
设置打包应用的版本号,和 package.json 里面 version 命名格式一致,默认为 `1.0.0`。
|
||||
|
||||
```shell
|
||||
--app-version <string>
|
||||
```
|
||||
|
||||
#### [dark-mode]
|
||||
|
||||
强制 Mac 打包应用使用黑暗模式,默认为 `false`。
|
||||
|
||||
1
bin/cli.ts
vendored
1
bin/cli.ts
vendored
@@ -38,6 +38,7 @@ program
|
||||
.addOption(
|
||||
new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp(),
|
||||
)
|
||||
.addOption(new Option('--app-version <string>', '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(
|
||||
|
||||
1
bin/defaults.ts
vendored
1
bin/defaults.ts
vendored
@@ -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: '',
|
||||
|
||||
2
bin/helpers/merge.ts
vendored
2
bin/helpers/merge.ts
vendored
@@ -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;
|
||||
|
||||
3
bin/types.ts
vendored
3
bin/types.ts
vendored
@@ -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;
|
||||
|
||||
|
||||
10
dist/cli.js
vendored
10
dist/cli.js
vendored
@@ -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 <string>', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp())
|
||||
.addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT_PAKE_OPTIONS.targets).hideHelp())
|
||||
.addOption(new Option('--app-version <string>', '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')
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user