pake-cli 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ecrc.json +1 -1
- package/.vscode/settings.json +3 -7
- package/README.md +22 -2
- package/README_EN.md +1 -1
- package/bin/README.md +1 -1
- package/bin/builders/MacBuilder.ts +1 -1
- package/bin/options/icon.ts +13 -19
- package/bin/utils/shell.ts +8 -8
- package/bin/utils/tlds.ts +1486 -1486
- package/package.json +3 -2
- package/src-tauri/src/main.rs +1 -3
- package/src-tauri/tauri.conf.json +1 -1
- package/dist/cli.js +0 -1918
package/.ecrc.json
CHANGED
package/.vscode/settings.json
CHANGED
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
| <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | 刷新页面 |
|
|
75
75
|
| <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</kbd> + <kbd>w</kbd> | 隐藏窗口,非退出 |
|
|
76
76
|
| <kbd>⌘</kbd> + <kbd>-</kbd> | <kbd>Ctrl</kbd> + <kbd>-</kbd> | 缩小页面 |
|
|
77
|
-
| <kbd>⌘</kbd> + <kbd
|
|
77
|
+
| <kbd>⌘</kbd> + <kbd>+</kbd> | <kbd>Ctrl</kbd> + <kbd>+</kbd> | 放大页面 |
|
|
78
78
|
| <kbd>⌘</kbd> + <kbd>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | 放大页面 |
|
|
79
79
|
| <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | 重置页面缩放 |
|
|
80
80
|
|
|
@@ -82,9 +82,29 @@
|
|
|
82
82
|
|
|
83
83
|
## 注意点
|
|
84
84
|
|
|
85
|
-
- Windows 下不能安装到 C:\Program File
|
|
85
|
+
- Windows 下不能安装到 C:\Program File,会直接闪退。建议安装到其他非管理员权限目录,比如 D:\Program Files (x86) 。
|
|
86
86
|
- Linux 下暂时不能存 cookie,即应用关闭后数据清空,账号自动推出。
|
|
87
87
|
|
|
88
|
+
## 使用命令行打包
|
|
89
|
+
|
|
90
|
+
Pake 提供了命令行工具,可以更快捷方便地打包。(目前仅支持 MacOS)
|
|
91
|
+
|
|
92
|
+
### 安装
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm install -g pake-cli
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
如果安装失败提示没有权限,请使用 `sudo` 运行。
|
|
99
|
+
|
|
100
|
+
### 用法
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pake [options] url
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
更多用法可查看[文档](./bin//README.md)。
|
|
107
|
+
|
|
88
108
|
## 开发
|
|
89
109
|
|
|
90
110
|
开始前参考 [Tauri](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) 快速配置好环境。
|
package/README_EN.md
CHANGED
|
@@ -82,7 +82,7 @@ In addition, it supports double clicking the head to switch to full screen, and
|
|
|
82
82
|
|
|
83
83
|
## Precautions
|
|
84
84
|
|
|
85
|
-
- It cannot be installed to C:\Program File under Windows, and it will crash directly. It is recommended to install to
|
|
85
|
+
- It cannot be installed to C:\Program File under Windows, and it will crash directly. It is recommended to install to other non-administrator directories, such as D:\Program Files (x86) .
|
|
86
86
|
- Under Linux, cookies cannot be stored temporarily, that is, the data will be cleared after the application is closed, and the account will be automatically released.
|
|
87
87
|
|
|
88
88
|
## Development
|
package/bin/README.md
CHANGED
|
@@ -17,7 +17,7 @@ export default class MacBuilder implements IBuilder {
|
|
|
17
17
|
|
|
18
18
|
const res = await prompts({
|
|
19
19
|
type: 'confirm',
|
|
20
|
-
message: '
|
|
20
|
+
message: 'We detected that you have not installed Rust. Install it now?',
|
|
21
21
|
name: 'value',
|
|
22
22
|
});
|
|
23
23
|
|
package/bin/options/icon.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import axios from
|
|
2
|
-
import { fileTypeFromBuffer } from
|
|
3
|
-
import { PakeAppOptions } from
|
|
4
|
-
import { dir } from
|
|
5
|
-
import path from
|
|
6
|
-
import fs from
|
|
7
|
-
import { fileURLToPath } from
|
|
8
|
-
import log from
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { fileTypeFromBuffer } from 'file-type';
|
|
3
|
+
import { PakeAppOptions } from '../types.js';
|
|
4
|
+
import { dir } from 'tmp-promise';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import fs from 'fs/promises';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import log from 'loglevel';
|
|
9
9
|
|
|
10
10
|
export async function handleIcon(options: PakeAppOptions, url: string) {
|
|
11
11
|
if (options.icon) {
|
|
12
|
-
if (options.icon.startsWith(
|
|
13
|
-
log.info(options.icon);
|
|
12
|
+
if (options.icon.startsWith('http')) {
|
|
14
13
|
return downloadIcon(options.icon);
|
|
15
14
|
} else {
|
|
16
15
|
return path.resolve(options.icon);
|
|
@@ -22,14 +21,9 @@ export async function handleIcon(options: PakeAppOptions, url: string) {
|
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export async function inferIcon(name: string, url: string) {
|
|
25
|
-
log.info(
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
const npmDirectory = path.join(
|
|
29
|
-
path.dirname(fileURLToPath(import.meta.url)),
|
|
30
|
-
".."
|
|
31
|
-
);
|
|
32
|
-
return path.join(npmDirectory, "pake-default.icns");
|
|
24
|
+
log.info('You have not provided an app icon, use the default icon(can use --icon option to assign an icon)')
|
|
25
|
+
const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
26
|
+
return path.join(npmDirectory, 'pake-default.icns');
|
|
33
27
|
}
|
|
34
28
|
|
|
35
29
|
// export async function getIconFromPageUrl(url: string) {
|
|
@@ -73,7 +67,7 @@ export async function downloadIcon(iconUrl: string) {
|
|
|
73
67
|
let iconResponse;
|
|
74
68
|
try {
|
|
75
69
|
iconResponse = await axios.get(iconUrl, {
|
|
76
|
-
responseType:
|
|
70
|
+
responseType: 'arraybuffer',
|
|
77
71
|
});
|
|
78
72
|
} catch (error) {
|
|
79
73
|
if (error.response && error.response.status === 404) {
|
package/bin/utils/shell.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import shelljs from
|
|
1
|
+
import shelljs from "shelljs";
|
|
2
2
|
|
|
3
3
|
export function shellExec(command: string) {
|
|
4
4
|
return new Promise<number>((resolve, reject) => {
|
|
5
|
-
shelljs.exec(command, { async: true, silent: false}, (code) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
shelljs.exec(command, { async: true, silent: false }, (code) => {
|
|
6
|
+
if (code === 0) {
|
|
7
|
+
resolve(0);
|
|
8
|
+
} else {
|
|
9
|
+
reject(new Error(`${code}`));
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
12
|
});
|
|
13
13
|
}
|