feat(tauri): 完成桌面端迁移(原生另存为 + plugin-http 取图 + 插件静态化 + 中文注释)
This commit is contained in:
1 parent
4709ec05f2
commit
cddbd1f8eb
72 files changed
+16317
-56
No files matched your search
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
// 桌面版专用:把 plugins/runtime/ 下的运行时插件拷进 dist/plugins/。
|
||||
// 网页版插件由 Cloudflare KV 在 /plugins/* 提供;桌面端没有服务端,只能随包发布。
|
||||
// 刻意不改 scripts/build.js(上游文件),单独一步执行,保持桌面侧差异最小。
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const src = path.join(root, 'plugins', 'runtime')
|
||||
const dst = path.join(root, 'dist', 'plugins')
|
||||
|
||||
if (!fs.existsSync(src)) {
|
||||
console.error('[copy-plugins] 缺少 plugins/runtime,无法打包运行时插件')
|
||||
process.exit(1)
|
||||
}
|
||||
fs.mkdirSync(dst, { recursive: true })
|
||||
|
||||
let count = 0
|
||||
for (const name of fs.readdirSync(src)) {
|
||||
fs.copyFileSync(path.join(src, name), path.join(dst, name))
|
||||
count++
|
||||
}
|
||||
// 索引与插件文件必须同源同包:应用按 index.json 里的 filename 去 /plugins/ 取
|
||||
fs.copyFileSync(path.join(root, 'plugins', 'index.json'), path.join(dst, 'index.json'))
|
||||
console.log('[copy-plugins] 已拷入 ' + count + ' 个插件 → dist/plugins/')
|
||||
@@ -0,0 +1,38 @@
|
||||
<#
|
||||
一次性环境检查(Windows)。不自动安装任何东西,只报告缺什么。
|
||||
用法:右键「使用 PowerShell 运行」,或 powershell -ExecutionPolicy Bypass -File scripts\windows-check.ps1
|
||||
#>
|
||||
$ErrorActionPreference = 'Continue'
|
||||
|
||||
function Show($name, $ok, $hint) {
|
||||
if ($ok) { Write-Host ("[OK] " + $name) -ForegroundColor Green }
|
||||
else { Write-Host ("[缺失] " + $name + " -> " + $hint) -ForegroundColor Yellow }
|
||||
}
|
||||
|
||||
# Node
|
||||
$node = (Get-Command node -ErrorAction SilentlyContinue)
|
||||
Show "Node.js" ($null -ne $node) "winget install OpenJS.NodeJS.LTS"
|
||||
|
||||
# Rust
|
||||
$rustc = (Get-Command rustc -ErrorAction SilentlyContinue)
|
||||
Show "Rust (rustc)" ($null -ne $rustc) "winget install Rustlang.Rustup"
|
||||
if ($rustc) {
|
||||
$v = (& rustc -V) -join ' '
|
||||
Write-Host (" " + $v)
|
||||
if ($v -notmatch 'msvc') {
|
||||
Write-Host " [!] 当前工具链不是 MSVC,请执行: rustup default stable-msvc" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# MSVC 链接器
|
||||
$link = Get-ChildItem "C:\Program Files (x86)\Microsoft Visual Studio" -Recurse -Filter link.exe -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
Show "MSVC Build Tools (link.exe)" ($null -ne $link) "安装 VS 2022 Build Tools 并勾选「使用 C++ 的桌面开发」"
|
||||
|
||||
# WebView2
|
||||
$wv = Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" -ErrorAction SilentlyContinue
|
||||
Show "WebView2 Runtime" ($null -ne $wv) "winget install Microsoft.EdgeWebView2Runtime(Win11 一般自带)"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "全部 OK 后执行:" -ForegroundColor Cyan
|
||||
Write-Host " npm ci"
|
||||
Write-Host " npm run app:build"
|
||||
Reference in new issue
Block a user