@yufengtadian/freedom-cli 1.0.0
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 +100 -0
- package/bin/freedom.js +11 -0
- package/lib/build.js +173 -0
- package/lib/cli.js +145 -0
- package/lib/config.js +68 -0
- package/lib/init.js +43 -0
- package/lib/utils.js +70 -0
- package/package.json +27 -0
- package/postinstall.js +36 -0
- package/templates/go/gen_config.go +19 -0
- package/templates/go/go.mod +5 -0
- package/templates/go/main.go +12 -0
- package/templates/go/pkg/freedom/assets/freedom.js +97 -0
- package/templates/go/pkg/freedom/assets_embed.go +18 -0
- package/templates/go/pkg/freedom/backend.go +21 -0
- package/templates/go/pkg/freedom/backend_proc.go +250 -0
- package/templates/go/pkg/freedom/bridge.go +129 -0
- package/templates/go/pkg/freedom/center_other.go +7 -0
- package/templates/go/pkg/freedom/center_windows.go +42 -0
- package/templates/go/pkg/freedom/freedom.go +257 -0
- package/templates/go/pkg/freedom/proc_hide_other.go +8 -0
- package/templates/go/pkg/freedom/proc_hide_windows.go +15 -0
- package/templates/go/pkg/freedom/window_other.go +25 -0
- package/templates/go/pkg/freedom/window_windows.go +133 -0
- package/templates/project/freedom.config.js +42 -0
- package/templates/project/index.html +82 -0
- package/templates/project/package.json +14 -0
- package/templates/project/src/main.js +26 -0
- package/templates/project/vite.config.js +18 -0
- package/tutorial/tutorial.html +81 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Freedom CLI - 快速上手</title>
|
|
7
|
+
<style>
|
|
8
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
9
|
+
body {
|
|
10
|
+
font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
|
|
11
|
+
background: #0f172a; color: #e2e8f0;
|
|
12
|
+
line-height: 1.7; padding: 40px 20px;
|
|
13
|
+
}
|
|
14
|
+
.wrap { max-width: 720px; margin: 0 auto; }
|
|
15
|
+
h1 { font-size: 26px; margin-bottom: 6px; }
|
|
16
|
+
.sub { color: #94a3b8; font-size: 14px; margin-bottom: 28px; }
|
|
17
|
+
h2 {
|
|
18
|
+
font-size: 17px; margin: 26px 0 10px;
|
|
19
|
+
padding-left: 10px; border-left: 3px solid #6366f1;
|
|
20
|
+
}
|
|
21
|
+
p, li { font-size: 14px; color: #cbd5e1; }
|
|
22
|
+
ul { padding-left: 22px; }
|
|
23
|
+
code {
|
|
24
|
+
background: #1e293b; color: #a5b4fc; padding: 2px 7px;
|
|
25
|
+
border-radius: 6px; font-size: 13px;
|
|
26
|
+
}
|
|
27
|
+
pre {
|
|
28
|
+
background: #1e293b; color: #e2e8f0; padding: 14px 16px;
|
|
29
|
+
border-radius: 10px; font-size: 13px; overflow-x: auto; margin: 10px 0;
|
|
30
|
+
}
|
|
31
|
+
pre code { background: none; padding: 0; color: inherit; }
|
|
32
|
+
.tip {
|
|
33
|
+
margin-top: 30px; padding: 14px 16px; border-radius: 10px;
|
|
34
|
+
background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.35);
|
|
35
|
+
font-size: 13px; color: #a5b4fc;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
40
|
+
<div class="wrap">
|
|
41
|
+
<h1>Freedom CLI</h1>
|
|
42
|
+
<div class="sub">WebView 桌面壳打包工具 · 任意语言后端 · 三平台</div>
|
|
43
|
+
|
|
44
|
+
<h2>1. 新建项目</h2>
|
|
45
|
+
<pre><code>freedom init my-app
|
|
46
|
+
cd my-app
|
|
47
|
+
npm install</code></pre>
|
|
48
|
+
|
|
49
|
+
<h2>2. 调整标题栏(终端一键切换)</h2>
|
|
50
|
+
<ul>
|
|
51
|
+
<li><code>freedom titlebar native</code> — 保留系统原生标题栏(默认)</li>
|
|
52
|
+
<li><code>freedom titlebar hidden</code> — 隐藏标题栏视觉,仅保留 Windows 原生最小化 / 最大化 / 关闭按钮</li>
|
|
53
|
+
<li><code>freedom titlebar frameless</code> — 完全无边框,按钮由前端自绘(模板已内置示例)</li>
|
|
54
|
+
</ul>
|
|
55
|
+
<p>也可以直接编辑 <code>freedom.config.js</code> 里的 <code>titlebar</code> 字段。</p>
|
|
56
|
+
|
|
57
|
+
<h2>3. 打包</h2>
|
|
58
|
+
<pre><code>freedom build</code></pre>
|
|
59
|
+
<p>前端会先经 Vite 打成单文件 HTML,再嵌入 Go 壳层编译出可执行文件。产物默认在 <code>dist/</code> 目录,且以 GUI 子系统编译,运行时不会弹出 cmd 黑窗。</p>
|
|
60
|
+
|
|
61
|
+
<h2>3.5 调整产物目录(终端一键切换)</h2>
|
|
62
|
+
<pre><code>freedom config set outDir . # 输出到项目根目录(dist 的上级)
|
|
63
|
+
freedom config set outDir dist # 恢复默认 dist/</code></pre>
|
|
64
|
+
<p><code>outDir</code> 支持任意相对 / 绝对路径。输出到项目根目录时自动跳过 <code>index.html</code> 副本,不会覆盖项目源文件。</p>
|
|
65
|
+
|
|
66
|
+
<h2>4. 配置项(freedom.config.js)</h2>
|
|
67
|
+
<pre><code>{
|
|
68
|
+
name: 'my-app', // 应用名 / 窗口标题 / exe 文件名
|
|
69
|
+
width: 1024, height: 720,
|
|
70
|
+
minWidth: 400, minHeight: 300,
|
|
71
|
+
center: true, // 启动居中
|
|
72
|
+
debug: false, // 开发者工具
|
|
73
|
+
titlebar: 'native', // native | hidden | frameless
|
|
74
|
+
outDir: 'dist', // 产物目录:dist(默认)| .(项目根目录)| 任意路径
|
|
75
|
+
backend: undefined, // 任意语言后端进程,如 { command: 'node', args: ['backend/main.mjs'] }
|
|
76
|
+
}</code></pre>
|
|
77
|
+
|
|
78
|
+
<div class="tip">提示:freedom CLI 生成的每个文件都干净整洁,无任何冗余尾注,可直接作为交付产物使用。</div>
|
|
79
|
+
</div>
|
|
80
|
+
</body>
|
|
81
|
+
</html>
|