@quobix/vacuum 0.0.13 → 0.0.15
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 +27 -9
- package/bin/vacuum.js +16 -16
- package/npm-install/config.js +14 -14
- package/npm-install/postinstall.js +56 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,31 @@ An **ultra-super-fast**, lightweight OpenAPI linter and quality checking tool, w
|
|
|
10
10
|
|
|
11
11
|
It's also compatible with existing [Spectral](https://github.com/stoplightio/spectral) rulesets.
|
|
12
12
|
|
|
13
|
+
## Install using [homebrew](https://brew.sh) tap
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
brew install daveshanley/vacuum/vacuum
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Install using [npm](https://npmjs.com)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
npm i -g @quobix/vacuum
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Install using [yarn](https://yarnpkg.com/)
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
yarn global add @quobix/vacuum
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Install using curl
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
curl -fsSL https://quobix.com/scripts/install_vacuum.sh | sh
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
|
|
13
38
|
## Documentation
|
|
14
39
|
|
|
15
40
|
### [Quick Start Guide 🚀](https://quobix.com/vacuum/start)
|
|
@@ -78,20 +103,13 @@ No external dependencies, the HTML report will run completely offline.
|
|
|
78
103
|
|
|
79
104
|
---
|
|
80
105
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
> Please be warned, this is _early_ code. I am actively working on it.
|
|
84
|
-
>> **_Supports OpenAPI Version 2 (Swagger) and Version 3+_**
|
|
106
|
+
> **_Supports OpenAPI Version 2 (Swagger) and Version 3+_**
|
|
85
107
|
|
|
86
108
|
You can use either **YAML** or **JSON** vacuum supports both.
|
|
87
109
|
|
|
88
|
-
## Install using [homebrew](https://brew.sh) tap
|
|
89
110
|
|
|
90
|
-
```
|
|
91
|
-
brew install daveshanley/vacuum/vacuum
|
|
92
|
-
```
|
|
93
111
|
|
|
94
|
-
|
|
112
|
+
|
|
95
113
|
|
|
96
114
|
## Check out the code
|
|
97
115
|
|
package/bin/vacuum.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { execFileSync } from "child_process";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { exit } from "process";
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
execFileSync(path.resolve(`${__dirname}/vacuum`), process.argv.slice(2), {
|
|
12
|
-
stdio: "inherit",
|
|
13
|
-
});
|
|
14
|
-
} catch (e) {
|
|
15
|
-
exit(1)
|
|
16
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from "child_process";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { exit } from "process";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
execFileSync(path.resolve(`${__dirname}/vacuum`), process.argv.slice(2), {
|
|
12
|
+
stdio: "inherit",
|
|
13
|
+
});
|
|
14
|
+
} catch (e) {
|
|
15
|
+
exit(1)
|
|
16
|
+
}
|
package/npm-install/config.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export const CONFIG = {
|
|
2
|
-
name: "vacuum",
|
|
3
|
-
path: "./bin",
|
|
4
|
-
url: "https://github.com/daveshanley/vacuum/releases/download/v{{version}}/{{bin_name}}_{{version}}_{{platform}}_{{arch}}.tar.gz",
|
|
5
|
-
};
|
|
6
|
-
export const ARCH_MAPPING = {
|
|
7
|
-
ia32: "i386",
|
|
8
|
-
x64: "x86_64",
|
|
9
|
-
arm64: "arm64",
|
|
10
|
-
};
|
|
11
|
-
export const PLATFORM_MAPPING = {
|
|
12
|
-
darwin: "Darwin",
|
|
13
|
-
linux: "Linux",
|
|
14
|
-
win32: "Windows",
|
|
1
|
+
export const CONFIG = {
|
|
2
|
+
name: "vacuum",
|
|
3
|
+
path: "./bin",
|
|
4
|
+
url: "https://github.com/daveshanley/vacuum/releases/download/v{{version}}/{{bin_name}}_{{version}}_{{platform}}_{{arch}}.tar.gz",
|
|
5
|
+
};
|
|
6
|
+
export const ARCH_MAPPING = {
|
|
7
|
+
ia32: "i386",
|
|
8
|
+
x64: "x86_64",
|
|
9
|
+
arm64: "arm64",
|
|
10
|
+
};
|
|
11
|
+
export const PLATFORM_MAPPING = {
|
|
12
|
+
darwin: "Darwin",
|
|
13
|
+
linux: "Linux",
|
|
14
|
+
win32: "Windows",
|
|
15
15
|
};
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { createWriteStream } from "fs";
|
|
2
|
-
import * as fs from "fs/promises";
|
|
3
|
-
import fetch from "node-fetch";
|
|
4
|
-
import { pipeline } from "stream/promises";
|
|
5
|
-
import tar from "tar";
|
|
6
|
-
import { execSync } from "child_process";
|
|
7
|
-
|
|
8
|
-
import { ARCH_MAPPING, CONFIG, PLATFORM_MAPPING } from "./config.js";
|
|
9
|
-
|
|
10
|
-
async function install() {
|
|
11
|
-
if (process.platform === "android") {
|
|
12
|
-
console.log("Installing, may take a moment...");
|
|
13
|
-
const cmd =
|
|
14
|
-
"pkg upgrade && pkg install golang git -y && git clone https://github.com/daveshanley/vacuum.git && cd cli/ && go build -o $PREFIX/bin/vacuum";
|
|
15
|
-
execSync(cmd, { encoding: "utf-8" });
|
|
16
|
-
console.log("Installation successful!");
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const packageJson = await fs.readFile("package.json").then(JSON.parse);
|
|
20
|
-
let version = packageJson.version;
|
|
21
|
-
|
|
22
|
-
if (typeof version !== "string") {
|
|
23
|
-
throw new Error("Missing version in package.json");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (version[0] === "v") version = version.slice(1);
|
|
27
|
-
|
|
28
|
-
let { name: binName, path: binPath, url } = CONFIG;
|
|
29
|
-
|
|
30
|
-
url = url.replace(/{{arch}}/g, ARCH_MAPPING[process.arch]);
|
|
31
|
-
url = url.replace(/{{platform}}/g, PLATFORM_MAPPING[process.platform]);
|
|
32
|
-
url = url.replace(/{{version}}/g, version);
|
|
33
|
-
url = url.replace(/{{bin_name}}/g, binName);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
console.log('fetching from URL', url)
|
|
37
|
-
const response = await fetch(url);
|
|
38
|
-
if (!response.ok) {
|
|
39
|
-
throw new Error("Failed fetching the binary: " + response.statusText);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const tarFile = "downloaded.tar.gz";
|
|
43
|
-
|
|
44
|
-
await fs.mkdir(binPath, { recursive: true });
|
|
45
|
-
await pipeline(response.body, createWriteStream(tarFile));
|
|
46
|
-
await tar.x({ file: tarFile, cwd: binPath });
|
|
47
|
-
await fs.rm(tarFile);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
install()
|
|
51
|
-
.then(async () => {
|
|
52
|
-
process.exit(0);
|
|
53
|
-
})
|
|
54
|
-
.catch(async (err) => {
|
|
55
|
-
console.error(err);
|
|
56
|
-
process.exit(1);
|
|
1
|
+
import { createWriteStream } from "fs";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
3
|
+
import fetch from "node-fetch";
|
|
4
|
+
import { pipeline } from "stream/promises";
|
|
5
|
+
import tar from "tar";
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
|
|
8
|
+
import { ARCH_MAPPING, CONFIG, PLATFORM_MAPPING } from "./config.js";
|
|
9
|
+
|
|
10
|
+
async function install() {
|
|
11
|
+
if (process.platform === "android") {
|
|
12
|
+
console.log("Installing, may take a moment...");
|
|
13
|
+
const cmd =
|
|
14
|
+
"pkg upgrade && pkg install golang git -y && git clone https://github.com/daveshanley/vacuum.git && cd cli/ && go build -o $PREFIX/bin/vacuum";
|
|
15
|
+
execSync(cmd, { encoding: "utf-8" });
|
|
16
|
+
console.log("Installation successful!");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const packageJson = await fs.readFile("package.json").then(JSON.parse);
|
|
20
|
+
let version = packageJson.version;
|
|
21
|
+
|
|
22
|
+
if (typeof version !== "string") {
|
|
23
|
+
throw new Error("Missing version in package.json");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (version[0] === "v") version = version.slice(1);
|
|
27
|
+
|
|
28
|
+
let { name: binName, path: binPath, url } = CONFIG;
|
|
29
|
+
|
|
30
|
+
url = url.replace(/{{arch}}/g, ARCH_MAPPING[process.arch]);
|
|
31
|
+
url = url.replace(/{{platform}}/g, PLATFORM_MAPPING[process.platform]);
|
|
32
|
+
url = url.replace(/{{version}}/g, version);
|
|
33
|
+
url = url.replace(/{{bin_name}}/g, binName);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
console.log('fetching from URL', url)
|
|
37
|
+
const response = await fetch(url);
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
throw new Error("Failed fetching the binary: " + response.statusText);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const tarFile = "downloaded.tar.gz";
|
|
43
|
+
|
|
44
|
+
await fs.mkdir(binPath, { recursive: true });
|
|
45
|
+
await pipeline(response.body, createWriteStream(tarFile));
|
|
46
|
+
await tar.x({ file: tarFile, cwd: binPath });
|
|
47
|
+
await fs.rm(tarFile);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
install()
|
|
51
|
+
.then(async () => {
|
|
52
|
+
process.exit(0);
|
|
53
|
+
})
|
|
54
|
+
.catch(async (err) => {
|
|
55
|
+
console.error(err);
|
|
56
|
+
process.exit(1);
|
|
57
57
|
});
|