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
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