pake-cli 0.0.1-beta.1
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/README.md +110 -0
- package/README_EN.md +110 -0
- package/dist/.gitkeep +0 -0
- package/dist/builders/BuilderFactory.js +11 -0
- package/dist/builders/BuilderFactory.js.map +1 -0
- package/dist/builders/LinuxBuilder.js +2 -0
- package/dist/builders/LinuxBuilder.js.map +1 -0
- package/dist/builders/MacBuilder.js +74 -0
- package/dist/builders/MacBuilder.js.map +1 -0
- package/dist/builders/WinBulider.js +2 -0
- package/dist/builders/WinBulider.js.map +1 -0
- package/dist/builders/base.js +2 -0
- package/dist/builders/base.js.map +1 -0
- package/dist/builders/common.js +38 -0
- package/dist/builders/common.js.map +1 -0
- package/dist/cli.js +34 -0
- package/dist/cli.js.map +1 -0
- package/dist/defaults.js +10 -0
- package/dist/defaults.js.map +1 -0
- package/dist/helpers/dir.js +9 -0
- package/dist/helpers/dir.js.map +1 -0
- package/dist/helpers/path.js +2 -0
- package/dist/helpers/path.js.map +1 -0
- package/dist/helpers/prepareCheck.js +53 -0
- package/dist/helpers/prepareCheck.js.map +1 -0
- package/dist/helpers/rust.js +31 -0
- package/dist/helpers/rust.js.map +1 -0
- package/dist/helpers/tauriConfig.js +8 -0
- package/dist/helpers/tauriConfig.js.map +1 -0
- package/dist/options/icon.js +111 -0
- package/dist/options/icon.js.map +1 -0
- package/dist/options/index.js +27 -0
- package/dist/options/index.js.map +1 -0
- package/dist/options/title.js +25 -0
- package/dist/options/title.js.map +1 -0
- package/dist/pake.js +43 -0
- package/dist/pake.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/platform.js +4 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/shell.js +14 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/url.js +20 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/validate.js +18 -0
- package/dist/utils/validate.js.map +1 -0
- package/package.json +60 -0
- package/src-tauri/Cargo.lock +3609 -0
- package/src-tauri/Cargo.toml +30 -0
- package/src-tauri/build.rs +3 -0
- package/src-tauri/icons/anymind.icns +0 -0
- package/src-tauri/icons/code.icns +0 -0
- package/src-tauri/icons/fanfou.icns +0 -0
- package/src-tauri/icons/flomo.icns +0 -0
- package/src-tauri/icons/fone.icns +0 -0
- package/src-tauri/icons/jdread.icns +0 -0
- package/src-tauri/icons/jike.icns +0 -0
- package/src-tauri/icons/roam.icns +0 -0
- package/src-tauri/icons/tool.icns +0 -0
- package/src-tauri/icons/twitter.icns +0 -0
- package/src-tauri/icons/vercel.icns +0 -0
- package/src-tauri/icons/weRead.icns +0 -0
- package/src-tauri/icons/whatsapp.icns +0 -0
- package/src-tauri/icons/witeboard.icns +0 -0
- package/src-tauri/icons/yuque.icns +0 -0
- package/src-tauri/src/main.rs +114 -0
- package/src-tauri/src/pake.js +130 -0
- package/src-tauri/tauri.conf.json +63 -0
- package/tsconfig.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<p align="right"><strong>中文</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_EN.md">English</a></p>
|
|
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>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
## 特征
|
|
9
|
+
|
|
10
|
+
🏂 **小**:相比传统的 Electron 套壳打包,大小要小将近 40 倍,一般不到 3M ([数据](https://static.tw93.fun/img/pakedata.png))
|
|
11
|
+
😂 **快**:Pake 的底层使用的 Rust Tauri 框架,性能体验较 JS 框架要轻快不少,内存小很多
|
|
12
|
+
🩴 **特**:不是单纯打包,实现了通用快捷键的透传、沉浸式的窗口、拖动、打包样式兼容
|
|
13
|
+
🐶 **玩**:只是一个很简单的小玩具,用 Rust 替代之前套壳网页老的思路玩法,PWA 也很好,友好交流勿喷
|
|
14
|
+
|
|
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
|
+
## 效果
|
|
30
|
+
|
|
31
|
+
<table>
|
|
32
|
+
<tr>
|
|
33
|
+
<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>
|
|
35
|
+
</tr>
|
|
36
|
+
<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>
|
|
39
|
+
</tr>
|
|
40
|
+
<tr>
|
|
41
|
+
<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>
|
|
43
|
+
</tr>
|
|
44
|
+
<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>
|
|
47
|
+
</tr>
|
|
48
|
+
<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>
|
|
51
|
+
</tr>
|
|
52
|
+
<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>
|
|
55
|
+
</tr>
|
|
56
|
+
</table>
|
|
57
|
+
|
|
58
|
+
更多常用 App 下载可以去 [Release](https://github.com/tw93/Pake/releases) 中看看。
|
|
59
|
+
|
|
60
|
+
## 开发
|
|
61
|
+
|
|
62
|
+
开始前参考 [Tauri](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) 快速配置好环境,如果你想打包 Windows、Linux 系统的包,可以参考 [Building](https://tauri.app/v1/guides/building/) 文档
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
// 安装依赖
|
|
66
|
+
npm i
|
|
67
|
+
|
|
68
|
+
// 调试
|
|
69
|
+
npm run dev
|
|
70
|
+
|
|
71
|
+
// 打包
|
|
72
|
+
npm run build
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 打新包
|
|
76
|
+
|
|
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 模式,记得注释掉
|
|
81
|
+
|
|
82
|
+
## 高级
|
|
83
|
+
|
|
84
|
+
#### 如何改写样式,如去掉原站广告、不想要的模块、甚至重新设计?
|
|
85
|
+
|
|
86
|
+
1. 首先需要打开 devtools 调试模式,找到你需要修改的样式名称,先在 devtools 里面验证效果
|
|
87
|
+
2. 找到 `pake.js` 中样式位置(搜索 `style.innerHTML`),将需要覆盖的样式加上即可,有一些案例你可以模仿
|
|
88
|
+
3. 正式打包前记得干掉 devtools 注释
|
|
89
|
+
|
|
90
|
+
#### 如何注入 JS 的逻辑,比如实现事件监听,比如说键盘快捷键?
|
|
91
|
+
|
|
92
|
+
1. 和上面1案例中准备工作一致
|
|
93
|
+
2. 参考 `pake.js` 中事件监听(搜索`document.addEventListener`),直接编写即可,这里更多是基础前端的技术
|
|
94
|
+
|
|
95
|
+
#### 如何进行容器内的事件和 Pake 通信,比如说 Web 的拖拽、滚动、特殊点击传递啥的?
|
|
96
|
+
|
|
97
|
+
1. 和上面1案例中准备工作一致
|
|
98
|
+
2. 参考 `pake.js` 中通信代码(搜索 `postMessage`),写好事件监听,然后用 `window.ipc.postMessage`将事件以及参数传递出来
|
|
99
|
+
3. 然后参考容器接收事件(搜索 `window.drag_window`),自己处理即可,更多可以参考 tauri 以及 wry 的官方文档
|
|
100
|
+
|
|
101
|
+
## 贡献者
|
|
102
|
+
|
|
103
|
+
<a href="https://github.com/tw93/pake/graphs/contributors">
|
|
104
|
+
<img src="https://contrib.rocks/image?repo=tw93/pake" />
|
|
105
|
+
</a>
|
|
106
|
+
|
|
107
|
+
## 最后
|
|
108
|
+
|
|
109
|
+
1. 希望大伙玩的过程中有一种学习新技术的喜悦感,如果有新点子欢迎告诉我
|
|
110
|
+
2. 假如你发现有很适合做成 Mac App 的网页也很欢迎告诉我,我给加到里面来
|
package/README_EN.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<p align="right"><a href="https://github.com/tw93/Pake">中文</a> | <strong>English</strong></p>
|
|
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>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
🏂 **Small**:Nearly 40 times smaller than the Electron shell package, less than 3M ([Data](https://static.tw93.fun/img/pakedata.png)).
|
|
11
|
+
😂 **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.
|
|
13
|
+
🐶 **Toy**:Just a very simple little toy, a way to play with Rust instead of the old idea of shelling the web.
|
|
14
|
+
|
|
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
|
|
30
|
+
|
|
31
|
+
<table>
|
|
32
|
+
<tr>
|
|
33
|
+
<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>
|
|
35
|
+
</tr>
|
|
36
|
+
<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>
|
|
39
|
+
</tr>
|
|
40
|
+
<tr>
|
|
41
|
+
<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>
|
|
43
|
+
</tr>
|
|
44
|
+
<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>
|
|
47
|
+
</tr>
|
|
48
|
+
<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>
|
|
51
|
+
</tr>
|
|
52
|
+
<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>
|
|
55
|
+
</tr>
|
|
56
|
+
</table>
|
|
57
|
+
|
|
58
|
+
More common apps can be downloaded from [Release](https://github.com/tw93/Pake/releases).
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
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.
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
// Install Dependencies
|
|
66
|
+
npm i
|
|
67
|
+
|
|
68
|
+
// Local development
|
|
69
|
+
npm run dev
|
|
70
|
+
|
|
71
|
+
// Pack
|
|
72
|
+
npm run build
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## New pack
|
|
76
|
+
|
|
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.
|
|
81
|
+
|
|
82
|
+
## Advanced
|
|
83
|
+
|
|
84
|
+
#### How do I rewrite the style, e.g. to remove ads from the original site, or even redesign it?
|
|
85
|
+
|
|
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.
|
|
89
|
+
|
|
90
|
+
#### How to inject js code, e.g. to implement event listeners, e.g. keyboard shortcuts?
|
|
91
|
+
|
|
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.
|
|
94
|
+
|
|
95
|
+
#### How to communicate with Pake about events in containers, such as dragging and dropping, scrolling, special clicks on the Web, etc.?
|
|
96
|
+
|
|
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.
|
|
100
|
+
|
|
101
|
+
## Contributors
|
|
102
|
+
|
|
103
|
+
<a href="https://github.com/tw93/pake/graphs/contributors">
|
|
104
|
+
<img src="https://contrib.rocks/image?repo=tw93/pake" />
|
|
105
|
+
</a>
|
|
106
|
+
|
|
107
|
+
## Finally
|
|
108
|
+
|
|
109
|
+
1. I hope that you will enjoy playing with it and let me know if you have any new ideas.
|
|
110
|
+
2. If you find a page that would be great for a Mac App, please let me know and I'll add it to the list.
|
package/dist/.gitkeep
ADDED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IS_MAC } from '../utils/platform.js';
|
|
2
|
+
import MacBuilder from './MacBuilder.js';
|
|
3
|
+
export default class BuilderFactory {
|
|
4
|
+
static create() {
|
|
5
|
+
if (IS_MAC) {
|
|
6
|
+
return new MacBuilder();
|
|
7
|
+
}
|
|
8
|
+
throw new Error('The current system does not support');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=BuilderFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuilderFactory.js","sourceRoot":"","sources":["../../bin/builders/BuilderFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,MAAM,CAAC,MAAM;QACX,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,UAAU,EAAE,CAAC;SACzB;QACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinuxBuilder.js","sourceRoot":"","sources":["../../bin/builders/LinuxBuilder.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import fs from 'fs/promises';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import prompts from 'prompts';
|
|
13
|
+
import { checkRustInstalled, installRust } from '../helpers/rust.js';
|
|
14
|
+
import appRootPath from 'app-root-path';
|
|
15
|
+
import { shellExec } from '../utils/shell.js';
|
|
16
|
+
export default class MacBuilder {
|
|
17
|
+
prepare() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
if (checkRustInstalled()) {
|
|
20
|
+
console.log('Rust has been installed');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
console.warn('Rust is not installed, show prompt');
|
|
24
|
+
const res = yield prompts({
|
|
25
|
+
type: 'confirm',
|
|
26
|
+
message: 'Detect you have not installed Rust, install it now?',
|
|
27
|
+
name: 'value',
|
|
28
|
+
});
|
|
29
|
+
if (res.value) {
|
|
30
|
+
// TODO 国内有可能会超时
|
|
31
|
+
yield installRust();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.error('Error: Pake need Rust to package your webapp!!!');
|
|
35
|
+
process.exit(2);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
build(url, options) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
console.log('PakeAppOptions', options);
|
|
42
|
+
const tauriConfPath = path.join(appRootPath.path, 'src-tauri/tauri.conf.json');
|
|
43
|
+
const tauriConfString = yield fs.readFile(tauriConfPath, 'utf-8');
|
|
44
|
+
try {
|
|
45
|
+
const tauriConf = JSON.parse(tauriConfString);
|
|
46
|
+
const { width, height, fullscreen, transparent, title, resizable, identifier, name } = options;
|
|
47
|
+
const tauriConfWindowOptions = {
|
|
48
|
+
width,
|
|
49
|
+
height,
|
|
50
|
+
fullscreen,
|
|
51
|
+
transparent,
|
|
52
|
+
title,
|
|
53
|
+
resizable,
|
|
54
|
+
};
|
|
55
|
+
Object.assign(tauriConf.tauri.windows[0], Object.assign({ url }, tauriConfWindowOptions));
|
|
56
|
+
tauriConf.package.productName = name;
|
|
57
|
+
tauriConf.tauri.bundle.identifier = identifier;
|
|
58
|
+
tauriConf.tauri.bundle.icon = [options.icon];
|
|
59
|
+
yield fs.writeFile(tauriConfPath, JSON.stringify(tauriConf, null, 2));
|
|
60
|
+
const code = yield shellExec(`${path.join(appRootPath.path, '/node_modules/.bin/tauri')} build --config ${tauriConfPath} --target universal-apple-darwin`);
|
|
61
|
+
const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
|
|
62
|
+
yield fs.copyFile(this.getBuildedAppPath(dmgName), path.resolve(dmgName));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error('handle tauri.conf.json error', error);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
getBuildedAppPath(dmgName) {
|
|
71
|
+
return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=MacBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MacBuilder.js","sourceRoot":"","sources":["../../bin/builders/MacBuilder.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WinBulider.js","sourceRoot":"","sources":["../../bin/builders/WinBulider.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../bin/builders/base.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { checkRustInstalled, installRust } from '../helpers/rust.js';
|
|
12
|
+
import appRootPath from 'app-root-path';
|
|
13
|
+
import prompts from 'prompts';
|
|
14
|
+
export function prepareCheck() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
if (checkRustInstalled()) {
|
|
17
|
+
console.log('Rust has been installed');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
console.warn('Rust is not installed, show prompt');
|
|
21
|
+
const res = yield prompts({
|
|
22
|
+
type: 'confirm',
|
|
23
|
+
message: 'Detect you have not installed Rust, install it now?',
|
|
24
|
+
name: 'value',
|
|
25
|
+
});
|
|
26
|
+
if (res.value) {
|
|
27
|
+
yield installRust();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.error('Error: Pake need Rust to package your webapp!!!');
|
|
31
|
+
process.exit(2);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function getBuildedAppPath(name, version) {
|
|
36
|
+
return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', `${name}_${version}_universal.dmg`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../bin/builders/common.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,UAAgB,YAAY;;QAChC,IAAI,kBAAkB,EAAE,EAAE;YACxB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;YACvC,OAAO;SACR;QAED,OAAO,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;YACxB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,qDAAqD;YAC9D,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,KAAK,EAAE;YACb,MAAM,WAAW,EAAE,CAAC;SACrB;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;CAAA;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,OAAe;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,4DAA4D,EAAE,GAAG,IAAI,IAAI,OAAO,gBAAgB,CAAC,CAAC;AACvI,CAAC"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { program } from 'commander';
|
|
12
|
+
import { DEFAULT_PAKE_OPTIONS } from './defaults.js';
|
|
13
|
+
import { validateNumberInput, validateUrlInput } from './utils/validate.js';
|
|
14
|
+
import handleInputOptions from './options/index.js';
|
|
15
|
+
import BuilderFactory from './builders/BuilderFactory.js';
|
|
16
|
+
program.version('0.0.1').description('A cli application can build website to app, driven by tauri');
|
|
17
|
+
program
|
|
18
|
+
.argument('<url>', 'the web url you want to package', validateUrlInput)
|
|
19
|
+
.option('--name <string>', 'application name')
|
|
20
|
+
.option('--title <string>', 'application window title')
|
|
21
|
+
.option('--icon <string>', 'application icon', DEFAULT_PAKE_OPTIONS.icon)
|
|
22
|
+
.option('--height <number>', 'application window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
|
|
23
|
+
.option('--width <number>', 'application window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
|
|
24
|
+
.option('--no-resizable', 'whether the application window can be resizable', DEFAULT_PAKE_OPTIONS.resizable)
|
|
25
|
+
.option('--fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
|
|
26
|
+
.option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
|
|
27
|
+
.action((url, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
const builder = BuilderFactory.create();
|
|
29
|
+
yield builder.prepare();
|
|
30
|
+
const appOptions = yield handleInputOptions(options, url);
|
|
31
|
+
builder.build(url, appOptions);
|
|
32
|
+
}));
|
|
33
|
+
program.parse();
|
|
34
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../bin/cli.ts"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,kBAAkB,MAAM,oBAAoB,CAAC;AACpD,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAE1D,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,6DAA6D,CAAC,CAAC;AAEpG,OAAO;KACJ,QAAQ,CAAC,OAAO,EAAE,iCAAiC,EAAE,gBAAgB,CAAC;KACtE,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;KAC7C,MAAM,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;KACtD,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,CAAC,IAAI,CAAC;KACxE,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,MAAM,CAAC;KAC1G,MAAM,CAAC,kBAAkB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,KAAK,CAAC;KACvG,MAAM,CAAC,gBAAgB,EAAE,iDAAiD,EAAE,oBAAoB,CAAC,SAAS,CAAC;KAC3G,MAAM,CAAC,cAAc,EAAE,6CAA6C,EAAE,oBAAoB,CAAC,UAAU,CAAC;KACtG,MAAM,CAAC,eAAe,EAAE,uBAAuB,EAAE,oBAAoB,CAAC,WAAW,CAAC;KAClF,MAAM,CAAC,CAAO,GAAW,EAAE,OAAuB,EAAE,EAAE;IACrD,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;IACxC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IAExB,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAE1D,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AACjC,CAAC,CAAA,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/defaults.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../bin/defaults.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAmB;IAClD,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,KAAK;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
export function getDirName() {
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
6
|
+
console.log('directory-name 👉️', __dirname);
|
|
7
|
+
return __dirname;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dir.js","sourceRoot":"","sources":["../../src/helpers/dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,MAAM,UAAU,UAAU;IACxB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAElD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IAC5C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/helpers/path.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import shelljs from 'shelljs';
|
|
11
|
+
import prompts from 'prompts';
|
|
12
|
+
import ora from 'ora';
|
|
13
|
+
import { shellExec } from '../utils/shell.js';
|
|
14
|
+
const InstallRustScript = "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
|
|
15
|
+
export function prepareCheck() {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
if (checkRustInstalled()) {
|
|
18
|
+
console.log('Rust has been installed');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.warn('Rust is not installed, show prompt');
|
|
22
|
+
const res = yield prompts({
|
|
23
|
+
type: 'confirm',
|
|
24
|
+
message: 'Detect you have not installed Rust, install it now?',
|
|
25
|
+
name: 'value',
|
|
26
|
+
});
|
|
27
|
+
if (res.value) {
|
|
28
|
+
yield installRust();
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.error('Error: Pake need Rust to package your webapp!!!');
|
|
32
|
+
process.exit(2);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function checkRustInstalled() {
|
|
37
|
+
return shelljs.exec('rustc --version', { silent: true }).code === 0;
|
|
38
|
+
}
|
|
39
|
+
function installRust() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const spinner = ora('Downloading Rust').start();
|
|
42
|
+
try {
|
|
43
|
+
yield shellExec(InstallRustScript);
|
|
44
|
+
spinner.succeed();
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error('install rust return code', error.message);
|
|
48
|
+
spinner.fail();
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=prepareCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareCheck.js","sourceRoot":"","sources":["../../src/helpers/prepareCheck.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,iBAAiB,GAAG,yEAAyE,CAAC;AAEpG,MAAM,UAAgB,YAAY;;QAChC,IAAI,kBAAkB,EAAE,EAAE;YACxB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;YACvC,OAAO;SACR;QAED,OAAO,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;YACxB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,qDAAqD;YAC9D,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,KAAK,EAAE;YACb,MAAM,WAAW,EAAE,CAAC;SACrB;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;CAAA;AAED,SAAS,kBAAkB;IACzB,OAAO,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,SAAe,WAAW;;QACxB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,CAAC;QAChD,IAAI;YACF,MAAM,SAAS,CAAC,iBAAiB,CAAC,CAAC;YACnC,OAAO,CAAC,OAAO,EAAE,CAAC;SACnB;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACzD,OAAO,CAAC,IAAI,EAAE,CAAC;YAEf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import ora from 'ora';
|
|
11
|
+
import shelljs from 'shelljs';
|
|
12
|
+
import { shellExec } from '../utils/shell.js';
|
|
13
|
+
const InstallRustScript = "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
|
|
14
|
+
export function installRust() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const spinner = ora('Downloading Rust').start();
|
|
17
|
+
try {
|
|
18
|
+
yield shellExec(InstallRustScript);
|
|
19
|
+
spinner.succeed();
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error('install rust return code', error.message);
|
|
23
|
+
spinner.fail();
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function checkRustInstalled() {
|
|
29
|
+
return shelljs.exec('rustc --version', { silent: true }).code === 0;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=rust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rust.js","sourceRoot":"","sources":["../../bin/helpers/rust.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,iBAAiB,GAAG,yEAAyE,CAAC;AACpG,MAAM,UAAgB,WAAW;;QAC/B,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,CAAC;QAChD,IAAI;YACF,MAAM,SAAS,CAAC,iBAAiB,CAAC,CAAC;YACnC,OAAO,CAAC,OAAO,EAAE,CAAC;SACnB;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACzD,OAAO,CAAC,IAAI,EAAE,CAAC;YAEf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;CAAA;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
export function getIdentifier(name, url) {
|
|
3
|
+
const hash = crypto.createHash('md5');
|
|
4
|
+
hash.update(url);
|
|
5
|
+
const postFixHash = hash.digest('hex').substring(0, 6);
|
|
6
|
+
return `pake-${postFixHash}`;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=tauriConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tauriConfig.js","sourceRoot":"","sources":["../../bin/helpers/tauriConfig.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,GAAW;IACrD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjB,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,OAAO,QAAQ,WAAW,EAAE,CAAC;AAC/B,CAAC"}
|