Socket
Socket
Sign inDemoInstall

bump-cli

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bump-cli - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

6

lib/api/error.js

@@ -5,5 +5,5 @@ "use strict";

const errors_1 = require("@oclif/errors");
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const debug = debug_1.default('bump-cli:api-client');
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const debug = (0, debug_1.default)('bump-cli:api-client');
class APIError extends errors_1.CLIError {

@@ -10,0 +10,0 @@ constructor(httpError, info = [], exit = 100) {

@@ -5,5 +5,5 @@ "use strict";

const tslib_1 = require("tslib");
const axios_1 = tslib_1.__importDefault(require("axios"));
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
const vars_1 = require("./vars");
const error_1 = tslib_1.__importDefault(require("./error"));
const error_1 = (0, tslib_1.__importDefault)(require("./error"));
exports.APIError = error_1.default;

@@ -57,2 +57,2 @@ class BumpApi {

exports.BumpApi = BumpApi;
tslib_1.__exportStar(require("./models"), exports);
(0, tslib_1.__exportStar)(require("./models"), exports);

@@ -31,2 +31,3 @@ export interface PingResponse {

unpublished?: boolean;
previous_version_id?: string;
}

@@ -33,0 +34,0 @@ export interface VersionResponse {

@@ -6,2 +6,6 @@ declare const fileArg: {

};
export { fileArg };
declare const otherFileArg: {
name: string;
description: string;
};
export { fileArg, otherFileArg };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fileArg = void 0;
exports.otherFileArg = exports.fileArg = void 0;
const fileArg = {

@@ -10,1 +10,6 @@ name: 'FILE',

exports.fileArg = fileArg;
const otherFileArg = {
name: 'FILE2',
description: 'Path or URL to a second API documentation file to compute its diff',
};
exports.otherFileArg = otherFileArg;

@@ -5,4 +5,4 @@ "use strict";

const tslib_1 = require("tslib");
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
const success_1 = tslib_1.__importDefault(require("./styled/success"));
const cli_ux_1 = (0, tslib_1.__importDefault)(require("cli-ux"));
const success_1 = (0, tslib_1.__importDefault)(require("./styled/success"));
if (process.env.BUMP_LOG_LEVEL) {

@@ -9,0 +9,0 @@ const logLevel = process.env.BUMP_LOG_LEVEL;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
function styledSuccess(message) {

@@ -6,0 +6,0 @@ const lines = message.split('\n');

@@ -5,6 +5,6 @@ "use strict";

const command_1 = require("@oclif/command");
const debug_1 = tslib_1.__importDefault(require("debug"));
const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
const definition_1 = require("./definition");
const api_1 = require("./api");
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
const package_json_1 = (0, tslib_1.__importDefault)(require("../package.json"));
class Command extends command_1.Command {

@@ -33,3 +33,3 @@ constructor() {

d(formatter, ...args) {
return debug_1.default(`bump-cli:command:${this.constructor.name.toLowerCase()}`)(formatter, ...args);
return (0, debug_1.default)(`bump-cli:command:${this.constructor.name.toLowerCase()}`)(formatter, ...args);
}

@@ -36,0 +36,0 @@ async pollingDelay() {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const command_1 = tslib_1.__importDefault(require("../command"));
const flags = tslib_1.__importStar(require("../flags"));
const command_1 = (0, tslib_1.__importDefault)(require("../command"));
const flags = (0, tslib_1.__importStar)(require("../flags"));
const args_1 = require("../args");

@@ -7,0 +7,0 @@ const cli_1 = require("../cli");

@@ -16,6 +16,7 @@ import Command from '../command';

name: string;
required: boolean;
description: string;
}[];
run(): Promise<VersionResponse | void>;
run(): Promise<void>;
createVersion(file: string, documentation: string, token: string, hub: string | undefined, previous_version_id?: string | undefined): Promise<VersionResponse | void>;
displayCompareResult(versionId: string, token: string, open: boolean): Promise<void>;
waitChangesResult(versionId: string, token: string, opts: {

@@ -22,0 +23,0 @@ timeout: number;

@@ -5,4 +5,4 @@ "use strict";

const errors_1 = require("@oclif/errors");
const command_1 = tslib_1.__importDefault(require("../command"));
const flags = tslib_1.__importStar(require("../flags"));
const command_1 = (0, tslib_1.__importDefault)(require("../command"));
const flags = (0, tslib_1.__importStar)(require("../flags"));
const args_1 = require("../args");

@@ -19,12 +19,34 @@ const cli_1 = require("../cli");

const { args, flags } = this.parse(Diff);
const [definition, references] = await this.prepareDefinition(args.FILE);
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
const [documentation, token] = [flags.doc, flags.token];
cli_1.cli.action.start("* Let's compare the given definition version");
const [documentation, hub, token] = [flags.doc, flags.hub, flags.token];
if (args.FILE2) {
cli_1.cli.action.start("* Let's compare the two given definition files");
}
else {
cli_1.cli.action.start("* Let's compare the given definition file with the currently deployed one");
}
const version = await this.createVersion(args.FILE, documentation, token, hub);
if (version) {
this.d(`Unpublished version created with ID ${version.id}`);
let version2 = undefined;
if (args.FILE2) {
version2 = await this.createVersion(args.FILE2, documentation, token, hub, version.id);
if (version2) {
this.d(`Unpublished version created with ID ${version2.id}`);
}
}
await this.displayCompareResult((version2 || version).id, token, flags.open);
}
cli_1.cli.action.stop();
return;
}
async createVersion(file, documentation, token, hub, previous_version_id = undefined) {
const [definition, references] = await this.prepareDefinition(file);
const request = {
documentation,
hub: flags.hub,
hub,
definition,
references,
unpublished: true,
previous_version_id,
};

@@ -34,21 +56,5 @@ const response = await this.bump.postVersion(request, token);

case 201:
let version = response.data;
this.d(`Unpublished version created with ID ${version.id}`);
version = await this.waitChangesResult(version.id, token, {
timeout: 30,
});
cli_1.cli.action.stop();
if (version && version.diff_summary) {
await cli_1.cli.log(version.diff_summary);
if (flags.open && version.diff_public_url) {
await cli_1.cli.open(version.diff_public_url);
}
}
else {
this.warn('There were no structural changes in your new definition');
}
return version;
return response.data;
break;
case 204:
cli_1.cli.action.stop();
this.warn('Your documentation has not changed');

@@ -59,2 +65,18 @@ break;

}
async displayCompareResult(versionId, token, open) {
const result = await this.waitChangesResult(versionId, token, {
timeout: 30,
});
cli_1.cli.action.stop();
if (result && result.diff_summary) {
await cli_1.cli.log(result.diff_summary);
if (open && result.diff_public_url) {
await cli_1.cli.open(result.diff_public_url);
}
}
else {
this.warn('There were no structural changes in your new definition');
}
return;
}
async waitChangesResult(versionId, token, opts) {

@@ -89,3 +111,3 @@ const diffResponse = await this.bump.getVersion(versionId, token);

$ bump diff FILE --doc <your_doc_id_or_slug> --token <your_doc_token>
* Let's compare the given definition version... done
* Let's compare the given definition file with the currently deployed one... done
Removed: GET /compare

@@ -97,3 +119,3 @@ Added: GET /versions/{versionId}

$ bump diff FILE --doc <doc_slug> --token <doc_token> > /tmp/my-saved-diff
* Let's compare the given definition version... done
* Let's compare the given definition file with the currently deployed one... done

@@ -107,5 +129,12 @@ $ cat /tmp/my-saved-diff

$ bump diff FILE --doc <doc_slug> --token <your_doc_token>
* Let's compare the given definition version... done
* Let's compare the given definition file with the currently deployed one... done
› Warning: Your documentation has not changed
`,
`Compare two different input files or URL independently to the one published on bump.sh
$ bump diff FILE FILE2 --doc <doc_slug> --token <your_doc_token>
* Let's compare the two given definition files... done
Updated: POST /versions
Body attribute added: previous_version_id
`,
];

@@ -119,2 +148,2 @@ Diff.flags = {

};
Diff.args = [args_1.fileArg];
Diff.args = [args_1.fileArg, args_1.otherFileArg];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const command_1 = tslib_1.__importDefault(require("../command"));
const flags = tslib_1.__importStar(require("../flags"));
const command_1 = (0, tslib_1.__importDefault)(require("../command"));
const flags = (0, tslib_1.__importStar)(require("../flags"));
const args_1 = require("../args");

@@ -46,3 +46,3 @@ const cli_1 = require("../cli");

cli_1.cli.action.start(`Waiting for changes on file ${file}...`);
fs_1.watch(file, async () => {
(0, fs_1.watch)(file, async () => {
if (!mutex.isLocked()) {

@@ -49,0 +49,0 @@ const release = await mutex.acquire();

@@ -6,6 +6,6 @@ "use strict";

const errors_1 = require("@oclif/errors");
const json_schema_ref_parser_1 = tslib_1.__importDefault(require("@apidevtools/json-schema-ref-parser"));
const json_schema_ref_parser_1 = (0, tslib_1.__importDefault)(require("@apidevtools/json-schema-ref-parser"));
const options_1 = require("@apidevtools/json-schema-ref-parser/lib/options");
const specs_1 = tslib_1.__importDefault(require("@asyncapi/specs"));
const path_1 = tslib_1.__importDefault(require("path"));
const specs_1 = (0, tslib_1.__importDefault)(require("@asyncapi/specs"));
const path_1 = (0, tslib_1.__importDefault)(require("path"));
class SupportedFormat {

@@ -12,0 +12,0 @@ }

@@ -7,3 +7,3 @@ "use strict";

// Re-export oclif flags https://oclif.io/docs/flags
tslib_1.__exportStar(require("@oclif/command/lib/flags"), exports);
(0, tslib_1.__exportStar)(require("@oclif/command/lib/flags"), exports);
// Custom flags for bum-cli

@@ -10,0 +10,0 @@ const doc = command_1.flags.build({

@@ -7,7 +7,7 @@ "use strict";

Object.defineProperty(exports, "run", { enumerable: true, get: function () { return command_1.run; } });
const diff_1 = tslib_1.__importDefault(require("./commands/diff"));
const diff_1 = (0, tslib_1.__importDefault)(require("./commands/diff"));
exports.Diff = diff_1.default;
const deploy_1 = tslib_1.__importDefault(require("./commands/deploy"));
const deploy_1 = (0, tslib_1.__importDefault)(require("./commands/deploy"));
exports.Deploy = deploy_1.default;
const preview_1 = tslib_1.__importDefault(require("./commands/preview"));
const preview_1 = (0, tslib_1.__importDefault)(require("./commands/preview"));
exports.Preview = preview_1.default;

@@ -1,1 +0,1 @@

{"version":"2.2.1","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"},"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.0) 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 * Let's compare the given definition version... 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 * Let's compare the given definition version... 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 * Let's compare the given definition version... done\n › Warning: Your documentation has not changed\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},"hub":{"name":"hub","type":"option","char":"b","description":"Hub id or slug. Can be provided via BUMP_HUB_ID environment variable"},"token":{"name":"token","type":"option","char":"t","description":"Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable","required":true},"open":{"name":"open","type":"boolean","char":"o","description":"Open the visual diff 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.0) specifications are currently supported.","required":true}]},"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.0) specifications are currently supported.","required":true}]}}}
{"version":"2.2.2","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"},"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.0) 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 * Let's compare 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 * Let's compare 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 * Let's compare 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 * Let's compare 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":true},"hub":{"name":"hub","type":"option","char":"b","description":"Hub id or slug. Can be provided via BUMP_HUB_ID environment variable"},"token":{"name":"token","type":"option","char":"t","description":"Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable","required":true},"open":{"name":"open","type":"boolean","char":"o","description":"Open the visual diff 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.0) 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.0) specifications are currently supported.","required":true}]}}}
{
"name": "bump-cli",
"description": "The Bump CLI is used to interact with your API documentation hosted on Bump by using the API of developers.bump.sh",
"version": "2.2.1",
"version": "2.2.2",
"author": "Paul Bonaud <paulr@bump.sh>",

@@ -6,0 +6,0 @@ "bin": {

@@ -117,3 +117,3 @@ # Bump cli

$ bump diff path/to/your/file.yml --doc DOC_ID_OR_SLUG --token DOC_TOKEN
* Let's compare the given definition version... done
* Let's compare the given definition file with the currently deployed one... done

@@ -124,2 +124,12 @@ Updated: POST /validations

If you want to compare two unpublished versions of your definition file, the `diff` command can retrieve a comparaison changelog between two given file or URL, “as simple as `git diff`”:
```sh-session
$ bump diff path/to/your/file.yml path/to/your/next-file.yml --doc <doc_slug> --token <your_doc_token>
* Let's compare the two given definition files... done
Updated: POST /versions
Body attribute added: previous_version_id
```
_Note: you can use the `--open` flag to open the visual diff URL in your browser directly._

@@ -126,0 +136,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc