@redocly/cli 0.0.0-snapshot.1737554067
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 +114 -0
- package/bin/cli.js +3 -0
- package/lib/__mocks__/@redocly/openapi-core.d.ts +99 -0
- package/lib/__mocks__/@redocly/openapi-core.js +84 -0
- package/lib/__mocks__/documents.d.ts +150 -0
- package/lib/__mocks__/documents.js +123 -0
- package/lib/__mocks__/fs.d.ts +8 -0
- package/lib/__mocks__/fs.js +9 -0
- package/lib/__mocks__/perf_hooks.d.ts +3 -0
- package/lib/__mocks__/perf_hooks.js +6 -0
- package/lib/__mocks__/redoc.d.ts +6 -0
- package/lib/__mocks__/redoc.js +5 -0
- package/lib/__tests__/commands/build-docs.test.d.ts +1 -0
- package/lib/__tests__/commands/build-docs.test.js +54 -0
- package/lib/__tests__/commands/bundle.test.d.ts +1 -0
- package/lib/__tests__/commands/bundle.test.js +235 -0
- package/lib/__tests__/commands/join.test.d.ts +1 -0
- package/lib/__tests__/commands/join.test.js +274 -0
- package/lib/__tests__/commands/lint.test.d.ts +1 -0
- package/lib/__tests__/commands/lint.test.js +149 -0
- package/lib/__tests__/commands/push-region.test.d.ts +1 -0
- package/lib/__tests__/commands/push-region.test.js +55 -0
- package/lib/__tests__/commands/push.test.d.ts +1 -0
- package/lib/__tests__/commands/push.test.js +463 -0
- package/lib/__tests__/fetch-with-timeout.test.d.ts +1 -0
- package/lib/__tests__/fetch-with-timeout.test.js +44 -0
- package/lib/__tests__/fixtures/config.d.ts +21 -0
- package/lib/__tests__/fixtures/config.js +24 -0
- package/lib/__tests__/spinner.test.d.ts +1 -0
- package/lib/__tests__/spinner.test.js +43 -0
- package/lib/__tests__/utils.test.d.ts +1 -0
- package/lib/__tests__/utils.test.js +593 -0
- package/lib/__tests__/wrapper.test.d.ts +1 -0
- package/lib/__tests__/wrapper.test.js +68 -0
- package/lib/cms/api/__tests__/api-keys.test.d.ts +1 -0
- package/lib/cms/api/__tests__/api-keys.test.js +26 -0
- package/lib/cms/api/__tests__/api.client.test.d.ts +1 -0
- package/lib/cms/api/__tests__/api.client.test.js +333 -0
- package/lib/cms/api/__tests__/domains.test.d.ts +1 -0
- package/lib/cms/api/__tests__/domains.test.js +13 -0
- package/lib/cms/api/api-client.d.ts +75 -0
- package/lib/cms/api/api-client.js +225 -0
- package/lib/cms/api/api-keys.d.ts +1 -0
- package/lib/cms/api/api-keys.js +23 -0
- package/lib/cms/api/domains.d.ts +1 -0
- package/lib/cms/api/domains.js +11 -0
- package/lib/cms/api/index.d.ts +3 -0
- package/lib/cms/api/index.js +19 -0
- package/lib/cms/api/types.d.ts +102 -0
- package/lib/cms/api/types.js +2 -0
- package/lib/cms/commands/__tests__/push-status.test.d.ts +1 -0
- package/lib/cms/commands/__tests__/push-status.test.js +563 -0
- package/lib/cms/commands/__tests__/push.test.d.ts +1 -0
- package/lib/cms/commands/__tests__/push.test.js +315 -0
- package/lib/cms/commands/__tests__/utils.test.d.ts +1 -0
- package/lib/cms/commands/__tests__/utils.test.js +51 -0
- package/lib/cms/commands/push-status.d.ts +23 -0
- package/lib/cms/commands/push-status.js +206 -0
- package/lib/cms/commands/push.d.ts +28 -0
- package/lib/cms/commands/push.js +142 -0
- package/lib/cms/commands/utils.d.ts +25 -0
- package/lib/cms/commands/utils.js +46 -0
- package/lib/cms/utils.d.ts +2 -0
- package/lib/cms/utils.js +6 -0
- package/lib/commands/build-docs/index.d.ts +3 -0
- package/lib/commands/build-docs/index.js +39 -0
- package/lib/commands/build-docs/template.hbs +23 -0
- package/lib/commands/build-docs/types.d.ts +23 -0
- package/lib/commands/build-docs/types.js +2 -0
- package/lib/commands/build-docs/utils.d.ts +7 -0
- package/lib/commands/build-docs/utils.js +87 -0
- package/lib/commands/bundle.d.ts +14 -0
- package/lib/commands/bundle.js +91 -0
- package/lib/commands/eject.d.ts +9 -0
- package/lib/commands/eject.js +28 -0
- package/lib/commands/join.d.ts +11 -0
- package/lib/commands/join.js +565 -0
- package/lib/commands/lint.d.ts +13 -0
- package/lib/commands/lint.js +108 -0
- package/lib/commands/login.d.ts +9 -0
- package/lib/commands/login.js +23 -0
- package/lib/commands/preview-docs/index.d.ts +12 -0
- package/lib/commands/preview-docs/index.js +127 -0
- package/lib/commands/preview-docs/preview-server/default.hbs +24 -0
- package/lib/commands/preview-docs/preview-server/hot.js +59 -0
- package/lib/commands/preview-docs/preview-server/oauth2-redirect.html +21 -0
- package/lib/commands/preview-docs/preview-server/preview-server.d.ts +5 -0
- package/lib/commands/preview-docs/preview-server/preview-server.js +113 -0
- package/lib/commands/preview-docs/preview-server/server.d.ts +22 -0
- package/lib/commands/preview-docs/preview-server/server.js +85 -0
- package/lib/commands/preview-project/constants.d.ts +14 -0
- package/lib/commands/preview-project/constants.js +22 -0
- package/lib/commands/preview-project/index.d.ts +3 -0
- package/lib/commands/preview-project/index.js +56 -0
- package/lib/commands/preview-project/types.d.ts +10 -0
- package/lib/commands/preview-project/types.js +2 -0
- package/lib/commands/push.d.ts +44 -0
- package/lib/commands/push.js +295 -0
- package/lib/commands/split/__tests__/index.test.d.ts +1 -0
- package/lib/commands/split/__tests__/index.test.js +91 -0
- package/lib/commands/split/index.d.ts +13 -0
- package/lib/commands/split/index.js +259 -0
- package/lib/commands/split/types.d.ts +36 -0
- package/lib/commands/split/types.js +51 -0
- package/lib/commands/stats.d.ts +8 -0
- package/lib/commands/stats.js +96 -0
- package/lib/commands/translations.d.ts +7 -0
- package/lib/commands/translations.js +20 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +733 -0
- package/lib/types.d.ts +43 -0
- package/lib/types.js +5 -0
- package/lib/utils/__mocks__/miscellaneous.d.ts +43 -0
- package/lib/utils/__mocks__/miscellaneous.js +24 -0
- package/lib/utils/assert-node-version.d.ts +1 -0
- package/lib/utils/assert-node-version.js +16 -0
- package/lib/utils/fetch-with-timeout.d.ts +7 -0
- package/lib/utils/fetch-with-timeout.js +26 -0
- package/lib/utils/getCommandNameFromArgs.d.ts +2 -0
- package/lib/utils/getCommandNameFromArgs.js +6 -0
- package/lib/utils/js-utils.d.ts +5 -0
- package/lib/utils/js-utils.js +28 -0
- package/lib/utils/miscellaneous.d.ts +81 -0
- package/lib/utils/miscellaneous.js +551 -0
- package/lib/utils/platform.d.ts +16 -0
- package/lib/utils/platform.js +34 -0
- package/lib/utils/spinner.d.ts +10 -0
- package/lib/utils/spinner.js +42 -0
- package/lib/utils/update-version-notifier.d.ts +3 -0
- package/lib/utils/update-version-notifier.js +102 -0
- package/lib/wrapper.d.ts +11 -0
- package/lib/wrapper.js +65 -0
- package/package.json +69 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getApiKeys = getApiKeys;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const utils_1 = require("@redocly/openapi-core/lib/utils");
|
|
8
|
+
const redocly_1 = require("@redocly/openapi-core/lib/redocly");
|
|
9
|
+
function readCredentialsFile(credentialsPath) {
|
|
10
|
+
return (0, fs_1.existsSync)(credentialsPath) ? JSON.parse((0, fs_1.readFileSync)(credentialsPath, 'utf-8')) : {};
|
|
11
|
+
}
|
|
12
|
+
function getApiKeys(domain) {
|
|
13
|
+
const apiKey = process.env.REDOCLY_AUTHORIZATION;
|
|
14
|
+
if (apiKey) {
|
|
15
|
+
return apiKey;
|
|
16
|
+
}
|
|
17
|
+
const credentialsPath = (0, path_1.resolve)((0, os_1.homedir)(), redocly_1.TOKEN_FILENAME);
|
|
18
|
+
const credentials = readCredentialsFile(credentialsPath);
|
|
19
|
+
if ((0, utils_1.isNotEmptyObject)(credentials) && credentials[domain]) {
|
|
20
|
+
return credentials[domain];
|
|
21
|
+
}
|
|
22
|
+
throw new Error('No api key provided, please use environment variable REDOCLY_AUTHORIZATION.');
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDomain(): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDomain = getDomain;
|
|
4
|
+
const DEFAULT_DOMAIN = 'https://app.cloud.redocly.com';
|
|
5
|
+
function getDomain() {
|
|
6
|
+
const domain = process.env.REDOCLY_DOMAIN;
|
|
7
|
+
if (domain) {
|
|
8
|
+
return domain;
|
|
9
|
+
}
|
|
10
|
+
return DEFAULT_DOMAIN;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api-client"), exports);
|
|
18
|
+
__exportStar(require("./domains"), exports);
|
|
19
|
+
__exportStar(require("./api-keys"), exports);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export type ProjectSourceResponse = {
|
|
2
|
+
branchName: string;
|
|
3
|
+
contentPath: string;
|
|
4
|
+
isInternal: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type UpsertRemoteResponse = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: 'CICD';
|
|
9
|
+
mountPath: string;
|
|
10
|
+
mountBranchName: string;
|
|
11
|
+
organizationId: string;
|
|
12
|
+
projectId: string;
|
|
13
|
+
};
|
|
14
|
+
export type ListRemotesResponse = {
|
|
15
|
+
object: 'list';
|
|
16
|
+
page: {
|
|
17
|
+
endCursor: string;
|
|
18
|
+
startCursor: string;
|
|
19
|
+
haxNextPage: boolean;
|
|
20
|
+
hasPrevPage: boolean;
|
|
21
|
+
limit: number;
|
|
22
|
+
total: number;
|
|
23
|
+
};
|
|
24
|
+
items: Remote[];
|
|
25
|
+
};
|
|
26
|
+
export type Remote = {
|
|
27
|
+
mountPath: string;
|
|
28
|
+
type: string;
|
|
29
|
+
autoSync: boolean;
|
|
30
|
+
autoMerge: boolean;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
providerType: string;
|
|
34
|
+
namespaceId: string;
|
|
35
|
+
repositoryId: string;
|
|
36
|
+
projectId: string;
|
|
37
|
+
mountBranchName: string;
|
|
38
|
+
contentPath: string;
|
|
39
|
+
credentialId: string;
|
|
40
|
+
branchName: string;
|
|
41
|
+
contentType: string;
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
export type PushResponse = {
|
|
45
|
+
id: string;
|
|
46
|
+
remoteId: string;
|
|
47
|
+
isMainBranch: boolean;
|
|
48
|
+
isOutdated: boolean;
|
|
49
|
+
hasChanges: boolean;
|
|
50
|
+
replace: boolean;
|
|
51
|
+
scoutJobId: string | null;
|
|
52
|
+
uploadedFiles: Array<{
|
|
53
|
+
path: string;
|
|
54
|
+
mimeType: string;
|
|
55
|
+
}>;
|
|
56
|
+
commit: {
|
|
57
|
+
branchName: string;
|
|
58
|
+
message: string;
|
|
59
|
+
createdAt: string | null;
|
|
60
|
+
namespaceId: string | null;
|
|
61
|
+
repositoryId: string | null;
|
|
62
|
+
url: string | null;
|
|
63
|
+
sha: string | null;
|
|
64
|
+
author: {
|
|
65
|
+
name: string;
|
|
66
|
+
email: string;
|
|
67
|
+
image: string | null;
|
|
68
|
+
};
|
|
69
|
+
statuses: Array<{
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
status: 'pending' | 'running' | 'success' | 'failed';
|
|
73
|
+
url: string | null;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
remote: {
|
|
77
|
+
commits: {
|
|
78
|
+
sha: string;
|
|
79
|
+
branchName: string;
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
status: PushStatusResponse;
|
|
83
|
+
};
|
|
84
|
+
export type DeploymentStatusResponse = {
|
|
85
|
+
deploy: {
|
|
86
|
+
url: string | null;
|
|
87
|
+
status: DeploymentStatus;
|
|
88
|
+
};
|
|
89
|
+
scorecard: ScorecardItem[];
|
|
90
|
+
};
|
|
91
|
+
export type PushStatusResponse = {
|
|
92
|
+
preview: DeploymentStatusResponse;
|
|
93
|
+
production: DeploymentStatusResponse;
|
|
94
|
+
};
|
|
95
|
+
export type ScorecardItem = {
|
|
96
|
+
name: string;
|
|
97
|
+
status: PushStatusBase;
|
|
98
|
+
description: string;
|
|
99
|
+
url: string;
|
|
100
|
+
};
|
|
101
|
+
export type PushStatusBase = 'pending' | 'success' | 'running' | 'failed';
|
|
102
|
+
export type DeploymentStatus = 'skipped' | PushStatusBase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|