@ecosyste-ms/critical 1.0.0 → 1.0.20251231

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  SQLite database of critical open source packages from [ecosyste.ms](https://packages.ecosyste.ms).
4
4
 
5
- The database is rebuilt daily and published to npm and as a GitHub release. Versions use CalVer (`YYYY.M.D`).
5
+ The database is rebuilt daily and published to npm and as a GitHub release. Versions use `MAJOR.MINOR.YYYYMMDD` where major/minor track schema changes and patch is the build date.
6
6
 
7
7
  ## Install
8
8
 
Binary file
package/lib/index.js CHANGED
@@ -1,12 +1,24 @@
1
1
  import Database from 'better-sqlite3'
2
+ import { createReadStream, createWriteStream, existsSync } from 'fs'
2
3
  import { mkdir, unlink, readFile } from 'fs/promises'
3
4
  import { dirname, join } from 'path'
4
5
  import { fileURLToPath } from 'url'
6
+ import { createGunzip } from 'zlib'
7
+ import { pipeline } from 'stream/promises'
5
8
 
6
9
  const __dirname = dirname(fileURLToPath(import.meta.url))
7
10
  const pkg = JSON.parse(await readFile(join(__dirname, '..', 'package.json'), 'utf8'))
8
11
  const USER_AGENT = `${pkg.name}/${pkg.version}`
9
12
  const databasePath = join(__dirname, '..', 'critical-packages.db')
13
+ const gzPath = join(__dirname, '..', 'critical-packages.db.gz')
14
+
15
+ if (!existsSync(databasePath) && existsSync(gzPath)) {
16
+ await pipeline(
17
+ createReadStream(gzPath),
18
+ createGunzip(),
19
+ createWriteStream(databasePath)
20
+ )
21
+ }
10
22
 
11
23
  const API_BASE = 'https://packages.ecosyste.ms/api/v1'
12
24
  const PER_PAGE = 1000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecosyste-ms/critical",
3
- "version": "1.0.0",
3
+ "version": "1.0.20251231",
4
4
  "description": "SQLite database of critical packages from ecosyste.ms",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
@@ -22,14 +22,14 @@
22
22
  "license": "CC-BY-SA-4.0",
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "https://github.com/ecosyste-ms/critical.git"
25
+ "url": "git+https://github.com/ecosyste-ms/critical.git"
26
26
  },
27
27
  "files": [
28
28
  "lib",
29
29
  "bin.js",
30
30
  "README.md",
31
31
  "LICENSE",
32
- "critical-packages.db"
32
+ "critical-packages.db.gz"
33
33
  ],
34
34
  "publishConfig": {
35
35
  "access": "public"
@@ -38,6 +38,6 @@
38
38
  "node": ">=18.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "better-sqlite3": "^11.7.0"
41
+ "better-sqlite3": "^12.5.0"
42
42
  }
43
43
  }
Binary file