bump-cli 2.4.1 → 2.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/lib/api/models.d.ts +1 -0
- package/lib/cli/index.d.ts +1 -1
- package/lib/commands/diff.d.ts +1 -0
- package/lib/commands/diff.js +4 -2
- package/lib/core/diff.d.ts +2 -2
- package/lib/core/diff.js +4 -3
- package/lib/definition.js +1 -0
- package/lib/flags.d.ts +2 -1
- package/lib/flags.js +6 -1
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/lib/api/models.d.ts
CHANGED
package/lib/cli/index.d.ts
CHANGED
|
@@ -26,6 +26,6 @@ declare const cli: {
|
|
|
26
26
|
log(format?: string | undefined, ...args: string[]): void;
|
|
27
27
|
url(text: string, uri: string, params?: {} | undefined): void;
|
|
28
28
|
annotation(text: string, annotation: string): void;
|
|
29
|
-
flush(): Promise<void>;
|
|
29
|
+
flush(ms?: number | undefined): Promise<void>;
|
|
30
30
|
};
|
|
31
31
|
export { cli };
|
package/lib/commands/diff.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export default class Diff extends Command {
|
|
|
12
12
|
token: flags.IOptionFlag<string | undefined>;
|
|
13
13
|
open: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
14
14
|
format: flags.IOptionFlag<string | undefined>;
|
|
15
|
+
expires: flags.IOptionFlag<string | undefined>;
|
|
15
16
|
};
|
|
16
17
|
static args: {
|
|
17
18
|
name: string;
|
package/lib/commands/diff.js
CHANGED
|
@@ -18,13 +18,14 @@ class Diff extends command_1.default {
|
|
|
18
18
|
const { args, flags } = this.parse(Diff);
|
|
19
19
|
/* Flags.format has a default value, so it's always defined. But
|
|
20
20
|
* oclif types doesn't detect it */
|
|
21
|
-
const [documentation, hub, branch, token, format] = [
|
|
21
|
+
const [documentation, hub, branch, token, format, expires] = [
|
|
22
22
|
flags.doc,
|
|
23
23
|
flags.hub,
|
|
24
24
|
flags.branch,
|
|
25
25
|
flags.token,
|
|
26
26
|
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
27
27
|
flags.format,
|
|
28
|
+
flags.expires,
|
|
28
29
|
];
|
|
29
30
|
if (format === 'text') {
|
|
30
31
|
if (args.FILE2) {
|
|
@@ -37,7 +38,7 @@ class Diff extends command_1.default {
|
|
|
37
38
|
if (!args.FILE2 && (!documentation || !token)) {
|
|
38
39
|
throw new errors_1.CLIError('Please provide a second file argument or login with an existing token');
|
|
39
40
|
}
|
|
40
|
-
const diff = await new diff_1.Diff(this.config).run(args.FILE, args.FILE2, documentation, hub, branch, token, format);
|
|
41
|
+
const diff = await new diff_1.Diff(this.config).run(args.FILE, args.FILE2, documentation, hub, branch, token, format, expires);
|
|
41
42
|
cli_1.cli.action.stop();
|
|
42
43
|
if (diff) {
|
|
43
44
|
await this.displayCompareResult(diff, format, flags.open);
|
|
@@ -109,5 +110,6 @@ Diff.flags = {
|
|
|
109
110
|
token: flags.token({ required: false }),
|
|
110
111
|
open: flags.open({ description: 'Open the visual diff in your browser' }),
|
|
111
112
|
format: flags.format(),
|
|
113
|
+
expires: flags.expires(),
|
|
112
114
|
};
|
|
113
115
|
Diff.args = [args_1.fileArg, args_1.otherFileArg];
|
package/lib/core/diff.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ export declare class Diff {
|
|
|
5
5
|
_bump: BumpApi;
|
|
6
6
|
_config: Config.IConfig;
|
|
7
7
|
constructor(config: Config.IConfig);
|
|
8
|
-
run(file1: string, file2: string | undefined, documentation: string | undefined, hub: string | undefined, branch: string | undefined, token: string | undefined, format: string): Promise<DiffResponse | undefined>;
|
|
8
|
+
run(file1: string, file2: string | undefined, documentation: string | undefined, hub: string | undefined, branch: string | undefined, token: string | undefined, format: string, expires: string | undefined): Promise<DiffResponse | undefined>;
|
|
9
9
|
get bumpClient(): BumpApi;
|
|
10
10
|
get pollingPeriod(): number;
|
|
11
|
-
createDiff(file1: string, file2: string): Promise<DiffResponse | undefined>;
|
|
11
|
+
createDiff(file1: string, file2: string, expires: string | undefined): Promise<DiffResponse | undefined>;
|
|
12
12
|
createVersion(file: string, documentation: string, token: string, hub: string | undefined, branch_name: string | undefined, previous_version_id?: string | undefined): Promise<VersionResponse | undefined>;
|
|
13
13
|
waitResult(result: VersionResponse | DiffResponse, token: string | undefined, opts: {
|
|
14
14
|
timeout: number;
|
package/lib/core/diff.js
CHANGED
|
@@ -10,10 +10,10 @@ class Diff {
|
|
|
10
10
|
constructor(config) {
|
|
11
11
|
this._config = config;
|
|
12
12
|
}
|
|
13
|
-
async run(file1, file2, documentation, hub, branch, token, format) {
|
|
13
|
+
async run(file1, file2, documentation, hub, branch, token, format, expires) {
|
|
14
14
|
let diffVersion = undefined;
|
|
15
15
|
if (file2 && (!documentation || !token)) {
|
|
16
|
-
diffVersion = await this.createDiff(file1, file2);
|
|
16
|
+
diffVersion = await this.createDiff(file1, file2, expires);
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
if (!documentation || !token) {
|
|
@@ -42,7 +42,7 @@ class Diff {
|
|
|
42
42
|
get pollingPeriod() {
|
|
43
43
|
return 1000;
|
|
44
44
|
}
|
|
45
|
-
async createDiff(file1, file2) {
|
|
45
|
+
async createDiff(file1, file2, expires) {
|
|
46
46
|
const api = await definition_1.API.load(file1);
|
|
47
47
|
const [previous_definition, previous_references] = api.extractDefinition();
|
|
48
48
|
const api2 = await definition_1.API.load(file2);
|
|
@@ -52,6 +52,7 @@ class Diff {
|
|
|
52
52
|
previous_references,
|
|
53
53
|
definition,
|
|
54
54
|
references,
|
|
55
|
+
expires_at: expires,
|
|
55
56
|
};
|
|
56
57
|
const response = await this.bumpClient.postDiff(request);
|
|
57
58
|
switch (response.status) {
|
package/lib/definition.js
CHANGED
|
@@ -20,6 +20,7 @@ SupportedFormat.asyncapi = {
|
|
|
20
20
|
'2.2': specs_1.default['2.2.0'],
|
|
21
21
|
'2.3': specs_1.default['2.3.0'],
|
|
22
22
|
'2.4': specs_1.default['2.4.0'],
|
|
23
|
+
'2.5': specs_1.default['2.5.0'],
|
|
23
24
|
};
|
|
24
25
|
class UnsupportedFormat extends errors_1.CLIError {
|
|
25
26
|
constructor(message = '') {
|
package/lib/flags.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ declare const dryRun: (options?: {}) => Parser.flags.IBooleanFlag<boolean>;
|
|
|
11
11
|
declare const open: (options?: {}) => Parser.flags.IBooleanFlag<boolean>;
|
|
12
12
|
declare const live: (options?: {}) => Parser.flags.IBooleanFlag<boolean>;
|
|
13
13
|
declare const format: flags.Definition<string>;
|
|
14
|
-
|
|
14
|
+
declare const expires: flags.Definition<string>;
|
|
15
|
+
export { doc, docName, hub, branch, token, autoCreate, dryRun, open, live, format, expires, };
|
package/lib/flags.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.format = exports.live = exports.open = exports.dryRun = exports.autoCreate = exports.token = exports.branch = exports.hub = exports.docName = exports.doc = void 0;
|
|
3
|
+
exports.expires = exports.format = exports.live = exports.open = exports.dryRun = exports.autoCreate = exports.token = exports.branch = exports.hub = exports.docName = exports.doc = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
6
|
// Re-export oclif flags https://oclif.io/docs/flags
|
|
@@ -79,3 +79,8 @@ const format = command_1.flags.build({
|
|
|
79
79
|
options: ['text', 'markdown', 'json', 'html'],
|
|
80
80
|
});
|
|
81
81
|
exports.format = format;
|
|
82
|
+
const expires = command_1.flags.build({
|
|
83
|
+
char: 'e',
|
|
84
|
+
description: "Specify a longer expiration date for public diffs (defaults to 1 day). Use iso8601 format to provide a date, or you can use `--expires 'never'` to keep the result live indefinitely.",
|
|
85
|
+
});
|
|
86
|
+
exports.expires = expires;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.5.0","commands":{"deploy":{"id":"deploy","description":"create a new version of your documentation from the given file or URL","pluginName":"bump-cli","pluginType":"core","aliases":[],"examples":["Deploy a new version of an existing documentation\n\n$ bump deploy FILE --doc <your_doc_id_or_slug> --token <your_doc_token>\n* Let's deploy a new documentation version on Bump... done\n* Your new documentation version will soon be ready\n","Deploy a new version of an existing documentation attached to a hub\n\n$ bump deploy FILE --doc <doc_slug> --hub <your_hub_id_or_slug> --token <your_doc_token>\n* Let's deploy a new documentation version on Bump... done\n* Your new documentation version will soon be ready\n","Validate a new documentation version before deploying it\n\n$ bump deploy FILE --dry-run --doc <doc_slug> --token <your_doc_token>\n* Let's validate a new documentation version on Bump... done\n* Definition is valid\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"doc":{"name":"doc","type":"option","char":"d","description":"Documentation public id or slug. Can be provided via BUMP_ID environment variable","required":true},"doc-name":{"name":"doc-name","type":"option","char":"n","description":"Documentation name. Used with --auto-create flag."},"hub":{"name":"hub","type":"option","char":"b","description":"Hub id or slug. Can be provided via BUMP_HUB_ID environment variable"},"branch":{"name":"branch","type":"option","char":"B","description":"Branch name. Can be provided via BUMP_BRANCH_NAME environment variable"},"token":{"name":"token","type":"option","char":"t","description":"Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable","required":true},"auto-create":{"name":"auto-create","type":"boolean","description":"Automatically create the documentation if needed (only available with a --hub flag). Documentation name can be provided with --doc-name flag. Default: false","allowNo":false},"dry-run":{"name":"dry-run","type":"boolean","description":"Validate a new documentation version. Does everything a normal deploy would do except publishing the new version. Useful in automated environments such as test platforms or continuous integration. Default: false","allowNo":false}},"args":[{"name":"FILE","description":"Path or URL to your API documentation file. OpenAPI (2.0 to 3.1.0) and AsyncAPI (2.x) specifications are currently supported.","required":true}]},"diff":{"id":"diff","description":"Get a comparaison diff with your documentation from the given file or URL","pluginName":"bump-cli","pluginType":"core","aliases":[],"examples":["Compare a potential new version with the currently published one:\n\n $ bump diff FILE --doc <your_doc_id_or_slug> --token <your_doc_token>\n * Comparing the given definition file with the currently deployed one... done\n Removed: GET /compare\n Added: GET /versions/{versionId}\n","Store the diff in a dedicated file:\n\n $ bump diff FILE --doc <doc_slug> --token <doc_token> > /tmp/my-saved-diff\n * Comparing the given definition file with the currently deployed one... done\n\n $ cat /tmp/my-saved-diff\n Removed: GET /compare\n Added: GET /versions/{versionId}\n","In case of a non modified definition FILE compared to your existing documentation, no changes are output:\n\n $ bump diff FILE --doc <doc_slug> --token <your_doc_token>\n * Comparing the given definition file with the currently deployed one... done\n › Warning: Your documentation has not changed\n","Compare two different input files or URL independently to the one published on bump.sh\n\n $ bump diff FILE FILE2 --doc <doc_slug> --token <your_doc_token>\n * Comparing the two given definition files... done\n Updated: POST /versions\n Body attribute added: previous_version_id\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"doc":{"name":"doc","type":"option","char":"d","description":"Documentation public id or slug. Can be provided via BUMP_ID environment variable","required":false},"hub":{"name":"hub","type":"option","char":"b","description":"Hub id or slug. Can be provided via BUMP_HUB_ID environment variable"},"branch":{"name":"branch","type":"option","char":"B","description":"Branch name. Can be provided via BUMP_BRANCH_NAME environment variable"},"token":{"name":"token","type":"option","char":"t","description":"Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable","required":false},"open":{"name":"open","type":"boolean","char":"o","description":"Open the visual diff in your browser","allowNo":false},"format":{"name":"format","type":"option","char":"f","description":"Format in which to provide the diff result","options":["text","markdown","json","html"],"default":"text"},"expires":{"name":"expires","type":"option","char":"e","description":"Specify a longer expiration date for public diffs (defaults to 1 day). Use iso8601 format to provide a date, or you can use `--expires 'never'` to keep the result live indefinitely."}},"args":[{"name":"FILE","description":"Path or URL to your API documentation file. OpenAPI (2.0 to 3.1.0) and AsyncAPI (2.x) specifications are currently supported.","required":true},{"name":"FILE2","description":"Path or URL to a second API documentation file to compute its diff"}]},"preview":{"id":"preview","description":"create a documentation preview from the given file or URL","pluginName":"bump-cli","pluginType":"core","aliases":[],"examples":["$ bump preview FILE\n* Your preview is visible at: https://bump.sh/preview/45807371-9a32-48a7-b6e4-1cb7088b5b9b\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"live":{"name":"live","type":"boolean","char":"l","description":"Generate a preview each time you save the given file","allowNo":false},"open":{"name":"open","type":"boolean","char":"o","description":"Open the generated preview URL in your browser","allowNo":false}},"args":[{"name":"FILE","description":"Path or URL to your API documentation file. OpenAPI (2.0 to 3.1.0) and AsyncAPI (2.x) specifications are currently supported.","required":true}]}}}
|
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 by using the API of developers.bump.sh",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"author": "Paul Bonaud <paulr@bump.sh>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"bump": "./bin/run"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@oclif/test": "^2.0.3",
|
|
13
13
|
"@types/debug": "^4.1.5",
|
|
14
14
|
"@types/mocha": "^10.0.0",
|
|
15
|
-
"@types/node": "^
|
|
15
|
+
"@types/node": "^18.11.18",
|
|
16
16
|
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
|
17
17
|
"@typescript-eslint/parser": "^4.21.0",
|
|
18
18
|
"chai": "^4.3.4",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"types": "lib/index.d.ts",
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@apidevtools/json-schema-ref-parser": "^9.0.7",
|
|
80
|
-
"@asyncapi/specs": "^
|
|
80
|
+
"@asyncapi/specs": "^4.0.1",
|
|
81
81
|
"@oclif/command": "^1.8.16",
|
|
82
82
|
"@oclif/config": "^1.17.0",
|
|
83
83
|
"@oclif/core": "^1.3.3",
|