From c781eba986a4373afe6c5dc9e8004fc92ef84ece Mon Sep 17 00:00:00 2001
From: Simon <10131203+gaomeng1900@users.noreply.github.com>
Date: Wed, 21 Jan 2026 01:08:19 +0800
Subject: [PATCH] feat: fixed version in CDN URL
---
.vscode/settings.json | 1 +
README-zh.md | 10 +++++-----
README.md | 10 +++++-----
packages/website/src/constants.ts | 5 +++--
scripts/sync-version.js | 26 ++++++++++++++++++++++++++
5 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index db6a62e..49c7951 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -6,6 +6,7 @@
"HITL",
"innerhtml",
"llms",
+ "npmmirror",
"onwarn",
"opensource",
"qwen",
diff --git a/README-zh.md b/README-zh.md
index 6e6e49b..feba89e 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -37,17 +37,17 @@
```html
```
> ⚠️ **仅用于技术评估。** Demo 模型有速率限制和使用限制,生产环境请使用 NPM 方式。
-| 镜像 | URL |
-| ------ | ----------------------------------------------------------------------------------- |
-| Global | https://cdn.jsdelivr.net/npm/page-agent/dist/iife/page-agent.demo.js |
-| China | https://registry.npmmirror.com/page-agent/latest/files/dist/iife/page-agent.demo.js |
+| 镜像 | URL |
+| ------ | ----------------------------------------------------------------------------------------- |
+| Global | https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.1/dist/iife/page-agent.demo.js |
+| China | https://registry.npmmirror.com/page-agent/1.0.0-beta.1/files/dist/iife/page-agent.demo.js |
### NPM 安装
diff --git a/README.md b/README.md
index 972414b..b131e8b 100644
--- a/README.md
+++ b/README.md
@@ -37,17 +37,17 @@ Fastest way to try PageAgent:
```html
```
> ⚠️ **For technical evaluation only.** Demo model has rate limits and usage restrictions. Use NPM for production.
-| Mirrors | URL |
-| ------- | ----------------------------------------------------------------------------------- |
-| Global | https://cdn.jsdelivr.net/npm/page-agent/dist/iife/page-agent.demo.js |
-| China | https://registry.npmmirror.com/page-agent/latest/files/dist/iife/page-agent.demo.js |
+| Mirrors | URL |
+| ------- | ----------------------------------------------------------------------------------------- |
+| Global | https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.1/dist/iife/page-agent.demo.js |
+| China | https://registry.npmmirror.com/page-agent/1.0.0-beta.1/files/dist/iife/page-agent.demo.js |
### NPM Installation
diff --git a/packages/website/src/constants.ts b/packages/website/src/constants.ts
index c8d6afe..a13c948 100644
--- a/packages/website/src/constants.ts
+++ b/packages/website/src/constants.ts
@@ -1,7 +1,8 @@
// Demo build (auto-init with demo LLM, for quick testing)
-export const CDN_DEMO_URL = 'https://cdn.jsdelivr.net/npm/page-agent/dist/iife/page-agent.demo.js'
+export const CDN_DEMO_URL =
+ 'https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.1/dist/iife/page-agent.demo.js'
export const CDN_DEMO_CN_URL =
- 'https://registry.npmmirror.com/page-agent/latest/files/dist/iife/page-agent.demo.js'
+ 'https://registry.npmmirror.com/page-agent/1.0.0-beta.1/files/dist/iife/page-agent.demo.js'
// Demo LLM for website testing
export const DEMO_MODEL = 'PAGE-AGENT-FREE-TESTING-RANDOM'
diff --git a/scripts/sync-version.js b/scripts/sync-version.js
index 3c69208..9025984 100644
--- a/scripts/sync-version.js
+++ b/scripts/sync-version.js
@@ -96,6 +96,32 @@ for (const pkg of packages) {
hasChanges = true
}
+// Update CDN URLs in documentation and source files
+const oldVersion = rootPkg.version === newVersion ? newVersion : rootPkg.version
+const CDN_DEMO_URL_OLD = `https://cdn.jsdelivr.net/npm/page-agent@${oldVersion}/dist/iife/page-agent.demo.js`
+const CDN_DEMO_URL_NEW = `https://cdn.jsdelivr.net/npm/page-agent@${newVersion}/dist/iife/page-agent.demo.js`
+const CDN_DEMO_CN_URL_OLD = `https://registry.npmmirror.com/page-agent/${oldVersion}/files/dist/iife/page-agent.demo.js`
+const CDN_DEMO_CN_URL_NEW = `https://registry.npmmirror.com/page-agent/${newVersion}/files/dist/iife/page-agent.demo.js`
+
+const filesToUpdateCdn = ['README.md', 'README-zh.md', 'packages/website/src/constants.ts']
+
+for (const relPath of filesToUpdateCdn) {
+ const filePath = join(rootDir, relPath)
+ if (!existsSync(filePath)) continue
+
+ let content = readFileSync(filePath, 'utf-8')
+ const original = content
+
+ content = content.replaceAll(CDN_DEMO_URL_OLD, CDN_DEMO_URL_NEW)
+ content = content.replaceAll(CDN_DEMO_CN_URL_OLD, CDN_DEMO_CN_URL_NEW)
+
+ if (content !== original) {
+ writeFileSync(filePath, content)
+ console.log(chalk.green('✓') + ` ${chalk.bold(relPath)}: CDN URLs updated`)
+ hasChanges = true
+ }
+}
+
console.log(chalk.green.bold(`\n✓ Version synced: ${newVersion}\n`))
// Show git commands hint