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) # [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` - 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` - 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 (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`. For more details run `redoc-cli --help`.

View File

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

View File

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