@quobix/vacuum 0.0.13 → 0.0.20
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 +30 -18
- 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)
|
|
@@ -51,14 +76,14 @@ See all the documentation at https://quobix.com/vacuum
|
|
|
51
76
|
|
|
52
77
|
---
|
|
53
78
|
|
|
54
|
-
> **vacuum can suck all the lint of a 5mb OpenAPI spec in about
|
|
79
|
+
> **vacuum can suck all the lint of a 5mb OpenAPI spec in about 230ms.**
|
|
55
80
|
|
|
56
81
|
Designed to reliably lint OpenAPI specifications, **very, very quickly**. Including _very large_ ones. Spectral can be quite slow
|
|
57
82
|
when used as an API and does not scale for enterprise applications.
|
|
58
83
|
|
|
59
84
|
vacuum will tell you what is wrong with your spec, why, where and how to fix it.
|
|
60
85
|
|
|
61
|
-
vacuum will work at scale and is designed as a CLI (with a UI) and a library to be consumed in other applications.
|
|
86
|
+
vacuum will work at scale and is designed as a CLI (with a web or console UI) and a library to be consumed in other applications.
|
|
62
87
|
|
|
63
88
|
### Dashboard
|
|
64
89
|
|
|
@@ -78,20 +103,11 @@ 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+_**
|
|
85
|
-
|
|
86
|
-
You can use either **YAML** or **JSON** vacuum supports both.
|
|
87
|
-
|
|
88
|
-
## Install using [homebrew](https://brew.sh) tap
|
|
106
|
+
> **_Supports OpenAPI Version 2 (Swagger) and Version 3+_**
|
|
89
107
|
|
|
90
|
-
|
|
91
|
-
brew install daveshanley/vacuum/vacuum
|
|
92
|
-
```
|
|
108
|
+
You can use either **YAML** or **JSON**, vacuum supports both formats.
|
|
93
109
|
|
|
94
|
-
|
|
110
|
+
AsyncAPI support is coming soon!
|
|
95
111
|
|
|
96
112
|
## Check out the code
|
|
97
113
|
|
|
@@ -137,10 +153,6 @@ To run, just add `docker dshanley/vacuum` as your command, like so
|
|
|
137
153
|
docker dshanley/vacuum lint <your-openapi-spec.yaml>
|
|
138
154
|
```
|
|
139
155
|
|
|
140
|
-
---
|
|
141
|
-
> 👉 **Please note, the flags and commands below will change as the experience is refined.** 👈
|
|
142
|
-
---
|
|
143
|
-
|
|
144
156
|
## Build an interactive HTML report
|
|
145
157
|
|
|
146
158
|
```
|
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: "
|
|
13
|
-
linux: "
|
|
14
|
-
win32: "
|
|
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
|
});
|