diff --git a/.github/workflows/data-update.yml b/.github/workflows/data-update.yml index 79a2400..cfc793f 100644 --- a/.github/workflows/data-update.yml +++ b/.github/workflows/data-update.yml @@ -2,8 +2,8 @@ name: Data updates on: schedule: - # Daily at 03:17 UTC (11:17 Asia/Shanghai), away from the hourly rush. - - cron: "17 3 * * *" + # Sunday at 00:00 Asia/Shanghai is Saturday at 16:00 UTC. + - cron: "0 16 * * 6" workflow_dispatch: permissions: diff --git a/README.md b/README.md index d043c71..7bf6987 100644 --- a/README.md +++ b/README.md @@ -3,24 +3,6 @@ 离线查询 IPv4 / IPv6 的国家、地区、城市和运营商,支持 Node.js、Bun、Deno,零运行时依赖。 内置双栈 XDB 数据,也可使用自己的 XDB、IP2Location BIN、IPIP IPDB 文件,或接入自定义数据源。 -## 从 3.x 升级 - -4.0 统一使用类构造器,并明确区分同步与异步方法。已有 3.x 调用需要调整: - -| 3.x | 4.0 | -| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | -| `createLookup(source, options)` | `new IP2Region({ source, ...options })`,从根入口导入 | -| `createAsyncLookup(source, options)` | `new AsyncIP2Region({ source, ...options })` | -| 原生入口 `openDefault(options)` | `await IP2Region.open(options)` | -| 原生入口 `openDatabase(path, factory, options)` | 内置格式使用 `await IP2Region.open({ database: { format, path }, ...options })`;自定义读取器通过 `source` 接入 | -| 异步客户端 `lookup/lookupMany/lookupManySettled/close` | `lookupAsync/lookupManyAsync/lookupManySettledAsync/closeAsync` | -| 异步 adapter 的 `close()` | `closeAsync()`;`lookupAsync()` 保持不变 | - -同步查询方法不变,外部来源仍默认借用。构造原生客户端时会同步读文件;需要保留异步加载行为, -请使用 `IP2Region.open()`。3.x 类型 `ReaderFactory` 和 `DefaultOptions` 不再导出;原生入口现在提供 -`IP2RegionOptions`、`DatabaseOptions`、`DatabasesOptions`,自定义来源使用根入口的 adapter 类型。 -运行时最低版本与 3.0 相同,见下表。 - ## 安装 | 运行时 | 最低版本 | 安装 | @@ -190,8 +172,26 @@ settled 版本保留每项成功或失败的结果并继续查询。并发上限 仓库提供显式的 `data:stage`、`data:validate`、`data:apply` 命令,用于固定 upstream revision、 暂存候选快照、校验两份文件并生成变化报告,再更新数据与元信息。 -GitHub Actions 的 `Data updates` 每天 UTC 03:17(北京时间 11:17)检查上游,内容变化且校验通过后 +GitHub Actions 的 `Data updates` 每周日北京时间 00:00(UTC 周六 16:00)检查上游,内容变化且校验通过后 自动创建或更新数据 PR,也可手动运行。PR 合并和 npm 发布仍由维护者决定。 这是仓库维护工具,不会在导入、安装或查询时联网;操作与失败恢复说明见[数据维护](data/README.md)。 +## 从 3.x 升级 + +4.0 统一使用类构造器,并明确区分同步与异步方法。已有 3.x 调用需要调整: + +| 3.x | 4.0 | +| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | +| `createLookup(source, options)` | `new IP2Region({ source, ...options })`,从根入口导入 | +| `createAsyncLookup(source, options)` | `new AsyncIP2Region({ source, ...options })` | +| 原生入口 `openDefault(options)` | `await IP2Region.open(options)` | +| 原生入口 `openDatabase(path, factory, options)` | 内置格式使用 `await IP2Region.open({ database: { format, path }, ...options })`;自定义读取器通过 `source` 接入 | +| 异步客户端 `lookup/lookupMany/lookupManySettled/close` | `lookupAsync/lookupManyAsync/lookupManySettledAsync/closeAsync` | +| 异步 adapter 的 `close()` | `closeAsync()`;`lookupAsync()` 保持不变 | + +同步查询方法不变,外部来源仍默认借用。构造原生客户端时会同步读文件;需要保留异步加载行为, +请使用 `IP2Region.open()`。3.x 类型 `ReaderFactory` 和 `DefaultOptions` 不再导出;原生入口现在提供 +`IP2RegionOptions`、`DatabaseOptions`、`DatabasesOptions`,自定义来源使用根入口的 adapter 类型。 +运行时最低版本与 3.0 相同,见[安装](#安装)。 + 代码采用 [MIT](LICENSE) 许可;内置数据许可见[数据来源](data/README.md)。 diff --git a/data/README.md b/data/README.md index 5911f5f..7639a25 100644 --- a/data/README.md +++ b/data/README.md @@ -42,7 +42,8 @@ recording new digests and rerunning reference and native-runtime validation. ### Scheduled pull requests [Data updates](../.github/workflows/data-update.yml) checks the upstream default -branch daily at **03:17 UTC** (11:17 Asia/Shanghai); GitHub may delay scheduled runs. +branch weekly at **Sunday 00:00 Asia/Shanghai** (Saturday 16:00 UTC). +GitHub may delay scheduled runs. It can also be run from Actions → Data updates → Run workflow on `main`. The scheduled workflow starts operating after it is merged into the default branch. This repository's development/release branch is `main`; set **Settings → General → diff --git a/scripts/check-data-update.mjs b/scripts/check-data-update.mjs index 6e28690..1464cff 100644 --- a/scripts/check-data-update.mjs +++ b/scripts/check-data-update.mjs @@ -74,7 +74,7 @@ export async function prepareDataUpdate({ root = rootDirectory, stage, revision, return { status: "unchanged", report, body: "The bundled data and license already match upstream.\n" }; } if (pending && sameSnapshot(pending, report.manifest)) { - // Preserve the first retrieval date and avoid daily commits to the same pending PR. + // Preserve the first retrieval date and avoid repeated commits to the same pending PR. return { status: "pending", report, body: "The existing data PR already contains this snapshot.\n" }; } await applyStage({ root, stage });