chore(deno): finish import extensions for sites/mp-sync paths
- sites/mp-sync relative imports already carry extensions; drop the biome useImportExtensions override and --unstable-sloppy-imports in typecheck:deno - mp-sync scripts: deno shebang (+x), static `import YAML from "yaml"`, README/usage switched to `deno run -A` - verified: check.mjs --to e6820a8 (49 unchanged), movieclaw-import --check (0 diff) Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
569bb29664
commit
608e567edf
7 files changed
+14
-41
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# scripts/mp-sync
|
||||
|
||||
跟随上游移植工具(说明与对照总表:`docs/porting/mp-sync-ledger.md`)。Node 24 或 `deno run -A` 均可运行,不依赖根 package.json / deno.json 任务。
|
||||
跟随上游移植工具(说明与对照总表:`docs/porting/mp-sync-ledger.md`)。用 `deno run -A` 运行(`yaml` 经根 deno.json import map 解析),不依赖 deno.json 任务。
|
||||
|
||||
| 脚本 | 作用 |
|
||||
| --- | --- |
|
||||
@@ -9,9 +9,9 @@
|
||||
| `movieclaw-import.mjs [--repo <MC 仓库>] [--ref v0.27.0] [--check]` | MovieClaw v0.27.0(MIT)站点 YAML → `packages/adapters/src/sites/definitions/*.json` + `manifest.generated.ts`;覆盖层 `movieclaw-overrides/<id>.json`;`--check` 只比较 |
|
||||
|
||||
```bash
|
||||
node scripts/mp-sync/check.mjs --to <新提交>
|
||||
node scripts/mp-sync/build-ledger.mjs --commit <新提交>
|
||||
node scripts/mp-sync/movieclaw-import.mjs --check
|
||||
deno run -A scripts/mp-sync/check.mjs --to <新提交>
|
||||
deno run -A scripts/mp-sync/build-ledger.mjs --commit <新提交>
|
||||
deno run -A scripts/mp-sync/movieclaw-import.mjs --check
|
||||
```
|
||||
|
||||
MovieClaw v0.27.0 之后为附条件许可:`movieclaw-import.mjs` 校验 ref→提交与 LICENSE=MIT,其他 ref 需 `--allow-ref` 并另行核对许可。
|
||||
Regular → Executable
+2
-2
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
#!/usr/bin/env -S deno run -A
|
||||
/**
|
||||
* 生成 scripts/mp-sync/ledger.json 与 docs/porting/mp-sync-ledger.md 中的对照总表。
|
||||
*
|
||||
* node scripts/mp-sync/build-ledger.mjs [--mp /opt/moviepilot-plus/upstream/MoviePilot] [--commit e6820a8]
|
||||
* deno run -A scripts/mp-sync/build-ledger.mjs [--mp /opt/moviepilot-plus/upstream/MoviePilot] [--commit e6820a8]
|
||||
*
|
||||
* 数据来源:源码文件头 `@mp-source <上游路径> @ <提交>` 标签 + ledger.manual.json(未打标签的既有移植)。
|
||||
* 每条记录保存移植时的上游提交与该文件内容 sha256,供 check.mjs 比较。
|
||||
|
||||
Regular → Executable
+3
-3
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
#!/usr/bin/env -S deno run -A
|
||||
/**
|
||||
* 比较 ledger.json 与 MoviePilot 目标提交,列出需要跟随移植的上游变化。
|
||||
*
|
||||
* node scripts/mp-sync/check.mjs [--mp <MP 仓库路径>] [--to <目标提交,默认 HEAD>] [--json]
|
||||
* deno run -A scripts/mp-sync/check.mjs [--mp <MP 仓库路径>] [--to <目标提交,默认 HEAD>] [--json]
|
||||
*
|
||||
* 输出:已变更 / 已删除 / 未变化 的 ledger 文件,监视目录(spider/、parser/)中 ledger 未收录的新文件,
|
||||
* 以及逐文件 `git diff` 命令。存在变化时退出码为 1(可用于 CI 或定时提醒)。
|
||||
@@ -59,7 +59,7 @@ if (args.json) {
|
||||
console.log(`未变化:${unchanged.length}`);
|
||||
if (changed.length || deleted.length || added.length) {
|
||||
console.log(
|
||||
"\n处理流程:按 diff 增量移植 → 把对应源码文件头 `@mp-source ... @ <提交>` 改为新提交(新文件新增标签)→ node scripts/mp-sync/build-ledger.mjs --commit <新提交> → 测试。",
|
||||
"\n处理流程:按 diff 增量移植 → 把对应源码文件头 `@mp-source ... @ <提交>` 改为新提交(新文件新增标签)→ deno run -A scripts/mp-sync/build-ledger.mjs --commit <新提交> → 测试。",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// mp-sync 公共函数(Node 24 / Deno 2 均可运行,无第三方依赖)
|
||||
// mp-sync 公共函数(Deno 2 运行,无第三方依赖)
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
||||
|
||||
Regular → Executable
+3
-20
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
#!/usr/bin/env -S deno run -A
|
||||
/**
|
||||
* MovieClaw v0.27.0(MIT)站点 YAML → 本项目 SiteDefinition JSON 转换器(可重复执行)。
|
||||
*
|
||||
* 用法:
|
||||
* node scripts/mp-sync/movieclaw-import.mjs [--repo spikes/movieclaw-src/repo] [--ref v0.27.0] [--check]
|
||||
* deno run -A scripts/mp-sync/movieclaw-import.mjs [--repo spikes/movieclaw-src/repo] [--ref v0.27.0] [--check]
|
||||
*
|
||||
* - 只用 `git show <ref>:<path>` 读取文件(固定 tag,不读工作区,避免混入许可切换后的内容)。
|
||||
* - 校验 <ref> 解析到的提交与 LICENSE 为 MIT;ref 不是 v0.27.0 时要求 --allow-ref(许可需另行核对)。
|
||||
@@ -17,29 +17,12 @@
|
||||
*/
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import YAML from "yaml";
|
||||
|
||||
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
|
||||
/** yaml 解析器:Deno(根 deno.json import map)或 Node(node_modules)均可 */
|
||||
async function loadYaml() {
|
||||
try {
|
||||
return (await import("yaml")).default;
|
||||
} catch {
|
||||
for (const base of ["packages/adapters/package.json", "package.json"]) {
|
||||
try {
|
||||
return createRequire(join(ROOT, base))("yaml");
|
||||
} catch {
|
||||
/* next */
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error("找不到 yaml 包:请用 `deno run -A scripts/mp-sync/movieclaw-import.mjs` 运行");
|
||||
}
|
||||
const YAML = await loadYaml();
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const opt = (name, def) => {
|
||||
const i = args.indexOf(name);
|
||||
|
||||
Reference in new issue
Block a user