npq 3.2.3 → 3.3.0
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/data/top-packages.json +50000 -0
- package/package.json +2 -1
- package/scripts/build.js +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npq",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "marshall your npm/npm package installs with high quality and class 🎖",
|
|
5
5
|
"bin": {
|
|
6
6
|
"npq": "./bin/npq.js",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"lint": "eslint . --ignore-path .gitignore && npm run lint:lockfile",
|
|
11
11
|
"lint:lockfile": "lockfile-lint --path package-lock.json --type npm --validate-https --allowed-hosts npm npm",
|
|
12
12
|
"test": "NODE_OPTIONS=\"--experimental-vm-modules\" jest",
|
|
13
|
+
"build": "node scripts/build.js",
|
|
13
14
|
"test:watch": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watch",
|
|
14
15
|
"coverage:view": "opn coverage/lcov-report/index.html",
|
|
15
16
|
"commit": "git-cz",
|
package/scripts/build.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const fs = require('fs/promises')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
const TOP_PACKAGES_ASSET_URL =
|
|
5
|
+
'https://github.com/lirantal/npm-rank/releases/download/latest/list-package-names.json'
|
|
6
|
+
|
|
7
|
+
const TOP_PACKAGES_FILE_PATH = path.join(__dirname, '../data/top-packages.json')
|
|
8
|
+
|
|
9
|
+
async function downloadTopPackages() {
|
|
10
|
+
const response = await fetch(TOP_PACKAGES_ASSET_URL)
|
|
11
|
+
const data = await response.json()
|
|
12
|
+
return data
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function saveTopPackagesToFile() {
|
|
16
|
+
const topPackages = await downloadTopPackages()
|
|
17
|
+
await fs.writeFile(TOP_PACKAGES_FILE_PATH, JSON.stringify(topPackages, null, 2))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
const topPackages = await downloadTopPackages()
|
|
22
|
+
await saveTopPackagesToFile()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
main()
|