bump-cli 2.8.4 → 2.9.1
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 +12 -12
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +6 -0
- package/bin/run.js +5 -0
- package/{lib → dist}/api/error.d.ts +6 -9
- package/dist/api/error.js +97 -0
- package/{lib → dist}/api/index.d.ts +13 -13
- package/dist/api/index.js +46 -0
- package/dist/api/models.js +1 -0
- package/{lib → dist}/api/vars.js +10 -14
- package/dist/args.d.ts +4 -0
- package/{lib → dist}/args.js +11 -15
- package/dist/base-command.d.ts +7 -0
- package/dist/base-command.js +18 -0
- package/dist/commands/deploy.d.ts +24 -0
- package/dist/commands/deploy.js +158 -0
- package/dist/commands/diff.d.ts +21 -0
- package/dist/commands/diff.js +110 -0
- package/dist/commands/overlay.d.ts +13 -0
- package/dist/commands/overlay.js +53 -0
- package/dist/commands/preview.d.ts +15 -0
- package/dist/commands/preview.js +83 -0
- package/{lib/core/definition_directory.d.ts → dist/core/definition-directory.d.ts} +10 -8
- package/dist/core/definition-directory.js +149 -0
- package/{lib → dist}/core/deploy.d.ts +7 -10
- package/{lib → dist}/core/deploy.js +39 -47
- package/{lib → dist}/core/diff.d.ts +12 -15
- package/{lib → dist}/core/diff.js +88 -98
- package/{lib → dist}/core/overlay.d.ts +2 -2
- package/{lib → dist}/core/overlay.js +36 -41
- package/{lib → dist}/core/utils/file.d.ts +4 -4
- package/dist/core/utils/file.js +36 -0
- package/dist/core/utils/prompts.d.ts +1 -0
- package/dist/core/utils/prompts.js +13 -0
- package/{lib → dist}/definition.d.ts +31 -30
- package/dist/definition.js +240 -0
- package/dist/flags.d.ts +48 -0
- package/dist/flags.js +120 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +15 -0
- package/oclif.manifest.json +283 -1
- package/package.json +65 -57
- package/bin/run +0 -5
- package/lib/api/error.js +0 -96
- package/lib/api/index.js +0 -64
- package/lib/api/models.js +0 -2
- package/lib/args.d.ts +0 -15
- package/lib/cli/index.d.ts +0 -31
- package/lib/cli/index.js +0 -14
- package/lib/cli/styled/success.d.ts +0 -1
- package/lib/cli/styled/success.js +0 -11
- package/lib/command.d.ts +0 -9
- package/lib/command.js +0 -31
- package/lib/commands/deploy.d.ts +0 -27
- package/lib/commands/deploy.js +0 -164
- package/lib/commands/diff.d.ts +0 -24
- package/lib/commands/diff.js +0 -119
- package/lib/commands/overlay.d.ts +0 -16
- package/lib/commands/overlay.js +0 -56
- package/lib/commands/preview.d.ts +0 -19
- package/lib/commands/preview.js +0 -83
- package/lib/core/definition_directory.js +0 -138
- package/lib/core/utils/file.js +0 -41
- package/lib/core/utils/prompts.d.ts +0 -1
- package/lib/core/utils/prompts.js +0 -21
- package/lib/definition.js +0 -218
- package/lib/flags.d.ts +0 -20
- package/lib/flags.js +0 -116
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -14
- package/{lib → dist}/api/models.d.ts +20 -20
- package/{lib → dist}/api/vars.d.ts +3 -3
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { default as $RefParser, getJsonSchemaRefParserDefaultOptions } from '@apidevtools/json-schema-ref-parser';
|
|
2
|
+
import asyncapi from '@asyncapi/specs';
|
|
3
|
+
import { CLIError } from '@oclif/core/errors';
|
|
4
|
+
import { safeStringify } from '@stoplight/yaml';
|
|
5
|
+
import debug from 'debug';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { default as nodePath } from 'node:path';
|
|
8
|
+
// Used to require JSON files
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
import { Overlay } from './core/overlay.js';
|
|
11
|
+
class SupportedFormat {
|
|
12
|
+
static asyncapi = {
|
|
13
|
+
'2.0': asyncapi.schemas['2.0.0'],
|
|
14
|
+
'2.1': asyncapi.schemas['2.1.0'],
|
|
15
|
+
'2.2': asyncapi.schemas['2.2.0'],
|
|
16
|
+
'2.3': asyncapi.schemas['2.3.0'],
|
|
17
|
+
'2.4': asyncapi.schemas['2.4.0'],
|
|
18
|
+
'2.5': asyncapi.schemas['2.5.0'],
|
|
19
|
+
'2.6': asyncapi.schemas['2.6.0'],
|
|
20
|
+
};
|
|
21
|
+
static openapi = {
|
|
22
|
+
'2.0': require('oas-schemas/schemas/v2.0/schema.json'),
|
|
23
|
+
'3.0': require('oas-schemas/schemas/v3.0/schema.json'),
|
|
24
|
+
'3.1': require('oas-schemas/schemas/v3.1/schema.json'),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
class UnsupportedFormat extends CLIError {
|
|
28
|
+
constructor(message = '') {
|
|
29
|
+
const compatOpenAPI = Object.keys(SupportedFormat.openapi).join(', ');
|
|
30
|
+
const compatAsyncAPI = Object.keys(SupportedFormat.asyncapi).join(', ');
|
|
31
|
+
const errorMsgs = [
|
|
32
|
+
`Unsupported API specification (${message})`,
|
|
33
|
+
`Please try again with an OpenAPI ${compatOpenAPI} or AsyncAPI ${compatAsyncAPI} file.`,
|
|
34
|
+
];
|
|
35
|
+
super(errorMsgs.join('\n'));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class API {
|
|
39
|
+
definition;
|
|
40
|
+
location;
|
|
41
|
+
overlayedDefinition;
|
|
42
|
+
rawDefinition;
|
|
43
|
+
references;
|
|
44
|
+
spec;
|
|
45
|
+
specName;
|
|
46
|
+
version;
|
|
47
|
+
constructor(location, values) {
|
|
48
|
+
this.location = location;
|
|
49
|
+
this.references = [];
|
|
50
|
+
const [raw, parsed] = this.resolveContent(values);
|
|
51
|
+
this.rawDefinition = raw;
|
|
52
|
+
this.definition = parsed;
|
|
53
|
+
this.specName = this.getSpecName(parsed);
|
|
54
|
+
this.version = this.getVersion(parsed);
|
|
55
|
+
this.spec = this.getSpec(parsed);
|
|
56
|
+
if (this.spec === undefined) {
|
|
57
|
+
throw new UnsupportedFormat(`${this.specName} ${this.version}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
static isAsyncAPI(definition) {
|
|
61
|
+
return 'asyncapi' in definition;
|
|
62
|
+
}
|
|
63
|
+
static isOpenAPI(definition) {
|
|
64
|
+
return typeof definition.openapi === 'string' || typeof definition.swagger === 'string';
|
|
65
|
+
}
|
|
66
|
+
static isOpenAPIOverlay(definition) {
|
|
67
|
+
return 'overlay' in definition;
|
|
68
|
+
}
|
|
69
|
+
static async load(path) {
|
|
70
|
+
const { json, text, yaml } = getJsonSchemaRefParserDefaultOptions().parse;
|
|
71
|
+
// Not sure why the lib types the parser as potentially
|
|
72
|
+
// “undefined”, hence the forced typing in the following consts.
|
|
73
|
+
const TextParser = text;
|
|
74
|
+
const JSONParser = json;
|
|
75
|
+
const YAMLParser = yaml;
|
|
76
|
+
// We override the default parsers from $RefParser to be able
|
|
77
|
+
// to keep the raw content of the files parsed
|
|
78
|
+
const withRawTextParser = (parser) => ({
|
|
79
|
+
...parser,
|
|
80
|
+
async parse(file) {
|
|
81
|
+
if (typeof parser.parse === 'function' && typeof TextParser.parse === 'function') {
|
|
82
|
+
const parsed = (await parser.parse(file));
|
|
83
|
+
return { parsed, raw: TextParser.parse(file) };
|
|
84
|
+
}
|
|
85
|
+
// Not sure why the lib states that Plugin.parse can be a
|
|
86
|
+
// scalar number | string (on not only a callable function)
|
|
87
|
+
return {};
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
return $RefParser
|
|
91
|
+
.resolve(path, {
|
|
92
|
+
dereference: { circular: false },
|
|
93
|
+
parse: {
|
|
94
|
+
json: withRawTextParser(JSONParser),
|
|
95
|
+
text: {
|
|
96
|
+
...TextParser,
|
|
97
|
+
canParse: ['.md', '.markdown'],
|
|
98
|
+
encoding: 'utf8',
|
|
99
|
+
async parse(file) {
|
|
100
|
+
if (typeof TextParser.parse === 'function') {
|
|
101
|
+
const parsed = (await TextParser.parse(file));
|
|
102
|
+
return { parsed, raw: parsed };
|
|
103
|
+
}
|
|
104
|
+
// Not sure why the lib states that Plugin.parse can be a
|
|
105
|
+
// scalar number | string (on not only a callable function)
|
|
106
|
+
return {};
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
yaml: withRawTextParser(YAMLParser),
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
.then(($refs) => {
|
|
113
|
+
const values = $refs.values();
|
|
114
|
+
return new API(path, values);
|
|
115
|
+
})
|
|
116
|
+
.catch((error) => {
|
|
117
|
+
throw new CLIError(error);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async applyOverlay(overlayPath) {
|
|
121
|
+
const overlay = await API.load(overlayPath);
|
|
122
|
+
const overlayDefinition = overlay.definition;
|
|
123
|
+
if (!API.isOpenAPIOverlay(overlayDefinition)) {
|
|
124
|
+
throw new Error(`${overlayPath} does not look like an OpenAPI overlay`);
|
|
125
|
+
}
|
|
126
|
+
this.overlayedDefinition = await new Overlay().run(this.definition, overlayDefinition);
|
|
127
|
+
}
|
|
128
|
+
extractDefinition(outputPath) {
|
|
129
|
+
const references = [];
|
|
130
|
+
for (let i = 0; i < this.references.length; i++) {
|
|
131
|
+
const reference = this.references[i];
|
|
132
|
+
references.push({
|
|
133
|
+
content: reference.content,
|
|
134
|
+
location: reference.location,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return [this.serializeDefinition(outputPath), references];
|
|
138
|
+
}
|
|
139
|
+
getSpec(definition) {
|
|
140
|
+
if (API.isAsyncAPI(definition)) {
|
|
141
|
+
return SupportedFormat.asyncapi[this.versionWithoutPatch()];
|
|
142
|
+
}
|
|
143
|
+
if (API.isOpenAPIOverlay(definition)) {
|
|
144
|
+
return { overlay: { type: 'string' } };
|
|
145
|
+
}
|
|
146
|
+
return SupportedFormat.openapi[this.versionWithoutPatch()];
|
|
147
|
+
}
|
|
148
|
+
getSpecName(definition) {
|
|
149
|
+
if (API.isAsyncAPI(definition)) {
|
|
150
|
+
return 'AsyncAPI';
|
|
151
|
+
}
|
|
152
|
+
return 'OpenAPI';
|
|
153
|
+
}
|
|
154
|
+
getVersion(definition) {
|
|
155
|
+
if (API.isAsyncAPI(definition)) {
|
|
156
|
+
return definition.asyncapi;
|
|
157
|
+
}
|
|
158
|
+
return (definition.openapi || definition.swagger);
|
|
159
|
+
}
|
|
160
|
+
guessFormat(output) {
|
|
161
|
+
return (output || this.location).endsWith('.json') ? 'json' : 'yaml';
|
|
162
|
+
}
|
|
163
|
+
isMainRefPath(path) {
|
|
164
|
+
// $refs from json-schema-ref-parser lib returns posix style
|
|
165
|
+
// paths. We need to make sure we compare all paths in posix style
|
|
166
|
+
// independently of the platform runtime.
|
|
167
|
+
const resolvedAbsLocation = nodePath
|
|
168
|
+
.resolve(this.location)
|
|
169
|
+
.split(nodePath?.win32?.sep)
|
|
170
|
+
.join(nodePath?.posix?.sep ?? '/');
|
|
171
|
+
return path === this.location || path === resolvedAbsLocation;
|
|
172
|
+
}
|
|
173
|
+
resolveContent(values) {
|
|
174
|
+
let mainReference = { parsed: {}, raw: '' };
|
|
175
|
+
for (const [absPath, reference] of Object.entries(values)) {
|
|
176
|
+
if (this.isMainRefPath(absPath)) {
|
|
177
|
+
// $refs.values is not properly typed so we need to force it
|
|
178
|
+
// with the resulting type of our custom defined parser
|
|
179
|
+
mainReference = reference;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// $refs.values is not properly typed so we need to force it
|
|
183
|
+
// with the resulting type of our custom defined parser
|
|
184
|
+
const { raw } = reference;
|
|
185
|
+
if (!raw) {
|
|
186
|
+
throw new UnsupportedFormat(`Reference ${absPath} is empty`);
|
|
187
|
+
}
|
|
188
|
+
this.references.push({
|
|
189
|
+
content: raw,
|
|
190
|
+
location: this.resolveRelativeLocation(absPath),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const { parsed, raw } = mainReference;
|
|
195
|
+
if (!parsed || !raw || !(parsed instanceof Object) || !('info' in parsed)) {
|
|
196
|
+
debug('bump-cli:definition')(`Main location (${this.location}) not found or empty (within ${JSON.stringify(Object.keys(values))})`);
|
|
197
|
+
throw new UnsupportedFormat("Definition needs to be an object with at least an 'info' key");
|
|
198
|
+
}
|
|
199
|
+
if (!API.isOpenAPI(parsed) && !API.isAsyncAPI(parsed) && !API.isOpenAPIOverlay(parsed)) {
|
|
200
|
+
throw new UnsupportedFormat();
|
|
201
|
+
}
|
|
202
|
+
return [raw, parsed];
|
|
203
|
+
}
|
|
204
|
+
/* Resolve reference absolute paths to the main api location when possible */
|
|
205
|
+
resolveRelativeLocation(absPath) {
|
|
206
|
+
const definitionUrl = this.url();
|
|
207
|
+
const refUrl = this.url(absPath);
|
|
208
|
+
if ((refUrl.hostname === '' && // filesystem path
|
|
209
|
+
(/^\//.test(absPath) || // Unix style
|
|
210
|
+
/^[A-Za-z]+:[/\\]/.test(absPath))) || // Windows style
|
|
211
|
+
(/^https?:\/\//.test(absPath) && definitionUrl.hostname === refUrl.hostname) // Same domain URLs
|
|
212
|
+
) {
|
|
213
|
+
const relativeLocation = nodePath.relative(nodePath.dirname(this.location), absPath);
|
|
214
|
+
debug('bump-cli:definition')(`Resolved relative $ref location: ${relativeLocation}`);
|
|
215
|
+
return relativeLocation;
|
|
216
|
+
}
|
|
217
|
+
return absPath;
|
|
218
|
+
}
|
|
219
|
+
serializeDefinition(outputPath) {
|
|
220
|
+
if (this.overlayedDefinition) {
|
|
221
|
+
return this.guessFormat(outputPath) === 'json'
|
|
222
|
+
? JSON.stringify(this.overlayedDefinition)
|
|
223
|
+
: safeStringify(this.overlayedDefinition);
|
|
224
|
+
}
|
|
225
|
+
return this.rawDefinition;
|
|
226
|
+
}
|
|
227
|
+
versionWithoutPatch() {
|
|
228
|
+
const [major, minor] = this.version.split('.', 3);
|
|
229
|
+
return `${major}.${minor}`;
|
|
230
|
+
}
|
|
231
|
+
url(location = this.location) {
|
|
232
|
+
try {
|
|
233
|
+
return new URL(location);
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return { hostname: '' };
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
export { API, SupportedFormat };
|
package/dist/flags.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Interfaces } from '@oclif/core';
|
|
2
|
+
declare const doc: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
3
|
+
multiple: false;
|
|
4
|
+
requiredOrDefaulted: true;
|
|
5
|
+
}>;
|
|
6
|
+
declare const docName: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
7
|
+
multiple: false;
|
|
8
|
+
requiredOrDefaulted: false;
|
|
9
|
+
}>;
|
|
10
|
+
declare const hub: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
11
|
+
multiple: false;
|
|
12
|
+
requiredOrDefaulted: true;
|
|
13
|
+
}>;
|
|
14
|
+
declare const filenamePattern: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
15
|
+
multiple: false;
|
|
16
|
+
requiredOrDefaulted: true;
|
|
17
|
+
}>;
|
|
18
|
+
declare const branch: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
19
|
+
multiple: false;
|
|
20
|
+
requiredOrDefaulted: true;
|
|
21
|
+
}>;
|
|
22
|
+
declare const token: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
23
|
+
multiple: false;
|
|
24
|
+
requiredOrDefaulted: true;
|
|
25
|
+
}>;
|
|
26
|
+
declare const autoCreate: (opts?: Partial<Interfaces.BooleanFlag<boolean>>) => Interfaces.BooleanFlag<boolean>;
|
|
27
|
+
declare const interactive: (opts?: Partial<Interfaces.BooleanFlag<boolean>>) => Interfaces.BooleanFlag<boolean>;
|
|
28
|
+
declare const dryRun: (opts?: Partial<Interfaces.BooleanFlag<boolean>>) => Interfaces.BooleanFlag<boolean>;
|
|
29
|
+
declare const open: (opts?: Partial<Interfaces.BooleanFlag<boolean>>) => Interfaces.BooleanFlag<boolean>;
|
|
30
|
+
declare const failOnBreaking: (opts?: Partial<Interfaces.BooleanFlag<boolean>>) => Interfaces.BooleanFlag<boolean>;
|
|
31
|
+
declare const live: (opts?: Partial<Interfaces.BooleanFlag<boolean>>) => Interfaces.BooleanFlag<boolean>;
|
|
32
|
+
declare const format: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
33
|
+
multiple: false;
|
|
34
|
+
requiredOrDefaulted: true;
|
|
35
|
+
}>;
|
|
36
|
+
declare const expires: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
37
|
+
multiple: false;
|
|
38
|
+
requiredOrDefaulted: false;
|
|
39
|
+
}>;
|
|
40
|
+
declare const out: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
41
|
+
multiple: false;
|
|
42
|
+
requiredOrDefaulted: false;
|
|
43
|
+
}>;
|
|
44
|
+
declare const overlay: Interfaces.FlagDefinition<string, Interfaces.CustomOptions, {
|
|
45
|
+
multiple: false;
|
|
46
|
+
requiredOrDefaulted: false;
|
|
47
|
+
}>;
|
|
48
|
+
export { autoCreate, branch, doc, docName, dryRun, expires, failOnBreaking, filenamePattern, format, hub, interactive, live, open, out, overlay, token, };
|
package/dist/flags.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
// import * as Parser from '@oclif/parser';
|
|
3
|
+
// Re-export oclif flags https://oclif.io/docs/flags
|
|
4
|
+
// export * from '@oclif/command/lib/flags';
|
|
5
|
+
// Custom flags for bump-cli
|
|
6
|
+
const doc = Flags.custom({
|
|
7
|
+
char: 'd',
|
|
8
|
+
async default() {
|
|
9
|
+
const envDoc = process.env.BUMP_ID;
|
|
10
|
+
if (envDoc)
|
|
11
|
+
return envDoc;
|
|
12
|
+
// Search doc id in .bump/config.json file?
|
|
13
|
+
},
|
|
14
|
+
description: 'Documentation public id or slug. Can be provided via BUMP_ID environment variable',
|
|
15
|
+
});
|
|
16
|
+
const docName = Flags.custom({
|
|
17
|
+
char: 'n',
|
|
18
|
+
dependsOn: ['auto-create'],
|
|
19
|
+
description: 'Documentation name. Used with --auto-create flag.',
|
|
20
|
+
});
|
|
21
|
+
const hub = Flags.custom({
|
|
22
|
+
char: 'b',
|
|
23
|
+
async default() {
|
|
24
|
+
const envHub = process.env.BUMP_HUB_ID;
|
|
25
|
+
if (envHub)
|
|
26
|
+
return envHub;
|
|
27
|
+
// Search hub id in .bump/config.json file?
|
|
28
|
+
},
|
|
29
|
+
description: 'Hub id or slug. Can be provided via BUMP_HUB_ID environment variable',
|
|
30
|
+
});
|
|
31
|
+
const filenamePattern = Flags.custom({
|
|
32
|
+
default: '{slug}-api',
|
|
33
|
+
description: `Pattern to extract the documentation slug from filenames when deploying a DIRECTORY. Pattern uses only '*' and '{slug}' as special characters to extract the slug from a filename without extension. Used with --hub flag only.`,
|
|
34
|
+
});
|
|
35
|
+
const branch = Flags.custom({
|
|
36
|
+
char: 'B',
|
|
37
|
+
async default() {
|
|
38
|
+
const envBranch = process.env.BUMP_BRANCH_NAME;
|
|
39
|
+
if (envBranch)
|
|
40
|
+
return envBranch;
|
|
41
|
+
},
|
|
42
|
+
description: 'Branch name. Can be provided via BUMP_BRANCH_NAME environment variable',
|
|
43
|
+
});
|
|
44
|
+
const token = Flags.custom({
|
|
45
|
+
char: 't',
|
|
46
|
+
async default() {
|
|
47
|
+
const envToken = process.env.BUMP_TOKEN;
|
|
48
|
+
if (envToken)
|
|
49
|
+
return envToken;
|
|
50
|
+
},
|
|
51
|
+
description: 'Documentation or Hub token. Can be provided via BUMP_TOKEN environment variable',
|
|
52
|
+
required: true,
|
|
53
|
+
});
|
|
54
|
+
const autoCreate = (opts = {}) => {
|
|
55
|
+
return Flags.boolean({
|
|
56
|
+
...opts,
|
|
57
|
+
dependsOn: ['hub'],
|
|
58
|
+
description: 'Automatically create the documentation if needed (only available with a --hub flag). Documentation name can be provided with --doc-name flag. Default: false',
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const interactive = (opts = {}) => {
|
|
62
|
+
return Flags.boolean({
|
|
63
|
+
...opts,
|
|
64
|
+
dependsOn: ['hub'],
|
|
65
|
+
description: "Interactively create a configuration file to deploy a Hub (only available with a --hub flag). This will start an interactive process if you don't have a CLI configuration file. Default: false",
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const dryRun = (opts = {}) => {
|
|
69
|
+
return Flags.boolean({
|
|
70
|
+
...opts,
|
|
71
|
+
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',
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const open = (opts = {}) => {
|
|
75
|
+
return Flags.boolean({
|
|
76
|
+
...opts,
|
|
77
|
+
char: 'o',
|
|
78
|
+
default: false,
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const failOnBreaking = (opts = {}) => {
|
|
82
|
+
return Flags.boolean({
|
|
83
|
+
...opts,
|
|
84
|
+
char: 'F',
|
|
85
|
+
async default() {
|
|
86
|
+
const envCi = process.env.CI;
|
|
87
|
+
if (envCi) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
},
|
|
92
|
+
description: 'Fail when diff contains a breaking change',
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const live = (opts = {}) => {
|
|
96
|
+
return Flags.boolean({
|
|
97
|
+
...opts,
|
|
98
|
+
char: 'l',
|
|
99
|
+
default: false,
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
const format = Flags.custom({
|
|
103
|
+
char: 'f',
|
|
104
|
+
default: 'text',
|
|
105
|
+
description: 'Format in which to provide the diff result',
|
|
106
|
+
options: ['text', 'markdown', 'json', 'html'],
|
|
107
|
+
});
|
|
108
|
+
const expires = Flags.custom({
|
|
109
|
+
char: 'e',
|
|
110
|
+
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.",
|
|
111
|
+
});
|
|
112
|
+
const out = Flags.custom({
|
|
113
|
+
char: 'o',
|
|
114
|
+
description: 'Output file path',
|
|
115
|
+
});
|
|
116
|
+
const overlay = Flags.custom({
|
|
117
|
+
char: 'o',
|
|
118
|
+
description: 'Path or URL of an overlay file to apply before deploying',
|
|
119
|
+
});
|
|
120
|
+
export { autoCreate, branch, doc, docName, dryRun, expires, failOnBreaking, filenamePattern, format, hub, interactive, live, open, out, overlay, token, };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Deploy from './commands/deploy.js';
|
|
2
|
+
import Diff from './commands/diff.js';
|
|
3
|
+
import Overlay from './commands/overlay.js';
|
|
4
|
+
import Preview from './commands/preview.js';
|
|
5
|
+
export declare const COMMANDS: {
|
|
6
|
+
deploy: typeof Deploy;
|
|
7
|
+
diff: typeof Diff;
|
|
8
|
+
overlay: typeof Overlay;
|
|
9
|
+
preview: typeof Preview;
|
|
10
|
+
};
|
|
11
|
+
export { DiffResponse, PreviewResponse, VersionResponse, WithDiff } from './api/models.js';
|
|
12
|
+
export { default as Deploy } from './commands/deploy.js';
|
|
13
|
+
export { default as Preview } from './commands/preview.js';
|
|
14
|
+
export * as Diff from './core/diff.js';
|
|
15
|
+
export * as Overlay from './core/overlay.js';
|
|
16
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Deploy from './commands/deploy.js';
|
|
2
|
+
import Diff from './commands/diff.js';
|
|
3
|
+
import Overlay from './commands/overlay.js';
|
|
4
|
+
import Preview from './commands/preview.js';
|
|
5
|
+
export const COMMANDS = {
|
|
6
|
+
deploy: Deploy,
|
|
7
|
+
diff: Diff,
|
|
8
|
+
overlay: Overlay,
|
|
9
|
+
preview: Preview,
|
|
10
|
+
};
|
|
11
|
+
export { default as Deploy } from './commands/deploy.js';
|
|
12
|
+
export { default as Preview } from './commands/preview.js';
|
|
13
|
+
export * as Diff from './core/diff.js';
|
|
14
|
+
export * as Overlay from './core/overlay.js';
|
|
15
|
+
export { run } from '@oclif/core';
|