coderifts 1.3.0 → 1.5.0
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 +6 -20
- package/package.json +5 -15
- package/scripts/postinstall.js +0 -41
package/README.md
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @coderifts/cli
|
|
2
2
|
|
|
3
3
|
Detect breaking API changes between OpenAPI specs from the command line. Works locally or with the CodeRifts cloud API.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -g coderifts
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Or run without installing:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npx coderifts diff old-api.yaml new-api.yaml
|
|
8
|
+
npm install -g @coderifts/cli
|
|
15
9
|
```
|
|
16
10
|
|
|
17
11
|
## Quick Start
|
|
@@ -70,7 +64,8 @@ Save your CodeRifts API key for cloud features. Get a free key at [app.coderifts
|
|
|
70
64
|
|
|
71
65
|
```yaml
|
|
72
66
|
- name: Check API breaking changes
|
|
73
|
-
run:
|
|
67
|
+
run: |
|
|
68
|
+
npx @coderifts/cli diff old-api.yaml new-api.yaml --ci --format json
|
|
74
69
|
```
|
|
75
70
|
|
|
76
71
|
### GitLab CI
|
|
@@ -78,13 +73,13 @@ Save your CodeRifts API key for cloud features. Get a free key at [app.coderifts
|
|
|
78
73
|
```yaml
|
|
79
74
|
api-check:
|
|
80
75
|
script:
|
|
81
|
-
- npx coderifts diff old-api.yaml new-api.yaml --ci --threshold 40
|
|
76
|
+
- npx @coderifts/cli diff old-api.yaml new-api.yaml --ci --threshold 40
|
|
82
77
|
```
|
|
83
78
|
|
|
84
79
|
### Jenkins
|
|
85
80
|
|
|
86
81
|
```groovy
|
|
87
|
-
sh 'npx coderifts diff old-api.yaml new-api.yaml --ci'
|
|
82
|
+
sh 'npx @coderifts/cli diff old-api.yaml new-api.yaml --ci'
|
|
88
83
|
```
|
|
89
84
|
|
|
90
85
|
## Environment Variables
|
|
@@ -94,18 +89,9 @@ sh 'npx coderifts diff old-api.yaml new-api.yaml --ci'
|
|
|
94
89
|
| `CODERIFTS_API_KEY` | API key (alternative to `coderifts login`) |
|
|
95
90
|
| `NO_COLOR` | Disable colored output |
|
|
96
91
|
|
|
97
|
-
## Exit Codes
|
|
98
|
-
|
|
99
|
-
| Code | Meaning |
|
|
100
|
-
|------|---------|
|
|
101
|
-
| `0` | No breaking changes (or below threshold) |
|
|
102
|
-
| `1` | Breaking changes found (in CI mode) or analysis failed |
|
|
103
|
-
|
|
104
92
|
## Links
|
|
105
93
|
|
|
106
94
|
- [Website](https://coderifts.com)
|
|
107
|
-
- [CLI Integration Page](https://coderifts.com/integrations/cli/)
|
|
108
95
|
- [API Docs](https://app.coderifts.com/api/docs)
|
|
109
96
|
- [Get API Key](https://app.coderifts.com/api/signup)
|
|
110
97
|
- [GitHub](https://github.com/coderifts/app)
|
|
111
|
-
- [npm](https://www.npmjs.com/package/coderifts)
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coderifts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Detect breaking API changes from the command line. Works locally or with the CodeRifts cloud API.",
|
|
5
5
|
"author": "CodeRifts <hello@coderifts.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
8
|
-
"coderifts": "./bin/coderifts.js"
|
|
8
|
+
"coderifts-cli": "./bin/coderifts.js"
|
|
9
9
|
},
|
|
10
10
|
"main": "src/commands/diff.js",
|
|
11
11
|
"files": [
|
|
12
12
|
"bin/",
|
|
13
13
|
"src/",
|
|
14
|
-
"scripts/",
|
|
15
14
|
"README.md"
|
|
16
15
|
],
|
|
17
16
|
"keywords": [
|
|
@@ -22,8 +21,7 @@
|
|
|
22
21
|
"governance",
|
|
23
22
|
"cli",
|
|
24
23
|
"ci-cd",
|
|
25
|
-
"swagger"
|
|
26
|
-
"devtools"
|
|
24
|
+
"swagger"
|
|
27
25
|
],
|
|
28
26
|
"repository": {
|
|
29
27
|
"type": "git",
|
|
@@ -33,15 +31,7 @@
|
|
|
33
31
|
"homepage": "https://coderifts.com",
|
|
34
32
|
"bugs": "https://github.com/coderifts/app/issues",
|
|
35
33
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"test": "node --test test/*.test.js",
|
|
40
|
-
"postinstall": "node scripts/postinstall.js"
|
|
41
|
-
},
|
|
42
|
-
"overrides": {
|
|
43
|
-
"z-schema": "^8.4.0",
|
|
44
|
-
"json-schema-ref-parser": "npm:@apidevtools/json-schema-ref-parser@^11.0.0"
|
|
34
|
+
"node": ">=16.0.0"
|
|
45
35
|
},
|
|
46
36
|
"dependencies": {
|
|
47
37
|
"chalk": "^4.1.2",
|
|
@@ -49,7 +39,7 @@
|
|
|
49
39
|
"commander": "^12.0.0",
|
|
50
40
|
"inquirer": "^8.2.6",
|
|
51
41
|
"js-yaml": "^4.1.0",
|
|
52
|
-
"openapi-diff": "^0.
|
|
42
|
+
"openapi-diff": "^0.23.5",
|
|
53
43
|
"ora": "^5.4.1"
|
|
54
44
|
}
|
|
55
45
|
}
|
package/scripts/postinstall.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Postinstall patch: z-schema v8+ exports { default: ZSchema } instead of ZSchema directly.
|
|
4
|
-
* This patches @apidevtools/swagger-parser to handle both export styles.
|
|
5
|
-
*/
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
const schemaPath = require.resolve('@apidevtools/swagger-parser/lib/validators/schema.js');
|
|
11
|
-
let content = fs.readFileSync(schemaPath, 'utf8');
|
|
12
|
-
|
|
13
|
-
if (!content.includes('_ZSchema')) {
|
|
14
|
-
content = content.replace(
|
|
15
|
-
'const ZSchema = require("z-schema");',
|
|
16
|
-
'const _ZSchema = require("z-schema"); const ZSchema = _ZSchema.default || _ZSchema;'
|
|
17
|
-
);
|
|
18
|
-
fs.writeFileSync(schemaPath, content);
|
|
19
|
-
console.log('postinstall: patched z-schema import in swagger-parser');
|
|
20
|
-
}
|
|
21
|
-
} catch (err) {
|
|
22
|
-
console.log('postinstall: skipping z-schema patch:', err.message);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Patch 2: json-schema-ref-parser v11+ exports { default: $RefParser } instead of $RefParser directly
|
|
26
|
-
// json-schema-diff uses `new RefParser()` which breaks with the new export style
|
|
27
|
-
try {
|
|
28
|
-
const derefPath = require.resolve('json-schema-diff/dist/json-schema-diff/diff-schemas/dereference-schema.js');
|
|
29
|
-
let content2 = fs.readFileSync(derefPath, 'utf8');
|
|
30
|
-
|
|
31
|
-
if (!content2.includes('_RefParser')) {
|
|
32
|
-
content2 = content2.replace(
|
|
33
|
-
'const RefParser = require("json-schema-ref-parser");',
|
|
34
|
-
'const _RefParser = require("json-schema-ref-parser"); const RefParser = _RefParser.default || _RefParser;'
|
|
35
|
-
);
|
|
36
|
-
fs.writeFileSync(derefPath, content2);
|
|
37
|
-
console.log('postinstall: patched json-schema-ref-parser import in json-schema-diff');
|
|
38
|
-
}
|
|
39
|
-
} catch (err) {
|
|
40
|
-
console.log('postinstall: skipping ref-parser patch:', err.message);
|
|
41
|
-
}
|