Merge branch 'master' into fix/redoc-cli-typings

This commit is contained in:
Siarhei Bautrukevich 2019-02-04 09:43:58 +03:00 committed by GitHub
commit 28d7cb2a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 7 deletions

View File

@ -1,3 +1,14 @@
# [2.0.0-rc.2](https://github.com/Rebilly/ReDoc/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2019-01-27)
### Bug Fixes
* make padding for md code blocks and code samples consistent ([007752d](https://github.com/Rebilly/ReDoc/commit/007752d))
* make syntax highlighting for md js code blocks same as for payload samples ([d197c0f](https://github.com/Rebilly/ReDoc/commit/d197c0f))
* Only display API version if present ([#773](https://github.com/Rebilly/ReDoc/issues/773)) ([fb3cb36](https://github.com/Rebilly/ReDoc/commit/fb3cb36))
# [2.0.0-rc.1](https://github.com/Rebilly/ReDoc/compare/v2.0.0-rc.0...v2.0.0-rc.1) (2019-01-17)

View File

@ -17,5 +17,6 @@ Some examples:
- Bundle with main color changed to `orange`: <br> `$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange`
- Serve with `nativeScrollbars` option set to true: <br> `$ redoc-cli serve [spec] --options.nativeScrollbars`
- Bundle using custom template (check [default template](https://github.com/Rebilly/ReDoc/blob/master/cli/template.hbs) for reference): <br> `$ redoc-cli bundle [spec] -t custom.hbs`
- Bundle using custom template and add custom `templateOptions`: <br> `$ redoc-cli bundle [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"`
For more details run `redoc-cli --help`.

View File

@ -26,6 +26,7 @@ interface Options {
output?: string;
title?: string;
templateFileName?: string;
templateOptions?: any;
redocOptions?: any;
}
@ -67,6 +68,7 @@ YargsParser.command(
ssr: Boolean(argv.ssr),
watch: Boolean(argv.watch),
templateFileName: String(argv.template),
templateOptions: argv.templateOptions || {},
redocOptions: argv.options || {},
};
@ -114,6 +116,7 @@ YargsParser.command(
cdn: Boolean(argv.cdn),
title: String(argv.title),
templateFileName: String(argv.template),
templateOptions: argv.templateOptions || {},
redocOptions: argv.options || {},
};
@ -130,6 +133,9 @@ YargsParser.command(
describe: 'Path to handlebars page template, see https://git.io/vh8fP for the example ',
type: 'string',
})
.options('templateOptions', {
describe: 'Additional options that you want pass to template. Use dot notation, e.g. templateOptions.metaDescription',
})
.options('options', {
describe: 'ReDoc options, use dot notation, e.g. options.nativeScrollbars',
}).argv;
@ -209,7 +215,7 @@ async function bundle(pathToSpec, options: Options = {}) {
async function getPageHTML(
spec: any,
pathToSpec: string,
{ ssr, cdn, title, templateFileName, redocOptions = {} }: Options,
{ ssr, cdn, title, templateFileName, templateOptions, redocOptions = {} }: Options,
) {
let html;
let css;
@ -252,6 +258,7 @@ async function getPageHTML(
: `<script>${redocStandaloneSrc}</script>`) + css
: '<script src="redoc.standalone.js"></script>',
title,
templateOptions,
});
}

View File

@ -1,6 +1,6 @@
{
"name": "redoc",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"description": "ReDoc",
"repository": {
"type": "git",
@ -125,10 +125,10 @@
"yaml-js": "^0.2.3"
},
"peerDependencies": {
"mobx": "^4.2.0",
"mobx": "^4.2.0 || ^5.0.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"styled-components": "^4.0.1"
"styled-components": "^4.1.1"
},
"dependencies": {
"classnames": "^2.2.6",