@redocly/cli 1.11.0 → 1.12.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/CHANGELOG.md +11 -0
- package/lib/__tests__/utils.test.js +3 -3
- package/lib/cms/api/types.d.ts +22 -11
- package/lib/cms/commands/__tests__/push-status.test.js +338 -29
- package/lib/cms/commands/__tests__/push.test.js +32 -2
- package/lib/cms/commands/__tests__/utils.test.d.ts +1 -0
- package/lib/cms/commands/__tests__/utils.test.js +60 -0
- package/lib/cms/commands/push-status.d.ts +14 -4
- package/lib/cms/commands/push-status.js +160 -90
- package/lib/cms/commands/push.d.ts +6 -2
- package/lib/cms/commands/push.js +8 -2
- package/lib/cms/commands/utils.d.ts +22 -0
- package/lib/cms/commands/utils.js +53 -0
- package/lib/index.js +12 -1
- package/lib/utils/miscellaneous.js +5 -4
- package/lib/wrapper.d.ts +1 -1
- package/package.json +2 -2
- package/src/__tests__/utils.test.ts +3 -3
- package/src/cms/api/types.ts +19 -12
- package/src/cms/commands/__tests__/push-status.test.ts +473 -47
- package/src/cms/commands/__tests__/push.test.ts +40 -2
- package/src/cms/commands/__tests__/utils.test.ts +62 -0
- package/src/cms/commands/push-status.ts +242 -120
- package/src/cms/commands/push.ts +21 -5
- package/src/cms/commands/utils.ts +52 -0
- package/src/index.ts +13 -2
- package/src/utils/miscellaneous.ts +5 -4
- package/src/wrapper.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/src/index.ts
CHANGED
|
@@ -204,9 +204,10 @@ yargs
|
|
|
204
204
|
project: {
|
|
205
205
|
description: 'Name of the project to push to.',
|
|
206
206
|
type: 'string',
|
|
207
|
+
required: true,
|
|
207
208
|
alias: 'p',
|
|
208
209
|
},
|
|
209
|
-
domain: { description: 'Specify a domain.', alias: 'd', type: 'string' },
|
|
210
|
+
domain: { description: 'Specify a domain.', alias: 'd', type: 'string', required: false },
|
|
210
211
|
wait: {
|
|
211
212
|
description: 'Wait for build to finish.',
|
|
212
213
|
type: 'boolean',
|
|
@@ -216,6 +217,11 @@ yargs
|
|
|
216
217
|
description: 'Maximum execution time in seconds.',
|
|
217
218
|
type: 'number',
|
|
218
219
|
},
|
|
220
|
+
'continue-on-deploy-failures': {
|
|
221
|
+
description: 'Command does not fail even if the deployment fails.',
|
|
222
|
+
type: 'boolean',
|
|
223
|
+
default: false,
|
|
224
|
+
},
|
|
219
225
|
}),
|
|
220
226
|
(argv) => {
|
|
221
227
|
process.env.REDOCLY_CLI_COMMAND = 'push-status';
|
|
@@ -377,10 +383,15 @@ yargs
|
|
|
377
383
|
type: 'boolean',
|
|
378
384
|
default: false,
|
|
379
385
|
},
|
|
386
|
+
'continue-on-deploy-failures': {
|
|
387
|
+
description: 'Command does not fail even if the deployment fails.',
|
|
388
|
+
type: 'boolean',
|
|
389
|
+
default: false,
|
|
390
|
+
},
|
|
380
391
|
}),
|
|
381
392
|
(argv) => {
|
|
382
393
|
process.env.REDOCLY_CLI_COMMAND = 'push';
|
|
383
|
-
commandWrapper(commonPushHandler(argv))(argv as PushArguments);
|
|
394
|
+
commandWrapper(commonPushHandler(argv))(argv as Arguments<PushArguments>);
|
|
384
395
|
}
|
|
385
396
|
)
|
|
386
397
|
.command(
|
|
@@ -7,6 +7,7 @@ import * as fs from 'fs';
|
|
|
7
7
|
import * as readline from 'readline';
|
|
8
8
|
import { Writable } from 'stream';
|
|
9
9
|
import { execSync } from 'child_process';
|
|
10
|
+
import { promisify } from 'util';
|
|
10
11
|
import {
|
|
11
12
|
BundleOutputFormat,
|
|
12
13
|
StyleguideConfig,
|
|
@@ -106,7 +107,7 @@ async function expandGlobsInEntrypoints(args: string[], config: ConfigApis) {
|
|
|
106
107
|
await Promise.all(
|
|
107
108
|
(args as string[]).map(async (aliasOrPath) => {
|
|
108
109
|
return glob.hasMagic(aliasOrPath) && !isAbsoluteUrl(aliasOrPath)
|
|
109
|
-
? (await glob
|
|
110
|
+
? (await promisify(glob)(aliasOrPath)).map((g: string) => getAliasOrPath(config, g))
|
|
110
111
|
: getAliasOrPath(config, aliasOrPath);
|
|
111
112
|
})
|
|
112
113
|
)
|
|
@@ -292,9 +293,9 @@ export function handleError(e: Error, ref: string) {
|
|
|
292
293
|
throw e;
|
|
293
294
|
}
|
|
294
295
|
case ResolveError:
|
|
295
|
-
return exitWithError(`Failed to resolve API description at ${ref}:\n\n - ${e.message}
|
|
296
|
+
return exitWithError(`Failed to resolve API description at ${ref}:\n\n - ${e.message}`);
|
|
296
297
|
case YamlParseError:
|
|
297
|
-
return exitWithError(`Failed to parse API description at ${ref}:\n\n - ${e.message}
|
|
298
|
+
return exitWithError(`Failed to parse API description at ${ref}:\n\n - ${e.message}`);
|
|
298
299
|
case CircularJSONNotSupportedError: {
|
|
299
300
|
return exitWithError(
|
|
300
301
|
`Detected circular reference which can't be converted to JSON.\n` +
|
|
@@ -306,7 +307,7 @@ export function handleError(e: Error, ref: string) {
|
|
|
306
307
|
case ConfigValidationError:
|
|
307
308
|
return exitWithError(e.message);
|
|
308
309
|
default: {
|
|
309
|
-
exitWithError(`Something went wrong when processing ${ref}:\n\n - ${e.message}
|
|
310
|
+
exitWithError(`Something went wrong when processing ${ref}:\n\n - ${e.message}`);
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
313
|
}
|
package/src/wrapper.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { lintConfigCallback } from './commands/lint';
|
|
|
11
11
|
import type { CommandOptions } from './types';
|
|
12
12
|
|
|
13
13
|
export function commandWrapper<T extends CommandOptions>(
|
|
14
|
-
commandHandler?: (argv: T, config: Config, version: string) => Promise<
|
|
14
|
+
commandHandler?: (argv: T, config: Config, version: string) => Promise<unknown>
|
|
15
15
|
) {
|
|
16
16
|
return async (argv: Arguments<T>) => {
|
|
17
17
|
let code: ExitCode = 2;
|