bump-cli 2.9.3 → 2.9.4
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 -2
- package/dist/core/diff.js +2 -1
- package/dist/core/overlay.js +5 -3
- package/dist/core/utils/file.d.ts +1 -1
- package/dist/core/utils/file.js +18 -2
- package/oclif.manifest.json +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ $ bump --help
|
|
|
88
88
|
The Bump.sh CLI is used to interact with your API documentation hosted on Bump.sh by using the API of developers.bump.sh
|
|
89
89
|
|
|
90
90
|
VERSION
|
|
91
|
-
bump-cli/2.9.
|
|
91
|
+
bump-cli/2.9.3 linux-x64 node-v20.18.1
|
|
92
92
|
|
|
93
93
|
USAGE
|
|
94
94
|
$ bump [COMMAND]
|
|
@@ -325,12 +325,37 @@ Make sure to have Node.js (At least v20) installed on your machine.
|
|
|
325
325
|
```
|
|
326
326
|
|
|
327
327
|
- Run the test suites
|
|
328
|
-
|
|
328
|
+
|
|
329
329
|
```shell
|
|
330
330
|
npm run test
|
|
331
331
|
npm run test-coverage # Run tests with coverage
|
|
332
332
|
```
|
|
333
333
|
|
|
334
|
+
### Use package in local environment
|
|
335
|
+
|
|
336
|
+
You can run the package by executing the file `bin/run.js` locally:
|
|
337
|
+
|
|
338
|
+
```shell
|
|
339
|
+
bin/run.js
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
For example to generate a preview:
|
|
343
|
+
|
|
344
|
+
```shell
|
|
345
|
+
./bin/run.js preview path/to/file.json
|
|
346
|
+
> Your preview is visible at: https://bump.sh/preview/42
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Please note that even if CLI is running locally, by default requests are sent to [Bump.sh API](https://developers.bump.sh/).
|
|
350
|
+
|
|
351
|
+
If you have a local version of the Bump.sh API, you can run CLI 100% in local environment
|
|
352
|
+
by setting the environment variable `BUMP_HOST`:
|
|
353
|
+
|
|
354
|
+
```shell
|
|
355
|
+
BUMP_HOST="http://localhost:3000" ./bin/run.js preview path/to/file.json
|
|
356
|
+
> Your preview is visible at: http://localhost:3000/preview/42
|
|
357
|
+
```
|
|
358
|
+
|
|
334
359
|
## License
|
|
335
360
|
|
|
336
361
|
The Bump CLI project is released under the [MIT License](http://opensource.org/licenses/MIT).
|
package/dist/core/diff.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Config } from '@oclif/core';
|
|
2
2
|
import { CLIError } from '@oclif/core/errors';
|
|
3
3
|
import debug from 'debug';
|
|
4
|
+
import { resolve } from 'node:path';
|
|
4
5
|
import { BumpApi } from '../api/index.js';
|
|
5
6
|
import { API } from '../definition.js';
|
|
6
7
|
export class Diff {
|
|
@@ -99,7 +100,7 @@ export class Diff {
|
|
|
99
100
|
}
|
|
100
101
|
async run(file1, file2, documentation, hub, branch, token, format, expires) {
|
|
101
102
|
if (!this._config)
|
|
102
|
-
this._config = await Config.load('
|
|
103
|
+
this._config = await Config.load(resolve(import.meta.dirname, './../../'));
|
|
103
104
|
let diffVersion;
|
|
104
105
|
if (file2 && (!documentation || !token)) {
|
|
105
106
|
diffVersion = await this.createDiff(file1, file2, expires);
|
package/dist/core/overlay.js
CHANGED
|
@@ -39,7 +39,7 @@ export class Overlay {
|
|
|
39
39
|
for (const path of paths) {
|
|
40
40
|
// The 'executeAction' will mutate the passed spec object in
|
|
41
41
|
// place.
|
|
42
|
-
this.executeAction(spec, action, path);
|
|
42
|
+
spec = this.executeAction(spec, action, path);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -74,11 +74,12 @@ export class Overlay {
|
|
|
74
74
|
this.remove(parent, thingToActUpon);
|
|
75
75
|
}
|
|
76
76
|
else if (Object.hasOwn(action, 'update')) {
|
|
77
|
-
this.update(spec, parent, action.update, thingToActUpon);
|
|
77
|
+
spec = this.update(spec, parent, action.update, thingToActUpon);
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
80
|
process.stderr.write(`WARNING: ${this.humanName(action)} needs either a 'remove' or an 'update' property\n`);
|
|
81
81
|
}
|
|
82
|
+
return spec;
|
|
82
83
|
}
|
|
83
84
|
humanName(action) {
|
|
84
85
|
return action.description ? `Action '${action.description}'` : 'Action';
|
|
@@ -101,7 +102,7 @@ export class Overlay {
|
|
|
101
102
|
// the given update with the whole spec.
|
|
102
103
|
spec = merger(spec, update);
|
|
103
104
|
}
|
|
104
|
-
else if (property_or_index) {
|
|
105
|
+
else if (property_or_index !== undefined) {
|
|
105
106
|
const targetObject = parent[property_or_index];
|
|
106
107
|
if (typeof targetObject === 'object' && typeof update === 'object') {
|
|
107
108
|
parent[property_or_index] =
|
|
@@ -117,5 +118,6 @@ export class Overlay {
|
|
|
117
118
|
catch (error) {
|
|
118
119
|
process.stderr.write(`Error applying overlay: ${error.message}\n`);
|
|
119
120
|
}
|
|
121
|
+
return spec;
|
|
120
122
|
}
|
|
121
123
|
}
|
|
@@ -3,7 +3,7 @@ type FileDescription = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const isDir: (
|
|
6
|
+
export declare const isDir: (path_or_url: string) => boolean;
|
|
7
7
|
export declare class File {
|
|
8
8
|
protected static readonly supportedFormats: string[];
|
|
9
9
|
static listInvalidConventionFiles(path: string, regex: RegExp): FileDescription[];
|
package/dist/core/utils/file.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
import { CLIError } from '@oclif/core/errors';
|
|
1
2
|
import { readdirSync, statSync } from 'node:fs';
|
|
2
3
|
import { basename, extname } from 'node:path';
|
|
3
|
-
export const isDir = (
|
|
4
|
+
export const isDir = (path_or_url) => {
|
|
5
|
+
if (isHttpUrl(path_or_url)) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return statSync(path_or_url).isDirectory();
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
if (error instanceof Error) {
|
|
13
|
+
throw new CLIError(error);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const isHttpUrl = (path) => {
|
|
4
19
|
try {
|
|
5
|
-
|
|
20
|
+
const url = new URL(path);
|
|
21
|
+
return ['http:', 'https:'].includes(url.protocol);
|
|
6
22
|
}
|
|
7
23
|
catch {
|
|
8
24
|
return false;
|
package/oclif.manifest.json
CHANGED
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"description": "Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable",
|
|
98
98
|
"name": "token",
|
|
99
99
|
"required": true,
|
|
100
|
+
"default": "99f52837852249b328c0a00249f846a3",
|
|
100
101
|
"hasDynamicHelp": false,
|
|
101
102
|
"multiple": false,
|
|
102
103
|
"type": "option"
|
|
@@ -190,6 +191,7 @@
|
|
|
190
191
|
"description": "Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable",
|
|
191
192
|
"name": "token",
|
|
192
193
|
"required": false,
|
|
194
|
+
"default": "99f52837852249b328c0a00249f846a3",
|
|
193
195
|
"hasDynamicHelp": false,
|
|
194
196
|
"multiple": false,
|
|
195
197
|
"type": "option"
|
|
@@ -277,5 +279,5 @@
|
|
|
277
279
|
"strict": true
|
|
278
280
|
}
|
|
279
281
|
},
|
|
280
|
-
"version": "2.9.
|
|
282
|
+
"version": "2.9.4"
|
|
281
283
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bump-cli",
|
|
3
3
|
"description": "The Bump CLI is used to interact with your API documentation hosted on Bump.sh by using the API of developers.bump.sh",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.4",
|
|
5
5
|
"author": "Paul Bonaud <paulr@bump.sh>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"bump": "./bin/run.js"
|