add multi-architecture support for MacOS

This commit is contained in:
Tlntin
2023-01-26 12:18:50 +08:00
parent c6555370dc
commit c3f8b628f0
7 changed files with 55 additions and 34 deletions

14
bin/README.md vendored
View File

@@ -99,7 +99,7 @@ url 为你需要打包的网页链接 🔗,必须提供。
#### [transparent]
是否开启沉浸式头部,默认为 `false` 不开启。
是否开启沉浸式头部,默认为 `false` 不开启。使用下面的命令来开启该功能。
```shell
--transparent
@@ -109,7 +109,7 @@ url 为你需要打包的网页链接 🔗,必须提供。
#### [resize]
是否可以拖动大小,默认为 `true` 可拖动。
是否可以拖动大小,默认为 `true` 可拖动。使用下面的命令来关闭该功能。
```shell
--no-resizable
@@ -117,12 +117,12 @@ url 为你需要打包的网页链接 🔗,必须提供。
#### [fullscreen]
打开应用后是否开启全屏,默认为 `false`。
打开应用后是否开启全屏,默认为 `false`,使用下面的命令开启该功能
```shell
--fullscreen <value>
--fullscreen
# 或者
-f <value>
-f
```
#### [multi-arch]
@@ -140,7 +140,7 @@ rustup target add x86_64-apple-darwin
```
##### 使用方法
```shell
--multi-arch <value>
--multi-arch
# 或者
-m <value>
-m
```

12
bin/README_EN.md vendored
View File

@@ -98,7 +98,7 @@ The width of the packaged application window. The default is `1200px`.
#### [transparent]
Whether to enable the immersive header. The default is `false`.
Whether to enable the immersive header. The default is `false`. Use the command below to enable this feature.
```shell
--transparent
@@ -109,6 +109,7 @@ Whether to enable the immersive header. The default is `false`.
#### [resize]
Indicates if the window can be resized. The default value is `true`.
Use the command below to disable this feature.
```shell
--no-resizable
@@ -117,11 +118,12 @@ Indicates if the window can be resized. The default value is `true`.
#### [fullscreen]
Indicates if the window should be full screen on application launch. The default is `false`.
Use the command below to enable this feature.
```shell
--fullscreen <value>
--fullscreen
# or
-f <value>
-f
```
#### [multi-arch]
@@ -139,7 +141,7 @@ rustup target add x86_64-apple-darwin
```
##### Instructions
```shell
--multi-arch <value>
--multi-arch
# or
-m <value>
-m
```

View File

@@ -40,7 +40,7 @@ export default class MacBuilder implements IBuilder {
await mergeTauriConfig(url, options, tauriConf);
let dmgName: string;
if (options.multi_arch) {
if (options.multiArch) {
await shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
} else {
@@ -53,7 +53,7 @@ export default class MacBuilder implements IBuilder {
}
dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
}
const appPath = this.getBuildAppPath(npmDirectory, dmgName, options.multi_arch);
const appPath = this.getBuildAppPath(npmDirectory, dmgName, options.multiArch);
const distPath = path.resolve(`${name}.dmg`);
await fs.copyFile(appPath, distPath);
await fs.unlink(appPath);

2
bin/cli.ts vendored
View File

@@ -22,7 +22,7 @@ program
.option('-f, --fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
.option('-t, --transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
.option('-d, --debug', 'debug', DEFAULT_PAKE_OPTIONS.debug)
.option('-m, --multi-arch', "Supports both Intel and m1 chips, only for Mac.", DEFAULT_PAKE_OPTIONS.multi_arch)
.option('-m, --multi-arch', "Supports both Intel and m1 chips, only for Mac.", DEFAULT_PAKE_OPTIONS.multiArch)
.action(async (url: string, options: PakeCliOptions) => {
await checkUpdateTips();

2
bin/defaults.ts vendored
View File

@@ -8,7 +8,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
resizable: true,
transparent: false,
debug: false,
multi_arch: false,
multiArch: false,
};
export const DEFAULT_APP_NAME = 'Pake';

2
bin/types.ts vendored
View File

@@ -24,7 +24,7 @@ export interface PakeCliOptions {
debug: boolean;
/** mutli arch, Supports both Intel and m1 chips, only for Mac */
multi_arch: boolean;
multiArch: boolean;
}
export interface PakeAppOptions extends PakeCliOptions {