@redocly/cli 1.0.0-beta.128 → 1.0.0-beta.129
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/__tests__/commands/build-docs.test.js +1 -1
- package/lib/__tests__/commands/bundle.test.js +18 -17
- package/lib/__tests__/commands/join.test.js +9 -8
- package/lib/__tests__/commands/lint.test.js +40 -20
- package/lib/__tests__/commands/push-region.test.js +3 -2
- package/lib/__tests__/commands/push.test.js +94 -55
- package/lib/__tests__/utils.test.js +100 -40
- package/lib/__tests__/wrapper.test.d.ts +1 -0
- package/lib/__tests__/wrapper.test.js +47 -0
- package/lib/commands/build-docs/index.d.ts +2 -1
- package/lib/commands/build-docs/index.js +1 -2
- package/lib/commands/bundle.d.ts +10 -4
- package/lib/commands/bundle.js +4 -8
- package/lib/commands/join.d.ts +6 -3
- package/lib/commands/join.js +1 -2
- package/lib/commands/lint.d.ts +13 -6
- package/lib/commands/lint.js +9 -17
- package/lib/commands/login.d.ts +5 -3
- package/lib/commands/login.js +2 -2
- package/lib/commands/preview-docs/index.d.ts +4 -2
- package/lib/commands/preview-docs/index.js +11 -4
- package/lib/commands/push.d.ts +11 -6
- package/lib/commands/push.js +40 -22
- package/lib/commands/split/index.d.ts +4 -2
- package/lib/commands/stats.d.ts +7 -4
- package/lib/commands/stats.js +1 -2
- package/lib/index.js +70 -22
- package/lib/types.d.ts +11 -8
- package/lib/update-version-notifier.d.ts +1 -0
- package/lib/update-version-notifier.js +6 -5
- package/lib/utils.d.ts +22 -2
- package/lib/utils.js +104 -11
- package/lib/wrapper.d.ts +4 -0
- package/lib/wrapper.js +52 -0
- package/package.json +3 -3
package/lib/wrapper.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.commandWrapper = void 0;
|
|
13
|
+
const openapi_core_1 = require("@redocly/openapi-core");
|
|
14
|
+
const update_version_notifier_1 = require("./update-version-notifier");
|
|
15
|
+
const utils_1 = require("./utils");
|
|
16
|
+
const lint_1 = require("./commands/lint");
|
|
17
|
+
function commandWrapper(commandHandler) {
|
|
18
|
+
return (argv) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
let code = 2;
|
|
20
|
+
let hasConfig;
|
|
21
|
+
let telemetry;
|
|
22
|
+
try {
|
|
23
|
+
if (argv.config && !openapi_core_1.doesYamlFileExist(argv.config)) {
|
|
24
|
+
utils_1.exitWithError('Please, provide valid path to the configuration file');
|
|
25
|
+
}
|
|
26
|
+
const config = (yield utils_1.loadConfigAndHandleErrors({
|
|
27
|
+
configPath: argv.config,
|
|
28
|
+
customExtends: argv.extends,
|
|
29
|
+
region: argv.region,
|
|
30
|
+
files: argv.file,
|
|
31
|
+
processRawConfig: lint_1.lintConfigCallback(argv, update_version_notifier_1.version),
|
|
32
|
+
}));
|
|
33
|
+
telemetry = config.telemetry;
|
|
34
|
+
hasConfig = !config.styleguide.recommendedFallback;
|
|
35
|
+
code = 1;
|
|
36
|
+
yield commandHandler(argv, config, update_version_notifier_1.version);
|
|
37
|
+
code = 0;
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
// Do nothing
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
if (process.env.REDOCLY_TELEMETRY !== 'off' && telemetry !== 'off') {
|
|
44
|
+
yield utils_1.sendTelemetry(argv, code, hasConfig);
|
|
45
|
+
}
|
|
46
|
+
process.once('beforeExit', () => {
|
|
47
|
+
process.exit(code);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.commandWrapper = commandWrapper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.129",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"Roman Hotsiy <roman@redoc.ly> (https://redoc.ly/)"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@redocly/openapi-core": "1.0.0-beta.
|
|
36
|
+
"@redocly/openapi-core": "1.0.0-beta.129",
|
|
37
37
|
"assert-node-version": "^1.0.3",
|
|
38
38
|
"chokidar": "^3.5.1",
|
|
39
39
|
"colorette": "^1.2.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react": "^17.0.1",
|
|
46
46
|
"react-dom": "^17.0.1",
|
|
47
47
|
"redoc": "~2.0.0",
|
|
48
|
-
"semver": "^7.5.
|
|
48
|
+
"semver": "^7.5.2",
|
|
49
49
|
"simple-websocket": "^9.0.0",
|
|
50
50
|
"styled-components": "5.3.3",
|
|
51
51
|
"yargs": "17.0.1"
|