pake-cli 0.0.1-beta.9 → 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.
Files changed (90) hide show
  1. package/.ecrc.json +3 -0
  2. package/.editorconfig +24 -0
  3. package/.github/FUNDING.yml +2 -2
  4. package/.github/ISSUE_TEMPLATE/bug.md +13 -0
  5. package/.github/workflows/editorconfig-check.yml +23 -0
  6. package/.github/workflows/main.yml +17 -0
  7. package/.github/workflows/rust-code-quality-check.yml +89 -0
  8. package/.prettierignore +4 -0
  9. package/.vscode/settings.json +3 -6
  10. package/CODE_OF_CONDUCT.md +128 -0
  11. package/CONTRIBUTING.md +26 -0
  12. package/LICENSE +21 -0
  13. package/README.md +195 -54
  14. package/README_EN.md +91 -53
  15. package/app.csv +9 -0
  16. package/bin/README.md +72 -0
  17. package/bin/builders/MacBuilder.ts +14 -15
  18. package/bin/builders/base.ts +10 -1
  19. package/bin/builders/common.ts +9 -4
  20. package/bin/cli.ts +12 -5
  21. package/bin/defaults.ts +1 -0
  22. package/bin/options/icon.ts +38 -46
  23. package/bin/options/index.ts +3 -5
  24. package/bin/types.ts +3 -3
  25. package/bin/utils/shell.ts +9 -8
  26. package/bin/utils/tlds.ts +1489 -0
  27. package/bin/utils/url.ts +26 -0
  28. package/dist/twitter.css +176 -0
  29. package/icns2png.py +38 -0
  30. package/package.json +10 -8
  31. package/pake-default.icns +0 -0
  32. package/rollup.config.js +1 -1
  33. package/script/build.bat +80 -0
  34. package/script/build.sh +122 -0
  35. package/script/sd-apple-x64 +0 -0
  36. package/script/sd-linux-x64 +0 -0
  37. package/script/sd.exe +0 -0
  38. package/src-tauri/Cargo.lock +344 -65
  39. package/src-tauri/Cargo.toml +14 -6
  40. package/src-tauri/assets/com-tw93-weread.desktop +10 -0
  41. package/src-tauri/build.rs +1 -1
  42. package/src-tauri/icons/icon.icns +0 -0
  43. package/src-tauri/icons/reference.icns +0 -0
  44. package/src-tauri/icons/translate.icns +0 -0
  45. package/src-tauri/icons/twitter.icns +0 -0
  46. package/src-tauri/icons/{weRead.icns → weread.icns} +0 -0
  47. package/src-tauri/icons/youtube.icns +0 -0
  48. package/src-tauri/png/code_256.ico +0 -0
  49. package/src-tauri/png/code_32.ico +0 -0
  50. package/src-tauri/png/code_512.png +0 -0
  51. package/src-tauri/png/flomo_256.ico +0 -0
  52. package/src-tauri/png/flomo_32.ico +0 -0
  53. package/src-tauri/png/flomo_512.png +0 -0
  54. package/src-tauri/png/reference_256.ico +0 -0
  55. package/src-tauri/png/reference_32.ico +0 -0
  56. package/src-tauri/png/reference_512.png +0 -0
  57. package/src-tauri/png/tool_256.ico +0 -0
  58. package/src-tauri/png/tool_32.ico +0 -0
  59. package/src-tauri/png/tool_512.png +0 -0
  60. package/src-tauri/png/translate_256.ico +0 -0
  61. package/src-tauri/png/translate_32.ico +0 -0
  62. package/src-tauri/png/translate_512.png +0 -0
  63. package/src-tauri/png/twitter_256.ico +0 -0
  64. package/src-tauri/png/twitter_32.ico +0 -0
  65. package/src-tauri/png/twitter_512.png +0 -0
  66. package/src-tauri/png/weread_256.ico +0 -0
  67. package/src-tauri/png/weread_32.ico +0 -0
  68. package/src-tauri/png/weread_512.png +0 -0
  69. package/src-tauri/png/witeboard_256.ico +0 -0
  70. package/src-tauri/png/witeboard_32.ico +0 -0
  71. package/src-tauri/png/witeboard_512.png +0 -0
  72. package/src-tauri/png/youtube_256.ico +0 -0
  73. package/src-tauri/png/youtube_32.ico +0 -0
  74. package/src-tauri/png/youtube_512.png +0 -0
  75. package/src-tauri/png/yuque_256.ico +0 -0
  76. package/src-tauri/png/yuque_32.ico +0 -0
  77. package/src-tauri/png/yuque_512.png +0 -0
  78. package/src-tauri/src/main.rs +128 -25
  79. package/src-tauri/src/pake.js +140 -77
  80. package/src-tauri/tauri.conf.json +31 -14
  81. package/bin/options/title.ts +0 -14
  82. package/dist/cli.js +0 -399
  83. package/src-tauri/icons/anymind.icns +0 -0
  84. package/src-tauri/icons/fanfou.icns +0 -0
  85. package/src-tauri/icons/fone.icns +0 -0
  86. package/src-tauri/icons/jdread.icns +0 -0
  87. package/src-tauri/icons/jike.icns +0 -0
  88. package/src-tauri/icons/roam.icns +0 -0
  89. package/src-tauri/icons/vercel.icns +0 -0
  90. package/src-tauri/icons/whatsapp.icns +0 -0
package/README.md CHANGED
@@ -1,65 +1,113 @@
1
- <p align="right"><strong>中文</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_EN.md">English</a></p>
1
+ <p align="left"><strong>中文</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_EN.md">English</a></p>
2
2
  <p align="center">
3
- <img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
4
- <h1 align="center">Pake</h1>
5
- <div align="left">很简单的用 Rust 打包网页生成很小的 Mac App,底层使用 Tauri,支持微信读书、Flomo、RunCode、Witeboard、ToolsFun、Vercel 等,详细小白开发教程可见底部。</div>
3
+ <img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
4
+ <h1 align="center">Pake</h1>
5
+ <div align="center">
6
+ <a href="https://twitter.com/HiTw93" target="_blank">
7
+ <img alt="twitter" src="https://img.shields.io/twitter/follow/Hitw93?color=%231D9BF0&label=Pake%20%F0%9F%93%A2%20&logo=Twitter&style=flat-square"></a>
8
+ <a href="https://t.me/miaoyan" target="_blank">
9
+ <img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
10
+ <a href="https://github.com/tw93/Pake/releases" target="_blank">
11
+ <img alt="GitHub downloads" src="https://img.shields.io/github/downloads/tw93/Pake/total.svg?style=flat-square"></a>
12
+ <a href="https://github.com/tw93/Pake/commits" target="_blank">
13
+ <img alt="GitHub commit" src="https://img.shields.io/github/commit-activity/m/tw93/Pake?style=flat-square"></a>
14
+ <a href="https://github.com/tw93/Pake/issues?q=is%3Aissue+is%3Aclosed" target="_blank">
15
+ <img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/tw93/Pake.svg?style=flat-square"></a>
16
+ </div>
17
+ <div align="left">很简单用 Rust 打包网页生成很小的桌面 App,支持 Mac/Windows/Linux 应用,当前已打包微信读书、Twitter、Youtube、Flomo、Reference、RunCode、Google Translate、语雀、Witeboard、Vercel、V2EX、开发工具箱等,欢迎去 <a href=https://github.com/tw93/Pake/discussions>讨论区</a> 交流分享。</div>
6
18
  </p>
7
19
 
8
20
  ## 特征
9
21
 
10
- 🏂 **小**:相比传统的 Electron 套壳打包,大小要小将近 40 倍,一般不到 3M ([数据](https://static.tw93.fun/img/pakedata.png))
22
+ 🏂 **小**:相比传统的 Electron 套壳打包,要小将近 40 倍,不到 3M
11
23
  😂 **快**:Pake 的底层使用的 Rust Tauri 框架,性能体验较 JS 框架要轻快不少,内存小很多
12
- 🩴 **特**:不是单纯打包,实现了通用快捷键的透传、沉浸式的窗口、拖动、打包样式兼容
13
- 🐶 **玩**:只是一个很简单的小玩具,用 Rust 替代之前套壳网页老的思路玩法,PWA 也很好,友好交流勿喷
24
+ 🩴 **特**:不是单纯打包,实现了快捷键的透传、沉浸式的窗口、拖动、样式改写、去广告、产品的极简风格定制
25
+ 🐶 **玩**:只是一个很简单的小玩具,用 Rust 替代之前套壳网页打包的老思路,其实 PWA 也很好
14
26
 
15
- ## 快捷键
16
-
17
- 1. `command + ]`:返回上一个页面
18
- 2. `command + [`:去下一个页面,假如有的话
19
- 3. `command + ↑`:自动滚动到页面顶部
20
- 4. `command + ↓`:自动滚动到页面底部
21
- 5. `command + r`:刷新页面
22
- 6. `command + w`:隐藏窗口,非退出
23
- 7. `command + -`:缩小页面
24
- 8. `command + =`:放大页面
25
- 9. `command + 0`:重置页面缩放
26
-
27
- 此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,还有其他需求,欢迎提过来。
28
-
29
- ## 效果
27
+ ## 下载
30
28
 
31
29
  <table>
32
30
  <tr>
33
31
  <td>WeRead <a href="https://github.com/tw93/Pake/releases/latest/download/WeRead.dmg">Download</a></td>
34
- <td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td>
32
+ <td>Twitter <a href="https://github.com/tw93/Pake/releases/latest/download/Twitter.dmg">Download</a></td>
33
+ </tr>
34
+ <tr>
35
+ <td><img src=https://cdn.fliggy.com/upic/17dC9I.jpg width=600/></td>
36
+ <td><img src=https://cdn.fliggy.com/upic/mc41xq.jpg width=600/></td>
37
+ </tr>
38
+ <tr>
39
+ <td>YouTube <a href="https://github.com/tw93/Pake/releases/latest/download/YouTube.dmg">Download</a></td>
40
+ <td>Reference <a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Download</a></td>
35
41
  </tr>
36
42
  <tr>
37
- <td><img src=https://cdn.fliggy.com/upic/ffUmdj.png width=600/></td>
38
- <td><img src=https://cdn.fliggy.com/upic/B49SAc.png width=600/></td>
43
+ <td><img src=https://cdn.fliggy.com/upic/Ea5ZRw.png width=600/></td>
44
+ <td><img src=https://cdn.fliggy.com/upic/KFsZIY.png width=600/></td>
39
45
  </tr>
40
46
  <tr>
41
47
  <td>RunCode <a href="https://github.com/tw93/Pake/releases/latest/download/RunCode.dmg">Download</a></td>
42
- <td><a href="https://witeboard.com/">Witeboard</a> <a href="https://github.com/tw93/Pake/releases/latest/download/Witeboard.dmg">Download</a></td>
48
+ <td>Google Translate <a href="https://github.com/tw93/Pake/releases/latest/download/GoogleTranslate.dmg">Download</a></td>
43
49
  </tr>
44
50
  <tr>
45
- <td><img src=https://gw.alipayobjects.com/zos/k/qc/SCR-20221018-fmj.png width=600/></td>
46
- <td><img src=https://cdn.fliggy.com/upic/o5QY4c.png width=600/></td>
51
+ <td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td>
52
+ <td><img src=https://cdn.fliggy.com/upic/EmjUGy.png width=600/></td>
47
53
  </tr>
48
54
  <tr>
49
- <td>ToolsFun <a href="https://github.com/tw93/Pake/releases/latest/download/Tools.dmg">Download</a></td>
50
- <td>Vercel <a href="https://github.com/tw93/Pake/releases/latest/download/Vercel.dmg">Download</a></td>
55
+ <td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td>
56
+ <td>YuQue <a href="https://github.com/tw93/Pake/releases/latest/download/YuQue.dmg">Download</a></td>
51
57
  </tr>
52
58
  <tr>
53
- <td><img src=https://cdn.fliggy.com/upic/jVCiL0.png width=600/></td>
54
- <td><img src=https://cdn.fliggy.com/upic/CPVRnY.png width=600/></td>
59
+ <td><img src=https://cdn.fliggy.com/upic/jg9Eeu.jpg width=600/></td>
60
+ <td><img src=https://cdn.fliggy.com/upic/02SZQl.png width=600/></td>
55
61
  </tr>
56
62
  </table>
57
63
 
58
- 更多常用 App 下载可以去 [Release](https://github.com/tw93/Pake/releases) 中看看。
64
+ 更多常用 App 下载可以去 [Releases](https://github.com/tw93/Pake/releases) 中看看。
65
+
66
+ ## 快捷键
67
+
68
+ | Mac | Windows/Linux | 功能 |
69
+ | --------------------------- | ------------------------------ | ------------------ |
70
+ | <kbd>⌘</kbd> + <kbd>[</kbd> | <kbd>Ctrl</kbd> + <kbd>←</kbd> | 返回上一个页面 |
71
+ | <kbd>⌘</kbd> + <kbd>]</kbd> | <kbd>Ctrl</kbd> + <kbd>→</kbd> | 去下一个页面 |
72
+ | <kbd>⌘</kbd> + <kbd>↑</kbd> | <kbd>Ctrl</kbd> + <kbd>↑</kbd> | 自动滚动到页面顶部 |
73
+ | <kbd>⌘</kbd> + <kbd>↓</kbd> | <kbd>Ctrl</kbd> + <kbd>↓</kbd> | 自动滚动到页面底部 |
74
+ | <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | 刷新页面 |
75
+ | <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</kbd> + <kbd>w</kbd> | 隐藏窗口,非退出 |
76
+ | <kbd>⌘</kbd> + <kbd>-</kbd> | <kbd>Ctrl</kbd> + <kbd>-</kbd> | 缩小页面 |
77
+ | <kbd>⌘</kbd> + <kbd>+</kbd> | <kbd>Ctrl</kbd> + <kbd>+</kbd> | 放大页面 |
78
+ | <kbd>⌘</kbd> + <kbd>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | 放大页面 |
79
+ | <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | 重置页面缩放 |
80
+
81
+ 此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,还有其他需求,欢迎提过来。
82
+
83
+ ## 注意点
84
+
85
+ - Windows 下不能安装到 C:\Program File,会直接闪退。建议安装到其他非管理员权限目录,比如 D:\Program Files (x86) 。
86
+ - Linux 下暂时不能存 cookie,即应用关闭后数据清空,账号自动推出。
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)。
59
107
 
60
108
  ## 开发
61
109
 
62
- 开始前参考 [Tauri](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) 快速配置好环境,如果你想打包 Windows、Linux 系统的包,可以参考 [Building](https://tauri.app/v1/guides/building/) 文档
110
+ 开始前参考 [Tauri](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) 快速配置好环境。
63
111
 
64
112
  ```sh
65
113
  // 安装依赖
@@ -68,43 +116,136 @@ npm i
68
116
  // 调试
69
117
  npm run dev
70
118
 
71
- // 打包
119
+ // 打包 Mac 应用
72
120
  npm run build
121
+
122
+ // 打包 Windows 应用
123
+ npm run build:windows
124
+
125
+ // 打包 Linux 应用
126
+ npm run build:linux
127
+
128
+ // 一键打包所有 Mac/Linux 应用
129
+ chmod +x ./script/build.sh && ./script/build.sh
130
+
131
+ // 一键打包所有 Windows 项目
132
+ .\script\build.bat
73
133
  ```
74
134
 
75
135
  ## 打新包
76
136
 
77
- 1. 修改 `src-tauri` 目录下的 `tauri.conf.json` 中的 `url、productName、icon、title、identifier` 这 5 个字段,其中 icon 可以从 icons 目录选择一个,也可以去 [macOSicons](https://macosicons.com/#/) 下载符合产品名称的
78
- 2. 关于窗口属性设置,可以在 `tauri.conf.json` 修改 `windows` 属性对应的 `width/height`,是否全屏 `fullscreen`,是否可以调整大小 `resizable`,假如你不好适配沉浸式头部,可以将 `transparent` 设置成 `true` 即可。
79
- 3. `npm run dev` 本地调试看看效果,此外可以打开 `main.rs` devtools 两处注释(搜索 `_devtools`)进行容器调试
80
- 4. `npm run build` 运行即可打包,假如有打开 devtools 模式,记得注释掉
137
+ 1. 修改 `src-tauri` 目录下的 `tauri.conf.json` 中的 `url、productName、icon、identifier` 这 4 个字段,其中 icon 可以从 icons 目录选择一个,也可以去 [macOSicons](https://macosicons.com/#/) 下载符合产品名称的
138
+ 2. 关于窗口属性设置,可以在 `tauri.conf.json` 修改 `windows` 属性对应的 `width/height`,是否全屏 `fullscreen`,是否可以调整大小 `resizable`,假如想适配 Mac 沉浸式头部,可以将 `transparent` 设置成 `true`,找到 Header 元素加一个 `padding-top` 样式即可,不想适配改成 `false` 也行
139
+ 3. `npm run dev` 本地调试看看效果,此外可以使用 `npm run dev:debug` 进行容器调试
140
+ 4. `npm run build` 运行即可打生产包
81
141
 
82
142
  ## 高级
83
143
 
84
- #### 如何改写样式,如去掉原站广告、不想要的模块、甚至重新设计?
144
+ #### 1. 如何改写样式,如去掉原站广告、不想要的模块、甚至重新设计?
85
145
 
86
- 1. 首先需要打开 devtools 调试模式,找到你需要修改的样式名称,先在 devtools 里面验证效果
87
- 2. 找到 `pake.js` 中样式位置(搜索 `style.innerHTML`),将需要覆盖的样式加上即可,有一些案例你可以模仿
88
- 3. 正式打包前记得干掉 devtools 注释
146
+ 首先需要使用 `npm run dev:debug` 打开 devtools 调试模式,找到你需要修改的样式名称,先在 devtools 里面验证效果;找到 `pake.js` 中样式位置 `style.innerHTML` ,将需要覆盖的样式加上即可,有一些案例你可以模仿。
89
147
 
90
- #### 如何注入 JS 的逻辑,比如实现事件监听,比如说键盘快捷键?
148
+ #### 2. 如何注入 JS 的逻辑,比如实现事件监听,比如说键盘快捷键?
91
149
 
92
- 1. 和上面1案例中准备工作一致
93
- 2. 参考 `pake.js` 中事件监听(搜索`document.addEventListener`),直接编写即可,这里更多是基础前端的技术
150
+ 参考 `pake.js` 中事件监听 `document.addEventListener`,直接编写即可,这里更多是基础前端的技术。
94
151
 
95
- #### 如何进行容器内的事件和 Pake 通信,比如说 Web 的拖拽、滚动、特殊点击传递啥的?
152
+ #### 3. 如何进行容器内的事件和 Pake 通信,比如说 Web 的拖拽、滚动、特殊点击传递啥的?
96
153
 
97
- 1. 和上面1案例中准备工作一致
98
- 2. 参考 `pake.js` 中通信代码(搜索 `postMessage`),写好事件监听,然后用 `window.ipc.postMessage`将事件以及参数传递出来
99
- 3. 然后参考容器接收事件(搜索 `window.drag_window`),自己处理即可,更多可以参考 tauri 以及 wry 的官方文档
154
+ 参考 `pake.js` 中通信代码 `postMessage`,写好事件监听,然后用 `window.ipc.postMessage` 将事件以及参数传递出来,然后参考容器接收事件 `window.drag_window`,自己处理即可,更多可以参考 tauri 以及 wry 的官方文档。
100
155
 
101
156
  ## 贡献者
102
157
 
103
- <a href="https://github.com/tw93/pake/graphs/contributors">
104
- <img src="https://contrib.rocks/image?repo=tw93/pake" />
105
- </a>
158
+ <!-- readme: contributors -start -->
159
+ <table>
160
+ <tr>
161
+ <td align="center">
162
+ <a href="https://github.com/tw93">
163
+ <img src="https://avatars.githubusercontent.com/u/8736212?v=4" width="90;" alt="tw93"/>
164
+ <br />
165
+ <sub><b>Tw93</b></sub>
166
+ </a>
167
+ </td>
168
+ <td align="center">
169
+ <a href="https://github.com/Tlntin">
170
+ <img src="https://avatars.githubusercontent.com/u/28218658?v=4" width="90;" alt="Tlntin"/>
171
+ <br />
172
+ <sub><b>Tlntin</b></sub>
173
+ </a>
174
+ </td>
175
+ <td align="center">
176
+ <a href="https://github.com/pan93412">
177
+ <img src="https://avatars.githubusercontent.com/u/28441561?v=4" width="90;" alt="pan93412"/>
178
+ <br />
179
+ <sub><b>Pan93412</b></sub>
180
+ </a>
181
+ </td>
182
+ <td align="center">
183
+ <a href="https://github.com/liby">
184
+ <img src="https://avatars.githubusercontent.com/u/38807139?v=4" width="90;" alt="liby"/>
185
+ <br />
186
+ <sub><b>Bryan Lee</b></sub>
187
+ </a>
188
+ </td>
189
+ <td align="center">
190
+ <a href="https://github.com/m1911star">
191
+ <img src="https://avatars.githubusercontent.com/u/4948120?v=4" width="90;" alt="m1911star"/>
192
+ <br />
193
+ <sub><b>Horus</b></sub>
194
+ </a>
195
+ </td>
196
+ <td align="center">
197
+ <a href="https://github.com/QingZ11">
198
+ <img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>
199
+ <br />
200
+ <sub><b>Steam</b></sub>
201
+ </a>
202
+ </td>
203
+ <td align="center">
204
+ <a href="https://github.com/2nthony">
205
+ <img src="https://avatars.githubusercontent.com/u/19513289?v=4" width="90;" alt="2nthony"/>
206
+ <br />
207
+ <sub><b>2nthony</b></sub>
208
+ </a>
209
+ </td></tr>
210
+ <tr>
211
+ <td align="center">
212
+ <a href="https://github.com/AielloChan">
213
+ <img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
214
+ <br />
215
+ <sub><b>Aiello</b></sub>
216
+ </a>
217
+ </td>
218
+ <td align="center">
219
+ <a href="https://github.com/houhoz">
220
+ <img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
221
+ <br />
222
+ <sub><b>Hyzhao</b></sub>
223
+ </a>
224
+ </td>
225
+ <td align="center">
226
+ <a href="https://github.com/liusishan">
227
+ <img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
228
+ <br />
229
+ <sub><b>Null</b></sub>
230
+ </a>
231
+ </td>
232
+ <td align="center">
233
+ <a href="https://github.com/piaoyidage">
234
+ <img src="https://avatars.githubusercontent.com/u/5135405?v=4" width="90;" alt="piaoyidage"/>
235
+ <br />
236
+ <sub><b>Ranger</b></sub>
237
+ </a>
238
+ </td></tr>
239
+ </table>
240
+ <!-- readme: contributors -end -->
241
+
242
+ ## 支持
243
+
244
+ - 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 Pake 让你生活更美好,可以给汤圆可乐 <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">喂罐头 🥩🍤</a>。
245
+ - 如果你喜欢 Pake,可以在 Github Star,更欢迎 [推荐](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=Pake%20%E4%B8%80%E4%B8%AA%E5%BE%88%E7%AE%80%E5%8D%95%E7%9A%84%E7%94%A8%20Rust%20%E6%89%93%E5%8C%85%E7%BD%91%E9%A1%B5%E7%94%9F%E6%88%90%20Mac%20App%20%E7%9A%84%E5%B7%A5%E5%85%B7%EF%BC%8C%E7%9B%B8%E6%AF%94%E4%BC%A0%E7%BB%9F%E7%9A%84%20Electron%20%E5%A5%97%E5%A3%B3%E6%89%93%E5%8C%85%EF%BC%8C%E5%A4%A7%E5%B0%8F%E8%A6%81%E5%B0%8F%E5%B0%86%E8%BF%91%2040%20%E5%80%8D%EF%BC%8C%E4%B8%80%E8%88%AC%202M%20%E5%B7%A6%E5%8F%B3%EF%BC%8C%E5%BA%95%E5%B1%82%E4%BD%BF%E7%94%A8Tauri%20%EF%BC%8C%E6%80%A7%E8%83%BD%E4%BD%93%E9%AA%8C%E8%BE%83%20JS%20%E6%A1%86%E6%9E%B6%E8%A6%81%E8%BD%BB%E5%BF%AB%E4%B8%8D%E5%B0%91%EF%BC%8C%E5%86%85%E5%AD%98%E5%B0%8F%E5%BE%88%E5%A4%9A%EF%BC%8C%E6%94%AF%E6%8C%81%E5%BE%AE%E4%BF%A1%E8%AF%BB%E4%B9%A6%E3%80%81Twitter%E3%80%81Youtube%E3%80%81RunCode%E3%80%81Flomo%E3%80%81%E8%AF%AD%E9%9B%80%E7%AD%89%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%BE%88%E6%96%B9%E4%BE%BF%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91~) 给你志同道合的朋友使用。
246
+ - 可以关注我的 [Twitter](https://twitter.com/HiTw93) 获取到最新的 Pake 更新消息,也欢迎加入 [Telegram](https://t.me/miaoyan) 聊天群。
106
247
 
107
248
  ## 最后
108
249
 
109
250
  1. 希望大伙玩的过程中有一种学习新技术的喜悦感,如果有新点子欢迎告诉我
110
- 2. 假如你发现有很适合做成 Mac App 的网页也很欢迎告诉我,我给加到里面来
251
+ 2. 假如你发现有很适合做成桌面 App 的网页也很欢迎告诉我,我给加到里面来
package/README_EN.md CHANGED
@@ -1,65 +1,93 @@
1
- <p align="right"><a href="https://github.com/tw93/Pake">中文</a> | <strong>English</strong></p>
1
+ <p align="left"><a href="https://github.com/tw93/Pake">中文</a> | <strong>English</strong></p>
2
2
  <p align="center">
3
- <img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
4
- <h1 align="center">Pake</h1>
5
- <div align="left">A simple way to package a web page with Rust to create Mac App, using Tauri as underlying layer, supporting WeRead、Flomo、RunCode、ToolsFun、Witeboard、Vercel, detailed development tutorial can be seen at the bottom.</div>
3
+ <img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
4
+ <h1 align="center">Pake</h1>
5
+ <div align="center">
6
+ <a href="https://twitter.com/HiTw93" target="_blank">
7
+ <img alt="twitter" src="https://img.shields.io/twitter/follow/Hitw93?color=%231D9BF0&label=Pake%20%F0%9F%93%A2%20&logo=Twitter&style=flat-square"></a>
8
+ <a href="https://t.me/miaoyan" target="_blank">
9
+ <img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
10
+ <a href="https://github.com/tw93/Pake/releases" target="_blank">
11
+ <img alt="GitHub downloads" src="https://img.shields.io/github/downloads/tw93/Pake/total.svg?style=flat-square"></a>
12
+ <a href="https://github.com/tw93/Pake/commits" target="_blank">
13
+ <img alt="GitHub commit" src="https://img.shields.io/github/commit-activity/m/tw93/Pake?style=flat-square"></a>
14
+ <a href="https://github.com/tw93/Pake/issues?q=is%3Aissue+is%3Aclosed" target="_blank">
15
+ <img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/tw93/Pake.svg?style=flat-square"></a>
16
+ </div>
17
+ <div align="left">A simple way to package a web page to desktop application, supporting Mac/Windows/Linux, now has packaging WeRead、Twitter、Youtube、Reference、Flomo、YuQue、Google Translate、Witeboard、RunCode、Vercel、V2EX、DevTools, welcome to <a href=https://github.com/tw93/Pake/discussions>Discussions</a> to see if there have anything you interesting.</div>
6
18
  </p>
7
19
 
8
20
  ## Features
9
21
 
10
- 🏂 **Small**:Nearly 40 times smaller than the Electron shell package, less than 3M ([Data](https://static.tw93.fun/img/pakedata.png)).
22
+ 🏂 **Small**:Nearly 40 times smaller than Electron package, less than 3M.
11
23
  😂 **Fast**:Using the Rust Tauri, the performance experience is much lighter and faster than JS, memory is much smaller.
12
- 🩴 **Special**:Not just packaged, with universal shortcut pass-through, immersive windows, drag-and-drop, packaged style compatibility.
24
+ 🩴 **Special**:Not just packaged, with shortcut pass-through, immersive windows, minimalist customization of products.
13
25
  🐶 **Toy**:Just a very simple little toy, a way to play with Rust instead of the old idea of shelling the web.
14
26
 
15
- ## Shortcuts
16
-
17
- 1. `command + [`:Return to the previous page
18
- 2. `command + ]`:Go to the next page
19
- 3. `command + ↑`:Auto scroll to top of page
20
- 4. `command + ↓`:Auto scroll to bottom of page
21
- 5. `command + r`:Refresh Page
22
- 6. `command + w`:Hide window, not quite
23
- 7. `command + -`:ZoomOut Page
24
- 8. `command + =`:ZoomIn Page
25
- 9. `command + 0`:Reset Page zoom
26
-
27
- In addition, it supports double clicking the head to switch to full screen, and dragging the head to move the window
28
-
29
- ## Effects
27
+ ## Download
30
28
 
31
29
  <table>
32
30
  <tr>
33
31
  <td>WeRead <a href="https://github.com/tw93/Pake/releases/latest/download/WeRead.dmg">Download</a></td>
34
- <td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td>
32
+ <td>Twitter <a href="https://github.com/tw93/Pake/releases/latest/download/Twitter.dmg">Download</a></td>
35
33
  </tr>
36
34
  <tr>
37
- <td><img src=https://cdn.fliggy.com/upic/ffUmdj.png width=600/></td>
38
- <td><img src=https://cdn.fliggy.com/upic/B49SAc.png width=600/></td>
35
+ <td><img src=https://cdn.fliggy.com/upic/17dC9I.jpg width=600/></td>
36
+ <td><img src=https://cdn.fliggy.com/upic/mc41xq.jpg width=600/></td>
37
+ </tr>
38
+ <tr>
39
+ <td>YouTube <a href="https://github.com/tw93/Pake/releases/latest/download/YouTube.dmg">Download</a></td>
40
+ <td>Reference <a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Download</a></td>
41
+ </tr>
42
+ <tr>
43
+ <td><img src=https://cdn.fliggy.com/upic/Ea5ZRw.png width=600/></td>
44
+ <td><img src=https://cdn.fliggy.com/upic/KFsZIY.png width=600/></td>
39
45
  </tr>
40
46
  <tr>
41
47
  <td>RunCode <a href="https://github.com/tw93/Pake/releases/latest/download/RunCode.dmg">Download</a></td>
42
- <td><a href="https://witeboard.com/">Witeboard</a> <a href="https://github.com/tw93/Pake/releases/latest/download/Witeboard.dmg">Download</a></td>
48
+ <td>Google Translate <a href="https://github.com/tw93/Pake/releases/latest/download/GoogleTranslate.dmg">Download</a></td>
43
49
  </tr>
44
50
  <tr>
45
- <td><img src=https://gw.alipayobjects.com/zos/k/qc/SCR-20221018-fmj.png width=600/></td>
46
- <td><img src=https://cdn.fliggy.com/upic/o5QY4c.png width=600/></td>
51
+ <td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td>
52
+ <td><img src=https://cdn.fliggy.com/upic/EmjUGy.png width=600/></td>
47
53
  </tr>
48
54
  <tr>
49
- <td>ToolsFun <a href="https://github.com/tw93/Pake/releases/latest/download/Tools.dmg">Download</a></td>
50
- <td>Vercel <a href="https://github.com/tw93/Pake/releases/latest/download/Vercel.dmg">Download</a></td>
55
+ <td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td>
56
+ <td>YuQue <a href="https://github.com/tw93/Pake/releases/latest/download/YuQue.dmg">Download</a></td>
51
57
  </tr>
52
58
  <tr>
53
- <td><img src=https://cdn.fliggy.com/upic/jVCiL0.png width=600/></td>
54
- <td><img src=https://cdn.fliggy.com/upic/CPVRnY.png width=600/></td>
59
+ <td><img src=https://cdn.fliggy.com/upic/jg9Eeu.jpg width=600/></td>
60
+ <td><img src=https://cdn.fliggy.com/upic/02SZQl.png width=600/></td>
55
61
  </tr>
56
62
  </table>
57
63
 
58
- More common apps can be downloaded from [Release](https://github.com/tw93/Pake/releases).
64
+ More common apps can be downloaded from [Releases](https://github.com/tw93/Pake/releases).
65
+
66
+ ## Shortcuts
67
+
68
+ | Mac | Windows/Linux | Function |
69
+ | --------------------------- | ------------------------------ | ----------------------------- |
70
+ | <kbd>⌘</kbd> + <kbd>[</kbd> | <kbd>Ctrl</kbd> + <kbd>←</kbd> | Return to the previous page |
71
+ | <kbd>⌘</kbd> + <kbd>]</kbd> | <kbd>Ctrl</kbd> + <kbd>→</kbd> | Go to the next page |
72
+ | <kbd>⌘</kbd> + <kbd>↑</kbd> | <kbd>Ctrl</kbd> + <kbd>↑</kbd> | Auto scroll to top of page |
73
+ | <kbd>⌘</kbd> + <kbd>↓</kbd> | <kbd>Ctrl</kbd> + <kbd>↓</kbd> | Auto scroll to bottom of page |
74
+ | <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | Refresh Page |
75
+ | <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</kbd> + <kbd>w</kbd> | Hide window, not quite |
76
+ | <kbd>⌘</kbd> + <kbd>-</kbd> | <kbd>Ctrl</kbd> + <kbd>-</kbd> | Zoom out the page |
77
+ | <kbd>⌘</kbd> + <kbd>+</kbd> | <kbd>Ctrl</kbd> + <kbd>+</kbd> | Zoom in the page |
78
+ | <kbd>⌘</kbd> + <kbd>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | Zoom in the Page |
79
+ | <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | Reset the page zoom |
80
+
81
+ In addition, it supports double clicking the head to switch to full screen, and dragging the head to move the window
82
+
83
+ ## Precautions
84
+
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
+ - 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.
59
87
 
60
88
  ## Development
61
89
 
62
- Refer to the [Tauri documentation](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) to quickly configure your environment before you start, if you want to package Windows or Linux systems, you can refer to [Building](https://tauri.app/v1/guides/building/) Documentation.
90
+ Refer to the [Tauri documentation](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) to quickly configure your environment before you start.
63
91
 
64
92
  ```sh
65
93
  // Install Dependencies
@@ -68,41 +96,51 @@ npm i
68
96
  // Local development
69
97
  npm run dev
70
98
 
71
- // Pack
99
+ // Pack Mac application
72
100
  npm run build
101
+
102
+ // Pack Windows application
103
+ npm run build:windows
104
+
105
+ // Pack Linux application
106
+ npm run build:linux
107
+
108
+ // One-click packaging of all Linux/Mac projects
109
+ chmod +x build.sh && ./build.sh
110
+
111
+ // One-click packaging of all Windows projects
112
+ .\build.bat
73
113
  ```
74
114
 
115
+ // Package all your projects in one click
116
+ chmod +x build.sh && ./build.sh
117
+
75
118
  ## New pack
76
119
 
77
- 1. Modify the `tauri.conf.json` in the `src-tauri` directory to include 5 fields `url, productName, icon, title, identifier`, icon can be selected from the `icons` directory or downloaded from [macOSicons](https://macosicons.com/#/) to match the product.
78
- 2. For window property settings, you can modify the `width/height` of the `windows` property in `tauri.conf.json`, whether it is `fullscreen`, whether it is `resizable`, if you are not good at adapting immersive headers, you can set `transparent` to `true` and you're done.
79
- 3. `npm run dev` for local debugging, and open the devtools comments in `main.rs` (search for `_devtools`) for container debugging.
80
- 4. `npm run build` can be run to package, if you have devtools mode open, remember to comment it out.
120
+ 1. Modify the `tauri.conf.json` in the `src-tauri` directory to include 4 fields `url, productName, icon, identifier`, icon can be selected from the `icons` directory or downloaded from [macOSicons](https://macosicons.com/#/) to match the product.
121
+ 2. For window property settings, you can modify the `width/height` of the `windows` property in `tauri.conf.json`, whether it is `fullscreen`, whether it is `resizable`, If you want to adapt the immersive header under Mac, you can set `transparent` to `true` and then find header element and add the `padding-top` style.
122
+ 3. `npm run dev` for local debugging; `npm run dev:debug` to open the devtools for container debugging.
123
+ 4. `npm run build` can be run to package for production.
81
124
 
82
125
  ## Advanced
83
126
 
84
- #### How do I rewrite the style, e.g. to remove ads from the original site, or even redesign it?
127
+ #### 1. How do I rewrite the style, e.g. to remove ads from the original site, or even redesign it?
85
128
 
86
- 1. first open devtools debug mode, find the name of the style you want to change and verify the effect in devtools first.
87
- 2. find the location of the style in `pake.js` (search for `style.innerHTML`) and add the style you need to override, there are some examples you can copy.
88
- 3. Remember to remove the devtools comments before packaging.
129
+ First, open devtools debug mode with `npm run dev:debug`. After that, find the name of the style you want to change and verify the effect in devtools, and find the location of the style in `pake.js` with `style.innerHTML`. Finally, add the style you need to override, there are some examples you can copy.
89
130
 
90
- #### How to inject js code, e.g. to implement event listeners, e.g. keyboard shortcuts?
131
+ #### 2. How to inject js code, e.g. to implement event listeners, e.g. keyboard shortcuts?
91
132
 
92
- 1. Same preparation as in case 1 above.
93
- 2. refer to the event listener in `pake.js` (search for `document.addEventListener`), and write it directly, it's more of a basic front-end technique here.
133
+ Refer to the event listener in `pake.js` with `document.addEventListener`, and write it directly, it's more of a basic front-end technique here.
94
134
 
95
- #### How to communicate with Pake about events in containers, such as dragging and dropping, scrolling, special clicks on the Web, etc.?
135
+ #### 3. How to communicate with Pake about events in containers, such as dragging and dropping, scrolling, special clicks on the Web, etc.?
96
136
 
97
- 1. the same preparation as in 1 above.
98
- 2. refer to the communication code in `pake.js` (search for `postMessage`), write the event listener and then use `window.ipc.postMessage` to pass the event and its parameters.
99
- 3. then refer to the container to receive events (search for `window.drag_window`) and handle them yourself. for more information, refer to tauri and wry's official documentation.
137
+ Refer to the communication code in `pake.js` with `postMessage`, write the event listener and then use `window.ipc.postMessage` to pass the event and its parameters, then refer to the container to receive events `window.drag_window` and handle them yourself, for more information, refer to tauri and wry's official documentation.
100
138
 
101
- ## Contributors
139
+ ## Support
102
140
 
103
- <a href="https://github.com/tw93/pake/graphs/contributors">
104
- <img src="https://contrib.rocks/image?repo=tw93/pake" />
105
- </a>
141
+ - I have two cats, one is called TangYuan, and one is called Coke, If you think Pake makes your life better, you can give my cats <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">feed canned food 🥩🍤</a>.
142
+ - If you like Pake, you can star it in Github. We are more welcome to [recommend Pake](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=Pake%20-%20A%20simple%20Rust%20packaged%20web%20pages%20to%20generate%20Mac%20App%20tool,%20compared%20to%20traditional%20Electron%20package,%20the%20size%20of%20nearly%2040%20times%20smaller,%20generally%20about%202M,%20the%20underlying%20use%20of%20Tauri,%20performance%20experience%20than%20the%20JS%20framework%20is%20much%20lighter~) to your like-minded friends.
143
+ - You can follow my [Twitter](https://twitter.com/HiTw93) to get the latest news of Pake, or join [Telegram](https://t.me/miaoyan) chat group.
106
144
 
107
145
  ## Finally
108
146
 
package/app.csv ADDED
@@ -0,0 +1,9 @@
1
+ name(Linux),name(Mac/Windows),name_zh,url
2
+ twitter,Twitter,推特,https://twitter.com/
3
+ translate,GoogleTranslate,谷歌翻译,https://translate.google.com/
4
+ youtube,YouTube,YouTube,https://youtube.com
5
+ reference,Reference,Reference,https://wangchujiang.com/reference/index.html
6
+ code,Code,Code,https://riju.codes/
7
+ yuque,YuQue,语雀,https://www.yuque.com/
8
+ flomo,Flomo,浮墨,https://flomoapp.com/mine
9
+ weread,WeRead,微信阅读,https://weread.qq.com/
package/bin/README.md ADDED
@@ -0,0 +1,72 @@
1
+ ## 安装
2
+
3
+ ```bash
4
+ npm install -g pake-cli
5
+ ```
6
+
7
+ 如果安装失败提示没有权限,请使用 `sudo` 运行。
8
+
9
+ ## 用法
10
+
11
+ ```bash
12
+ pake [options] url
13
+ ```
14
+ 打包完成后的应用程序默认为当前工作目录。
15
+
16
+ Note: 打包需要用 `Rust` 环境,如果没有 `Rust`,会提示确认安装。如遇安装失败或超时,可[自行安装](https://www.rust-lang.org/tools/install)。
17
+
18
+ Note: 目前仅支持 MacOs,后续会支持其他平台。
19
+
20
+
21
+ ### url
22
+ url 为你需要打包的网页链接🔗,必须提供。
23
+
24
+ ### [options]
25
+
26
+ 提供了一些特定的选项,打包时可以传递对应参数达到定制化的效果。
27
+
28
+ #### [name]
29
+ 应用名称,如输入时未指定,会提示你输入。
30
+ ```shell
31
+ --name <value>
32
+ ```
33
+
34
+ #### [icon]
35
+ 应用icon,支持本地/远程文件,默认为 Pake 自带图标。
36
+ - MacOS下必须为 `.icns`
37
+ ```shell
38
+ --icon <path>
39
+ ```
40
+
41
+ #### [height]
42
+ 打包后的应用窗口高度,默认 `800px`。
43
+ ```
44
+ --height <number>
45
+ ```
46
+
47
+
48
+ #### [width]
49
+ 打包后的应用窗口宽度,默认 `1280px`。
50
+ ```
51
+ --width <number>
52
+ ```
53
+
54
+
55
+ #### [transparent]
56
+ 是否开启沉浸式头部,默认为 `false` 不开启。
57
+ ```
58
+ --transparent
59
+ ```
60
+
61
+
62
+ #### [resize]
63
+ 是否可以拖动大小,默认为 `true` 可拖动。
64
+ ```
65
+ --no-resizable
66
+ ```
67
+
68
+ #### [fullscreen]
69
+ 打开应用后是否开启全屏,默认为 `false`。
70
+ ```
71
+ --fullscreen <value>
72
+ ```