Skip to content

Commit d6e0f2d

Browse files
P0lipMarc MacLeod
authored andcommitted
fix: binary building (#113)
Can now build binaries via `yarn build.binary`.
1 parent d588f62 commit d6e0f2d

File tree

3 files changed

+195
-42
lines changed

3 files changed

+195
-42
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,50 @@ A flexible JSON object linter with out of the box support for OpenAPI v2 and v3
1616

1717
## Installation
1818

19-
```shell
19+
### Local Installation
20+
21+
```bash
2022
npm install @stoplight/spectral
2123
```
2224

25+
### Global Installation
26+
27+
```bash
28+
npm install -g @stoplight/spectral
29+
```
30+
2331
Supports Node v8.3+.
2432

33+
### Executable binaries
34+
35+
For users without Node and/or NPM/Yarn, we provide standalone packages for all major platforms:
36+
37+
- x64 Windows
38+
- x64 MacOS
39+
- x64 Linux
40+
41+
You can find them [here](https://github.com/stoplightio/spectral/releases).
42+
Once downloaded, you can proceed with the standard procedure for running any CLI tool.
43+
44+
```bash
45+
./spectral-macos lint petstore.yaml
46+
```
47+
48+
Note, the binaries are *not* auto-updatable, therefore you will need to download a new version on your own.
49+
50+
#### Installing binaries system-wide
51+
52+
##### Linux
53+
54+
```bash
55+
sudo mv ./spectral-linux /usr/local/bin/spectral
56+
```
57+
58+
You may need to restart your terminal.
59+
Now, `spectral` command will be accessible in your terminal.
60+
61+
Head over to [releases](https://github.com/stoplightio/spectral/releases) for the latest binaries.
62+
2563
## Usage
2664

2765
### CLI

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
},
4141
"scripts": {
4242
"build": "sl-scripts build && oclif-dev manifest && node ./scripts/prepare-cli",
43+
"build.binary": "yarn build && cp yarn.lock dist && cd dist && yarn && pkg . --out-path ./bin",
4344
"build.docs": "sl-scripts build:typedoc",
4445
"commit": "git-cz",
4546
"lint": "tslint 'src/**/*.ts'",
@@ -54,14 +55,15 @@
5455
},
5556
"dependencies": {
5657
"@oclif/command": "^1.0",
58+
"@oclif/config": "^1.12.11",
5759
"@oclif/plugin-help": "^2.0",
5860
"@stoplight/json": "^1.8.0",
5961
"@stoplight/json-ref-resolver": "^1.2.2",
6062
"@stoplight/types": "^4.0.0",
6163
"@stoplight/yaml": "^2.1.1",
6264
"ajv": "6.x.x",
6365
"chalk": "^2.4.2",
64-
"jsonpath": "https://github.com/stoplightio/jsonpath#78140eb1980d4ff385780e2fa12177735685ec3e",
66+
"jsonpath": "https://github.com/stoplightio/jsonpath#f1c0e9e634da2d45671b7639fa0a99afc807da17",
6567
"lodash": ">=4.17.5",
6668
"node-fetch": "2.x.x",
6769
"strip-ansi": "^5.2.0",
@@ -81,6 +83,7 @@
8183
"fs-extra": "^7.0.1",
8284
"jest": "24.5.x",
8385
"nock": "^10.0.6",
86+
"pkg": "4.3.7",
8487
"ts-jest": "24.0.x",
8588
"tslint": "5.14.0",
8689
"tslint-config-stoplight": "1.2.0",
@@ -110,5 +113,10 @@
110113
},
111114
"release": {
112115
"extends": "@stoplight/scripts/release"
116+
},
117+
"pkg": {
118+
"scripts": [
119+
"cli/**/*.js"
120+
]
113121
}
114122
}

0 commit comments

Comments
 (0)