api-tuner 0.4.1 → 0.4.2
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/lib/download-eye.js +32 -0
- package/package.json +7 -3
- package/lib/download-eye.sh +0 -6
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import { Readable } from 'node:stream'
|
|
5
|
+
import * as tar from 'tar'
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const EYE_VERSION = process.env.EYE_VERSION
|
|
9
|
+
const url = `https://github.com/eyereasoner/eye/archive/refs/tags/v${EYE_VERSION}.tar.gz`
|
|
10
|
+
|
|
11
|
+
// Download and extract tarball directly from stream
|
|
12
|
+
const res = await fetch(url)
|
|
13
|
+
if (!res.ok) throw new Error(`Failed to download: ${res.statusText}`)
|
|
14
|
+
await new Promise((resolve, reject) => {
|
|
15
|
+
Readable.fromWeb(res.body)
|
|
16
|
+
.pipe(tar.x())
|
|
17
|
+
.on('finish', resolve)
|
|
18
|
+
.on('error', reject)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// Remove existing 'eye' directory if it exists
|
|
22
|
+
if (fs.existsSync('eye')) {
|
|
23
|
+
fs.rmSync('eye', { recursive: true, force: true })
|
|
24
|
+
}
|
|
25
|
+
// Rename extracted folder
|
|
26
|
+
fs.renameSync(`eye-${EYE_VERSION}`, 'eye')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main().catch(err => {
|
|
30
|
+
console.error(err)
|
|
31
|
+
process.exit(1)
|
|
32
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "api-tuner",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"api-tuner": "./bin/tuner.sh"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"download-eye": "EYE_VERSION=11.16.4 ./lib/download-eye.
|
|
11
|
+
"download-eye": "EYE_VERSION=11.16.4 ./lib/download-eye.js",
|
|
12
12
|
"postinstall": "([ -d eye ] || npm run download-eye) && eye/install.sh --prefix=eye",
|
|
13
13
|
"prepare": "husky",
|
|
14
14
|
"lint": "eslint . --quiet --ignore-path .gitignore",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"is-absolute-url": "^4.0.1",
|
|
37
37
|
"jsonld": "^8.3.3",
|
|
38
38
|
"rdf-validate-shacl": "^0.5.6",
|
|
39
|
-
"replacestream": "^4.0.3"
|
|
39
|
+
"replacestream": "^4.0.3",
|
|
40
|
+
"tar": "^7.5.1"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@rdfjs/types": "^1",
|
|
@@ -59,5 +60,8 @@
|
|
|
59
60
|
"*.{js,ts}": [
|
|
60
61
|
"eslint --fix --quiet"
|
|
61
62
|
]
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=18.0.0"
|
|
62
66
|
}
|
|
63
67
|
}
|