feat: fixed version in CDN URL

This commit is contained in:
Simon
2026-01-21 01:08:19 +08:00
parent efe131660a
commit c781eba986
5 changed files with 40 additions and 12 deletions

View File

@@ -6,6 +6,7 @@
"HITL", "HITL",
"innerhtml", "innerhtml",
"llms", "llms",
"npmmirror",
"onwarn", "onwarn",
"opensource", "opensource",
"qwen", "qwen",

View File

@@ -37,17 +37,17 @@
```html ```html
<script <script
src="https://registry.npmmirror.com/@page-agent/cdn/latest/files/dist/page-agent.demo.js" src="https://registry.npmmirror.com/page-agent/1.0.0-beta.1/files/dist/iife/page-agent.demo.js"
crossorigin="true" crossorigin="true"
></script> ></script>
``` ```
> ⚠️ **仅用于技术评估。** Demo 模型有速率限制和使用限制,生产环境请使用 NPM 方式。 > ⚠️ **仅用于技术评估。** Demo 模型有速率限制和使用限制,生产环境请使用 NPM 方式。
| 镜像 | URL | | 镜像 | URL |
| ------ | ----------------------------------------------------------------------------------- | | ------ | ----------------------------------------------------------------------------------------- |
| Global | https://cdn.jsdelivr.net/npm/page-agent/dist/iife/page-agent.demo.js | | 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/latest/files/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 安装 ### NPM 安装

View File

@@ -37,17 +37,17 @@ Fastest way to try PageAgent:
```html ```html
<script <script
src="https://cdn.jsdelivr.net/npm/page-agent/dist/iife/page-agent.demo.js" src="https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.1/dist/iife/page-agent.demo.js"
crossorigin="true" crossorigin="true"
></script> ></script>
``` ```
> ⚠️ **For technical evaluation only.** Demo model has rate limits and usage restrictions. Use NPM for production. > ⚠️ **For technical evaluation only.** Demo model has rate limits and usage restrictions. Use NPM for production.
| Mirrors | URL | | Mirrors | URL |
| ------- | ----------------------------------------------------------------------------------- | | ------- | ----------------------------------------------------------------------------------------- |
| Global | https://cdn.jsdelivr.net/npm/page-agent/dist/iife/page-agent.demo.js | | 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/latest/files/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 ### NPM Installation

View File

@@ -1,7 +1,8 @@
// Demo build (auto-init with demo LLM, for quick testing) // 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 = 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 // Demo LLM for website testing
export const DEMO_MODEL = 'PAGE-AGENT-FREE-TESTING-RANDOM' export const DEMO_MODEL = 'PAGE-AGENT-FREE-TESTING-RANDOM'

View File

@@ -96,6 +96,32 @@ for (const pkg of packages) {
hasChanges = true 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`)) console.log(chalk.green.bold(`\n✓ Version synced: ${newVersion}\n`))
// Show git commands hint // Show git commands hint