Skip to content

Commit b2ccf55

Browse files
committed
refactor(docs): 统一USB ID's相关描述和命名
- 将README.md、index.html、scripts/README.md中USB device统一调整为USB ID's - 统一CLI命令文档、项目介绍以及在线页面的USB ID's描述 - 修正src/api.ts、src/cli.ts、app/main.ts中打印和异常信息相关的USB ID's表述 - 删除scripts/check-version-update.ts脚本,简化版本检查逻辑 - 修正测试用例中异常信息描述,确保一致性 - 保持所有修改符合项目统一命名规范,增强文档和代码的表达一致性
1 parent 4c7fa29 commit b2ccf55

File tree

8 files changed

+40
-153
lines changed

8 files changed

+40
-153
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222

2323
</div>
2424

25-
An automated USB device ID database project that provides a CLI tool and data files. It fetches the latest USB.IDS data every 24 hours and publishes updated data files to npm.
25+
An automated USB ID's database project that provides a CLI tool and data files. It fetches the latest USB ID's data every 24 hours and publishes updated data files to npm.
2626

2727
## 🚀 Features
2828

29-
- **CLI Tool**: Command-line interface for managing USB device data
29+
- **CLI Tool**: Command-line interface for managing USB ID's data
3030
- **Modern API Library**: Async-first API with TypeScript support and pure function tools
31-
- **Auto Update**: Automatically checks and fetches the latest USB.IDS data every 24 hours with smart content comparison
31+
- **Auto Update**: Automatically checks and fetches the latest USB ID's data every 24 hours with smart content comparison
3232
- **Multi-format Support**: Provides both raw format and JSON format data files
33-
- **Web Interface**: Built-in web server for browsing and searching USB device data
33+
- **Web Interface**: Built-in web server for browsing and searching USB ID's data
3434
- **npm Distribution**: Distributes data files through npm package manager
3535
- **GitHub Pages**: Provides online viewing interface
3636
- **Version Management**: Smart version control based on content hash with optimized update detection
@@ -66,10 +66,10 @@ yarn add usb.ids
6666
### CLI Commands
6767

6868
```bash
69-
# Update USB device data
69+
# Update USB ID's data
7070
usb-ids fetch
7171

72-
# Force update USB device data
72+
# Force update USB ID's data
7373
usb-ids fetch --force
7474

7575
# Show version information
@@ -90,7 +90,7 @@ usb-ids help
9090

9191
### Using the API Library
9292

93-
The package provides a modern async API for accessing USB device data:
93+
The package provides a modern async API for accessing USB ID's data:
9494

9595
```javascript
9696
import {
@@ -172,25 +172,25 @@ const device = await getDevice('05ac', '12a8', true)
172172

173173
The project provides the following data files:
174174

175-
- `usb.ids` - Raw format USB device data
176-
- `usb.ids.json` - JSON format USB device data
175+
- `usb.ids` - Raw format USB ID's data
176+
- `usb.ids.json` - JSON format USB ID's data
177177
- `usb.ids.version.json` - Version information and statistics
178178

179179
## 🌐 Online Viewing
180180

181-
Visit [GitHub Pages](https://drswith.github.io/usb.ids/) to view the USB device database online.
181+
Visit [GitHub Pages](https://drswith.github.io/usb.ids/) to view the USB ID's database online.
182182

183183
## 🤖 Automation Process
184184

185185
### Data Update Workflow
186186

187187
1. **Scheduled Trigger**: Automatically executes daily at UTC 2:30
188188
2. **Version Check**: Compares remote data content hash with the latest published npm package
189-
- Downloads remote USB.IDS data without saving
189+
- Downloads remote USB ID's data without saving
190190
- Calculates content hash of remote data
191191
- Compares with content hash from latest npm package version
192192
- Only proceeds if content has actually changed
193-
3. **Data Fetching**: Fetches and saves the latest USB.IDS data (only when update needed)
193+
3. **Data Fetching**: Fetches and saves the latest USB ID's data (only when update needed)
194194
4. **Change Detection**: Smart detection prevents unnecessary updates and builds
195195
5. **Version Generation**: Generates new version numbers based on timestamps
196196
6. **Build & Publish**: Automatically builds and publishes to npm
@@ -298,7 +298,7 @@ pnpm run test
298298

299299
### Script Commands
300300

301-
- `pnpm run fetch-usb-ids` - Fetch the latest USB.IDS data
301+
- `pnpm run fetch-usb-ids` - Fetch the latest USB ID's data
302302
- `pnpm run dev:app` - Start web app development server
303303
- `pnpm run build:app` - Build web application
304304
- `pnpm run dev:lib` - Start library development with watch mode
@@ -330,4 +330,4 @@ Issues and Pull Requests are welcome!
330330
- [npm package](https://www.npmjs.com/package/usb.ids)
331331
- [GitHub repository](https://github.com/Drswith/usb.ids)
332332
- [Online viewing](https://drswith.github.io/usb.ids/)
333-
- [USB.IDS official website](http://www.linux-usb.org/usb.ids)
333+
- [USB ID's official website](http://www.linux-usb.org/usb.ids)

app/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ async function loadDataFromNpm<T>(version: string, file: string): Promise<T> {
285285
}
286286
}
287287
catch (error) {
288-
console.warn('Failed to load USB IDs from npm, falling back to local data:', error)
288+
console.warn('Failed to load USB ID\'s from npm, falling back to local data:', error)
289289
// 如果从npm获取失败,尝试加载本地数据作为fallback
290290
try {
291291
const fallbackResponse = await fetch(`${import.meta.env.BASE_URL}${file}`)
@@ -576,9 +576,9 @@ async function initializeApp(): Promise<void> {
576576
countdown: document.getElementById('countdown') as HTMLElement,
577577
}
578578

579-
// 异步加载USB IDs数据
579+
// 异步加载USB ID's数据
580580
const usbIdsData = useLocalData ? await loadDataFromLocal<UsbIdsData>(USB_IDS_JSON_FILE) : await loadDataFromNpm<UsbIdsData>(version, USB_IDS_JSON_FILE)
581-
console.log('USB IDs Data loaded:', usbIdsData)
581+
console.log('USB ID\'s Data loaded:', usbIdsData)
582582

583583
// 设置数据
584584
currentData = usbIdsData as UsbIdsData
@@ -609,7 +609,7 @@ async function initializeApp(): Promise<void> {
609609
hideLoadingState()
610610
}
611611
catch (error) {
612-
console.error('Failed to load USB IDs data:', error)
612+
console.error('Failed to load USB ID\'s data:', error)
613613
hideLoadingState()
614614
showEmptyState()
615615
}

index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@
1313
<link rel="apple-touch-icon" href="/linux.svg" />
1414

1515
<!-- SEO Meta Tags -->
16-
<title>USB IDs Database - Complete List of USB Vendor and Device IDs</title>
17-
<meta name="description" content="Comprehensive USB IDs database with vendor and device information. Search through thousands of USB device identifiers, vendor codes, and product IDs. Updated daily from official sources." />
18-
<meta name="keywords" content="USB IDs, USB vendor IDs, USB device IDs, USB database, hardware identification, device drivers, USB specifications" />
19-
<meta name="author" content="USB IDs Database" />
16+
<title>USB ID's Database - Complete List of USB Vendor and Device ID's</title>
17+
<meta name="description" content="Comprehensive USB ID's database with vendor and device information. Search through thousands of USB device identifiers, vendor codes, and product ID's. Updated daily from official sources." />
18+
<meta name="keywords" content="USB ID's, USB vendor ID's, USB device ID's, USB database, hardware identification, device drivers, USB specifications" />
19+
<meta name="author" content="USB ID's Database" />
2020
<meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
2121
<meta name="googlebot" content="index, follow" />
2222
<meta name="theme-color" content="#2563eb" />
2323
<meta name="msapplication-TileColor" content="#2563eb" />
24-
<meta name="application-name" content="USB IDs Database" />
24+
<meta name="application-name" content="USB ID's Database" />
2525

2626
<!-- Open Graph Meta Tags -->
27-
<meta property="og:title" content="USB IDs Database - Complete List of USB Vendor and Device IDs" />
28-
<meta property="og:description" content="Comprehensive USB IDs database with vendor and device information. Search through thousands of USB device identifiers updated daily." />
27+
<meta property="og:title" content="USB ID's Database - Complete List of USB Vendor and Device ID's" />
28+
<meta property="og:description" content="Comprehensive USB ID's database with vendor and device information. Search through thousands of USB device identifiers updated daily." />
2929
<meta property="og:type" content="website" />
3030
<meta property="og:url" content="https://drswith.github.io/usb.ids/" />
31-
<meta property="og:site_name" content="USB IDs Database" />
31+
<meta property="og:site_name" content="USB ID's Database" />
3232
<meta property="og:image" content="https://drswith.github.io/usb.ids/linux.svg" />
3333
<meta property="og:image:width" content="32" />
3434
<meta property="og:image:height" content="32" />
@@ -44,13 +44,13 @@
4444
{
4545
"@context": "https://schema.org",
4646
"@type": "Dataset",
47-
"name": "USB IDs Database",
47+
"name": "USB ID's Database",
4848
"description": "Comprehensive database of USB vendor and device identifiers, updated daily from official sources",
4949
"url": "https://drswith.github.io/usb.ids/",
5050
"keywords": ["USB", "vendor IDs", "device IDs", "hardware identification", "USB specifications"],
5151
"creator": {
5252
"@type": "Organization",
53-
"name": "USB IDs Database"
53+
"name": "USB ID's Database"
5454
},
5555
"distribution": {
5656
"@type": "DataDownload",
@@ -72,7 +72,7 @@
7272
<div class="header-left">
7373
<h1 class="title">
7474
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><!-- Icon from Material Icon Theme by Material Extensions - https://github.com/material-extensions/vscode-material-icon-theme/blob/main/LICENSE --><path fill="#f9a825" d="m13.844 7.536l-1.288-1.072A2 2 0 0 0 11.276 6H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2H15.124a2 2 0 0 1-1.28-.464"/><path fill="#ffecb3" d="M24.62 16.35c-.42.28-1.75 1.04-1.95 1.19a.825.825 0 0 1-1.14-.01c-.2-.16-1.53-.92-1.95-1.19c-.48-.309-.45-.699.08-.919a6.16 6.16 0 0 1 4.91.03c.49.21.51.6.05.9Zm7.218 7.279A19.1 19.1 0 0 0 28 17.971a4.3 4.3 0 0 1-1.06-1.88c-.1-.33-.17-.67-.24-1.01a11.3 11.3 0 0 0-.7-2.609a4.06 4.06 0 0 0-3.839-2.47a4.2 4.2 0 0 0-3.95 2.4a6 6 0 0 0-.46 1.34c-.17.76-.32 1.55-.5 2.319a3.4 3.4 0 0 1-.959 1.71a19.5 19.5 0 0 0-3.88 5.348a6 6 0 0 0-.37.88c-.19.66.29 1.12.99.96c.44-.09.88-.18 1.3-.31c.41-.15.57-.05.67.35a6.73 6.73 0 0 0 4.24 4.498c4.119 1.56 8.928-.66 9.968-4.578c.07-.27.17-.37.47-.27c.46.14.93.24 1.4.35a.724.724 0 0 0 .92-.64a1.44 1.44 0 0 0-.16-.73Z"/></svg>
75-
USB IDs Database
75+
USB ID's Database
7676
</h1>
7777
<p class="subtitle">Comprehensive database for quickly finding USB device vendor and product information</p>
7878
</div>

scripts/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Scripts Directory
22

3-
This directory contains utility scripts for the USB.IDS project. Each script serves a specific purpose in the project's automation and maintenance workflow.
3+
This directory contains utility scripts for the USB ID's project. Each script serves a specific purpose in the project's automation and maintenance workflow.
44

55
## Available Scripts
66

77
### `diff-hash.ts`
88

9-
Compares content hashes between remote USB.IDS data and the published npm package to determine if an update is needed. Designed for use in GitHub Actions workflow.
9+
Compares content hashes between remote USB ID's data and the published npm package to determine if an update is needed. Designed for use in GitHub Actions workflow.
1010

1111
#### Purpose
12-
Determines whether the automated update workflow should proceed by comparing the content hash of remote USB.IDS data with the hash from the latest published npm package.
12+
Determines whether the automated update workflow should proceed by comparing the content hash of remote USB ID's data with the hash from the latest published npm package.
1313

1414
#### Usage
1515

@@ -23,7 +23,7 @@ tsx scripts/diff-hash.ts
2323

2424
#### What it does
2525

26-
1. Downloads remote USB.IDS data from official sources using `downloadFromUrls()` from `src/fetcher.ts`
26+
1. Downloads remote USB ID's data from official sources using `downloadFromUrls()` from `src/fetcher.ts`
2727
2. Calculates content hash using `generateContentHash()` from `src/parser.ts`
2828
3. Fetches version information from the latest npm package
2929
4. Compares the content hashes

scripts/check-version-update.ts

Lines changed: 0 additions & 113 deletions
This file was deleted.

src/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export type DeviceFilter =
9090
// ===============================
9191

9292
/**
93-
* Get USB device data (unified data acquisition strategy)
93+
* Get USB ID's data (unified data acquisition strategy)
9494
* Prioritize local JSON files, fetch remote data if not available
9595
*/
9696
async function ensureData(forceUpdate = false): Promise<UsbIdsData> {
@@ -105,7 +105,7 @@ async function ensureData(forceUpdate = false): Promise<UsbIdsData> {
105105
}
106106
catch (error) {
107107
throw createApiError(
108-
`Failed to fetch USB device data: ${(error as Error).message}`,
108+
`Failed to fetch USB ID's data: ${(error as Error).message}`,
109109
ERROR_CODES.NETWORK_ERROR,
110110
error as Error,
111111
)
@@ -326,7 +326,7 @@ export async function searchDevices(
326326
}
327327

328328
/**
329-
* Get complete USB device data
329+
* Get complete USB ID's data
330330
* @param forceUpdate Whether to force data update
331331
*/
332332
export async function getUsbData(

src/cli.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function updateUsbIdsData(forceUpdate = false): Promise<void> {
2424
const jsonFile = path.join(root, USB_IDS_JSON_FILE)
2525
const versionFile = path.join(root, USB_IDS_VERSION_JSON_FILE)
2626

27-
logger.start('Starting USB device data update...')
27+
logger.start('Starting USB ID\'s data update...')
2828

2929
// 检查是否需要更新
3030
const currentVersionInfo = loadVersionInfo(versionFile)
@@ -34,7 +34,7 @@ async function updateUsbIdsData(forceUpdate = false): Promise<void> {
3434
}
3535

3636
// 获取USB设备数据
37-
logger.info('Fetching USB device data...')
37+
logger.info('Fetching USB ID\'s data...')
3838
const { data, source, versionInfo } = await fetchUsbIdsData(
3939
USB_IDS_SOURCE,
4040
fallbackFile,
@@ -259,7 +259,7 @@ Usage:
259259
or: node bin/cli.js <command> [options]
260260

261261
Commands:
262-
update, fetch Update USB device data
262+
update, fetch Update USB ID's data
263263
version, info Show current version information
264264
check Check if update is needed
265265
ui Start web interface server

tests/api.browser.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('browser Environment API Tests', () => {
148148
// Re-import the module
149149
const { getVendors } = await import('../src/api')
150150

151-
await expect(getVendors()).rejects.toThrow('Failed to fetch USB device data')
151+
await expect(getVendors()).rejects.toThrow('Failed to fetch USB ID\'s data')
152152
})
153153

154154
it('should handle force update parameter correctly', async () => {

0 commit comments

Comments
 (0)