dudu-converter-cli 0.0.0-stage → 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 +225 -2
- package/package.json +60 -4
- package/release/cli.js +8 -0
- package/release/registry-schema.json +220 -0
- package/release/registry.json +841 -0
- package/web/dist/MP_verify_90j11A4PBXwsFIsV.txt +1 -0
- package/web/dist/assets/index-BZqxEIrH.js +32 -0
- package/web/dist/assets/index-DuwKbhiJ.css +1 -0
- package/web/dist/gh-qrcode.png +0 -0
- package/web/dist/index.html +13 -0
- package/web/dist/install.ps1 +72 -0
- package/web/dist/install.sh +53 -0
|
@@ -0,0 +1,13 @@
|
|
|
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>嘟嘟转换器 · 本地万能文件转换</title>
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-BZqxEIrH.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DuwKbhiJ.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="app"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# 嘟嘟转换器(dudu-converter-cli)Windows 一键安装脚本(PowerShell 5.1+)
|
|
2
|
+
# 用法:irm <官网域名>/install.ps1 | iex
|
|
3
|
+
$ErrorActionPreference = 'Stop'
|
|
4
|
+
|
|
5
|
+
$PackageSpec = if ($env:CONVERTER_PACKAGE_SPEC) { $env:CONVERTER_PACKAGE_SPEC } else { 'dudu-converter-cli' }
|
|
6
|
+
|
|
7
|
+
function Say($msg) { Write-Host $msg -ForegroundColor Green }
|
|
8
|
+
function Warn($msg) { Write-Host $msg -ForegroundColor Yellow }
|
|
9
|
+
function Die($msg) { Write-Host $msg -ForegroundColor Red; exit 1 }
|
|
10
|
+
|
|
11
|
+
function Test-Node {
|
|
12
|
+
$node = Get-Command node -ErrorAction SilentlyContinue
|
|
13
|
+
if (-not $node) { return $false }
|
|
14
|
+
try {
|
|
15
|
+
$major = [int]((node -v) -replace '^v', '').Split('.')[0]
|
|
16
|
+
return $major -ge 18
|
|
17
|
+
} catch { return $false }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function Refresh-Path {
|
|
21
|
+
$machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
|
|
22
|
+
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
|
|
23
|
+
$env:Path = "$machinePath;$userPath"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (-not (Test-Node)) {
|
|
27
|
+
Say '未检测到 Node.js 18+,准备安装…'
|
|
28
|
+
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
|
29
|
+
winget install --id OpenJS.NodeJS.LTS --accept-source-agreements --accept-package-agreements
|
|
30
|
+
if ($LASTEXITCODE -ne 0) { Die 'Node.js 安装失败,可到 https://nodejs.org 手动安装后重跑本脚本' }
|
|
31
|
+
}
|
|
32
|
+
elseif (Get-Command choco -ErrorAction SilentlyContinue) {
|
|
33
|
+
choco install nodejs-lts -y
|
|
34
|
+
if ($LASTEXITCODE -ne 0) { Die 'Node.js 安装失败,可到 https://nodejs.org 手动安装后重跑本脚本' }
|
|
35
|
+
}
|
|
36
|
+
elseif (Get-Command scoop -ErrorAction SilentlyContinue) {
|
|
37
|
+
scoop install nodejs-lts
|
|
38
|
+
if ($LASTEXITCODE -ne 0) { Die 'Node.js 安装失败,可到 https://nodejs.org 手动安装后重跑本脚本' }
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
Warn '未检测到 winget / choco / scoop。请到 https://nodejs.org 下载 Node.js 18+ 安装包,完成后重跑本脚本'
|
|
42
|
+
exit 1
|
|
43
|
+
}
|
|
44
|
+
# 刚安装的 Node 不会出现在当前会话的 PATH 中,需从注册表重新加载
|
|
45
|
+
Refresh-Path
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Say "正在安装嘟嘟转换器($PackageSpec)…"
|
|
49
|
+
npm install -g $PackageSpec
|
|
50
|
+
if ($LASTEXITCODE -ne 0) { Die '安装失败,请检查网络后重试' }
|
|
51
|
+
|
|
52
|
+
$converter = Get-Command converter -ErrorAction SilentlyContinue
|
|
53
|
+
if (-not $converter) { Die '安装完成但找不到 converter 命令,请重新打开 PowerShell 后重新执行本脚本' }
|
|
54
|
+
Say "安装成功:converter $(converter --version)"
|
|
55
|
+
|
|
56
|
+
# 注册 converter:// 协议句柄:官网「一键启动服务」按钮使用
|
|
57
|
+
reg add "HKCU\Software\Classes\converter" /ve /d "URL:Dudu Converter Protocol" /f | Out-Null
|
|
58
|
+
reg add "HKCU\Software\Classes\converter" /v "URL Protocol" /f | Out-Null
|
|
59
|
+
reg add "HKCU\Software\Classes\converter\shell\open\command" /ve /d "powershell.exe -NoProfile -WindowStyle Hidden -Command \"Start-Process converter -ArgumentList 'start','--daemon','-no-open-browser'\"" /f | Out-Null
|
|
60
|
+
|
|
61
|
+
if ($env:NO_START -eq '1') {
|
|
62
|
+
Say '已跳过启动。之后可随时运行:converter start'
|
|
63
|
+
exit 0
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Say '正在开启开机自启…'
|
|
67
|
+
converter autostart enable | Out-Null
|
|
68
|
+
|
|
69
|
+
Say '正在启动服务,浏览器将自动打开…'
|
|
70
|
+
Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'converter', 'start', '--daemon'
|
|
71
|
+
Start-Sleep -Seconds 2
|
|
72
|
+
Say '完成!若浏览器未自动打开,请访问 http://127.0.0.1:3456'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# 嘟嘟转换器(dudu-converter-cli)macOS 一键安装脚本
|
|
3
|
+
# 用法:curl -fsSL <官网域名>/install.sh | sh
|
|
4
|
+
set -eu
|
|
5
|
+
|
|
6
|
+
PACKAGE_SPEC="${CONVERTER_PACKAGE_SPEC:-dudu-converter-cli}"
|
|
7
|
+
NO_START="${NO_START:-0}"
|
|
8
|
+
|
|
9
|
+
say() { printf '\033[1;32m%s\033[0m\n' "$*"; }
|
|
10
|
+
warn() { printf '\033[1;33m%s\033[0m\n' "$*"; }
|
|
11
|
+
die() { printf '\033[1;31m%s\033[0m\n' "$*" >&2; exit 1; }
|
|
12
|
+
|
|
13
|
+
[ "$(uname)" = "Darwin" ] || die "此安装脚本仅支持 macOS。Windows 用户请在 PowerShell 中运行:irm <官网域名>/install.ps1 | iex"
|
|
14
|
+
|
|
15
|
+
macos_major="$(sw_vers -productVersion | cut -d. -f1)"
|
|
16
|
+
if [ "$macos_major" -lt 12 ] 2>/dev/null; then
|
|
17
|
+
warn "检测到 macOS ${macos_major},推荐使用 macOS 12 及以上版本,继续安装…"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
node_major=0
|
|
21
|
+
if command -v node >/dev/null 2>&1; then
|
|
22
|
+
node_major="$(node -p 'Number(process.versions.node.split(".")[0])')"
|
|
23
|
+
fi
|
|
24
|
+
if [ "$node_major" -lt 18 ]; then
|
|
25
|
+
say "未检测到 Node.js 18+,准备通过 Homebrew 安装…"
|
|
26
|
+
if command -v brew >/dev/null 2>&1; then
|
|
27
|
+
brew install node || die "Node.js 安装失败,可到 https://nodejs.org 手动安装后重跑本脚本"
|
|
28
|
+
else
|
|
29
|
+
warn "未检测到 Homebrew,请先安装 Homebrew(在终端执行):"
|
|
30
|
+
printf ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n'
|
|
31
|
+
warn "或到 https://nodejs.org 下载 Node.js 18+ 安装包,完成后重跑本脚本"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
say "正在安装嘟嘟转换器(${PACKAGE_SPEC})…"
|
|
37
|
+
npm install -g "$PACKAGE_SPEC" || die "安装失败,请检查网络后重试"
|
|
38
|
+
|
|
39
|
+
command -v converter >/dev/null 2>&1 || die "安装完成但找不到 converter 命令,请重新打开终端后重新执行本脚本"
|
|
40
|
+
say "安装成功:converter $(converter --version)"
|
|
41
|
+
|
|
42
|
+
if [ "$NO_START" = "1" ]; then
|
|
43
|
+
say "已按 NO_START=1 跳过启动。之后可随时在终端运行:converter start"
|
|
44
|
+
exit 0
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
say "正在开启开机自启…"
|
|
48
|
+
converter autostart enable >/dev/null 2>&1 || warn "开机自启开启失败,可稍后在设置页开启"
|
|
49
|
+
|
|
50
|
+
say "正在启动服务,浏览器将自动打开…"
|
|
51
|
+
nohup converter start --daemon >/dev/null 2>&1 &
|
|
52
|
+
sleep 2
|
|
53
|
+
say "完成!若浏览器未自动打开,请访问 http://127.0.0.1:3456"
|