usb.ids 0.0.2 → 1.0.1756686460342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +155 -0
- package/package.json +23 -22
- package/usb.ids +25695 -0
- package/usb.ids.json +101191 -0
- package/usb.ids.version.json +9 -0
- package/dist/index.cjs +0 -6
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -5
package/README.md
CHANGED
|
@@ -1 +1,156 @@
|
|
|
1
1
|
# usb.ids
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/usb.ids)
|
|
4
|
+
[](https://github.com/Drswith/usb.ids/actions/workflows/auto-update.yml)
|
|
5
|
+
[](https://github.com/Drswith/usb.ids/actions/workflows/github-pages.yml)
|
|
6
|
+
|
|
7
|
+
An automated USB device ID database project that fetches the latest USB.IDS data every 24 hours and publishes it to npm.
|
|
8
|
+
|
|
9
|
+
## 🚀 Features
|
|
10
|
+
|
|
11
|
+
- **Auto Update**: Automatically checks and fetches the latest USB.IDS data every 24 hours
|
|
12
|
+
- **Multi-format Support**: Provides both raw format and JSON format data
|
|
13
|
+
- **npm Publishing**: Automatically publishes to npm package manager
|
|
14
|
+
- **GitHub Pages**: Provides online viewing interface
|
|
15
|
+
- **Version Management**: Smart version control based on content hash
|
|
16
|
+
- **Data Statistics**: Provides vendor and device count statistics
|
|
17
|
+
|
|
18
|
+
## 📦 Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install usb.ids
|
|
22
|
+
# or
|
|
23
|
+
pnpm add usb.ids
|
|
24
|
+
# or
|
|
25
|
+
yarn add usb.ids
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 🔧 Usage
|
|
29
|
+
|
|
30
|
+
### Use as npm package
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import { getUsbIds } from 'usb.ids'
|
|
34
|
+
|
|
35
|
+
// Get USB device data
|
|
36
|
+
const usbData = await getUsbIds()
|
|
37
|
+
console.log(usbData)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Direct access to data files
|
|
41
|
+
|
|
42
|
+
The project provides the following data files:
|
|
43
|
+
|
|
44
|
+
- `usb.ids` - Raw format USB device data
|
|
45
|
+
- `usb.ids.json` - JSON format USB device data
|
|
46
|
+
- `usb.ids.version.json` - Version information and statistics
|
|
47
|
+
|
|
48
|
+
## 🌐 Online Viewing
|
|
49
|
+
|
|
50
|
+
Visit [GitHub Pages](https://drswith.github.io/usb.ids/) to view the USB device database online.
|
|
51
|
+
|
|
52
|
+
## 🤖 Automation Process
|
|
53
|
+
|
|
54
|
+
### Data Update Workflow
|
|
55
|
+
|
|
56
|
+
1. **Scheduled Trigger**: Automatically executes daily at UTC 0:00
|
|
57
|
+
2. **Data Fetching**: Fetches the latest USB.IDS data from official sources
|
|
58
|
+
3. **Change Detection**: Detects data updates through content hash
|
|
59
|
+
4. **Version Generation**: Generates new version numbers based on timestamps
|
|
60
|
+
5. **Build & Publish**: Automatically builds and publishes to npm
|
|
61
|
+
6. **GitHub Release**: Creates GitHub release versions
|
|
62
|
+
7. **Pages Deployment**: Updates GitHub Pages website
|
|
63
|
+
|
|
64
|
+
### Data Sources
|
|
65
|
+
|
|
66
|
+
- Primary source: http://www.linux-usb.org/usb.ids
|
|
67
|
+
- Fallback source: https://raw.githubusercontent.com/systemd/systemd/main/hwdb.d/usb.ids
|
|
68
|
+
|
|
69
|
+
## 📊 Data Format
|
|
70
|
+
|
|
71
|
+
### JSON Format Example
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"vendors": {
|
|
76
|
+
"1234": {
|
|
77
|
+
"name": "Vendor Name",
|
|
78
|
+
"devices": {
|
|
79
|
+
"5678": "Device Name"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Version Information Format
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"version": "1.0.1756668652122",
|
|
91
|
+
"contentHash": "abc123...",
|
|
92
|
+
"fetchTime": 1756668652122,
|
|
93
|
+
"fetchTimeFormatted": "2024-01-01 00:00:00",
|
|
94
|
+
"vendorCount": 3000,
|
|
95
|
+
"deviceCount": 25000
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 🛠️ Development
|
|
100
|
+
|
|
101
|
+
### Requirements
|
|
102
|
+
|
|
103
|
+
- Node.js >= 16
|
|
104
|
+
- pnpm (recommended)
|
|
105
|
+
|
|
106
|
+
### Local Development
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Clone the project
|
|
110
|
+
git clone https://github.com/Drswith/usb.ids.git
|
|
111
|
+
cd usb.ids
|
|
112
|
+
|
|
113
|
+
# Install dependencies
|
|
114
|
+
pnpm install
|
|
115
|
+
|
|
116
|
+
# Fetch latest data
|
|
117
|
+
pnpm run fetch-usb-ids
|
|
118
|
+
|
|
119
|
+
# Start development server
|
|
120
|
+
pnpm run dev
|
|
121
|
+
|
|
122
|
+
# Build project
|
|
123
|
+
pnpm run build
|
|
124
|
+
|
|
125
|
+
# Run tests
|
|
126
|
+
pnpm run test
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Script Commands
|
|
130
|
+
|
|
131
|
+
- `pnpm run fetch-usb-ids` - Fetch the latest USB.IDS data
|
|
132
|
+
- `pnpm run version-info` - Generate version information
|
|
133
|
+
- `pnpm run check-update` - Check for updates
|
|
134
|
+
- `pnpm run dev` - Start development server
|
|
135
|
+
- `pnpm run build` - Build project
|
|
136
|
+
- `pnpm run test` - Run tests
|
|
137
|
+
|
|
138
|
+
## 📄 License
|
|
139
|
+
|
|
140
|
+
MIT License - See [LICENSE](LICENSE) file for details
|
|
141
|
+
|
|
142
|
+
## 🤝 Contributing
|
|
143
|
+
|
|
144
|
+
Issues and Pull Requests are welcome!
|
|
145
|
+
|
|
146
|
+
## 📞 Support
|
|
147
|
+
|
|
148
|
+
- [GitHub Issues](https://github.com/Drswith/usb.ids/issues)
|
|
149
|
+
- [GitHub Sponsors](https://github.com/sponsors/Drswith)
|
|
150
|
+
|
|
151
|
+
## 🔗 Related Links
|
|
152
|
+
|
|
153
|
+
- [npm package](https://www.npmjs.com/package/usb.ids)
|
|
154
|
+
- [GitHub repository](https://github.com/Drswith/usb.ids)
|
|
155
|
+
- [Online viewing](https://drswith.github.io/usb.ids/)
|
|
156
|
+
- [USB.IDS official website](http://www.linux-usb.org/usb.ids)
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usb.ids",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
5
|
-
"packageManager": "pnpm@9.15.9",
|
|
4
|
+
"version": "1.0.1756686460342",
|
|
6
5
|
"description": "A vite plugin to get USB IDs",
|
|
7
6
|
"author": "Drswith",
|
|
8
7
|
"license": "MIT",
|
|
@@ -30,28 +29,13 @@
|
|
|
30
29
|
"module": "./dist/index.js",
|
|
31
30
|
"types": "./dist/index.d.ts",
|
|
32
31
|
"files": [
|
|
33
|
-
"
|
|
34
|
-
"usb.ids.json"
|
|
32
|
+
"usb.ids",
|
|
33
|
+
"usb.ids.json",
|
|
34
|
+
"usb.ids.version.json"
|
|
35
35
|
],
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=16"
|
|
38
38
|
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"preinstall": "npx only-allow pnpm",
|
|
41
|
-
"build": "tsdown",
|
|
42
|
-
"dev": "tsdown --watch",
|
|
43
|
-
"lint": "eslint",
|
|
44
|
-
"lint:fix": "eslint --fix",
|
|
45
|
-
"fetch-usb-ids": "tsx scripts/fetch-usb-ids.ts",
|
|
46
|
-
"release": "bumpp && pnpm publish",
|
|
47
|
-
"start": "tsx src/index.ts",
|
|
48
|
-
"test": "vitest run",
|
|
49
|
-
"test:watch": "vitest",
|
|
50
|
-
"typecheck": "tsc --noEmit",
|
|
51
|
-
"prepare": "simple-git-hooks",
|
|
52
|
-
"bumpp": "bumpp",
|
|
53
|
-
"lint-staged": "lint-staged"
|
|
54
|
-
},
|
|
55
39
|
"devDependencies": {
|
|
56
40
|
"@antfu/eslint-config": "^4.2.1",
|
|
57
41
|
"@antfu/ni": "^24.1.0",
|
|
@@ -73,9 +57,26 @@
|
|
|
73
57
|
"yaml": "^2.7.0"
|
|
74
58
|
},
|
|
75
59
|
"simple-git-hooks": {
|
|
76
|
-
"pre-commit": "
|
|
60
|
+
"pre-commit": "npm run lint-staged"
|
|
77
61
|
},
|
|
78
62
|
"lint-staged": {
|
|
79
63
|
"*": "eslint --fix"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"preinstall": "npx only-allow pnpm",
|
|
67
|
+
"dev": "vite",
|
|
68
|
+
"build": "vite build",
|
|
69
|
+
"lint": "eslint",
|
|
70
|
+
"lint:fix": "eslint --fix",
|
|
71
|
+
"fetch-usb-ids": "tsx scripts/fetch-usb-ids.ts",
|
|
72
|
+
"version-info": "tsx scripts/version-info.ts",
|
|
73
|
+
"check-update": "tsx scripts/check-update.ts",
|
|
74
|
+
"release": "bumpp && pnpm publish",
|
|
75
|
+
"start": "tsx src/index.ts",
|
|
76
|
+
"test": "vitest run",
|
|
77
|
+
"test:watch": "vitest",
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
79
|
+
"bumpp": "bumpp",
|
|
80
|
+
"lint-staged": "lint-staged"
|
|
80
81
|
}
|
|
81
|
-
}
|
|
82
|
+
}
|