CLI support set app version

This commit is contained in:
Tw93
2024-12-23 20:35:13 +08:00
parent 712e830006
commit 7a02d8fb71
8 changed files with 31 additions and 4 deletions

8
bin/README.md vendored
View File

@@ -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
View File

@@ -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
View File

@@ -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
View File

@@ -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: '',

View File

@@ -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
View File

@@ -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;