Skip to content

Commit

Permalink
Merge commit 'd7a0a4da17241dd9c089202dba76a8312248616e'
Browse files Browse the repository at this point in the history
  • Loading branch information
aleung committed Apr 23, 2021
2 parents db84939 + d7a0a4d commit 2505d81
Show file tree
Hide file tree
Showing 17 changed files with 7,409 additions and 6,481 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '10'
- '12'
cache:
directories:
- "~/.cache"
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# [2.0.0-rc.51](https://github.com/Redocly/redoc/compare/v2.0.0-rc.50...v2.0.0-rc.51) (2021-04-08)

### Bug Fixes

* use openapi-core to bundle definition instead of json-schema-ref-parser ([5033946](https://github.com/Redocly/redoc/commit/503394655da2aac544e278796098cba93d9194b9)),
closes: [#1506](https://github.com/Redocly/redoc/issues/1506), [#1478](https://github.com/Redocly/redoc/issues/1478)
* add disable-google-font parameter to serve command in cli ([c7bbef5](https://github.com/Redocly/redoc/commit/c7bbef515524095e957729eac35a5b7a97619b55)), closes [#1501](https://github.com/Redocly/redoc/issues/1501)



# [2.0.0-rc.50](https://github.com/Redocly/redoc/compare/v2.0.0-rc.49...v2.0.0-rc.50) (2021-02-15)


Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Also you can pass options:

```js
<RedocStandalone
specUrl="http://rebilly.github.io/RebillyAPI/openapi.json"
specUrl="https://api.redoc.ly/registry/rebilly/core-api/core/bundle/master/openapi.yaml"
options={{
nativeScrollbars: true,
theme: { colors: { primary: { main: '#dd5522' } } },
Expand All @@ -176,7 +176,7 @@ You can also specify `onLoaded` callback which will be called each time Redoc ha

```js
<RedocStandalone
specUrl="http://rebilly.github.io/RebillyAPI/openapi.json"
specUrl="https://api.redoc.ly/registry/rebilly/core-api/core/bundle/master/openapi.yaml"
onLoaded={error => {
if (!error) {
console.log('Yay!');
Expand Down Expand Up @@ -325,7 +325,7 @@ Redoc.init(specOrSpecUrl, options, element, callback?)
- `specOrSpecUrl` is either JSON object with specification or an URL to the spec in `JSON` or `YAML` format
- `options` [options object](#redoc-options-object)
- `element` DOM element to put ReDoc into
- `callback` (optional) - callback to be called after Redoc has been fully rendered. It is also called also on errors with error as the first argument
- `callback` (optional) - callback to be called after Redoc has been fully rendered. It is also called on errors with error as the first argument
```js
Redoc.init('http://petstore.swagger.io/v2/swagger.json', {
Expand Down
14 changes: 10 additions & 4 deletions cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ YargsParser.command(
type: 'boolean',
});

yargs.options('disable-google-font', {
describe: 'Disable Google Font',
type: 'boolean',
default: false,
});

yargs.demandOption('spec');
return yargs;
},
Expand All @@ -80,6 +86,7 @@ YargsParser.command(
ssr: argv.ssr as boolean,
title: argv.title as string,
watch: argv.watch as boolean,
disableGoogleFont: argv.disableGoogleFont as boolean,
templateFileName: argv.template as string,
templateOptions: argv.templateOptions || {},
redocOptions: getObjectOrJSON(argv.options),
Expand Down Expand Up @@ -163,9 +170,8 @@ YargsParser.command(
}).argv;

async function serve(port: number, pathToSpec: string, options: Options = {}) {
let spec = await loadAndBundleSpec(pathToSpec);
let spec = await loadAndBundleSpec(isURL(pathToSpec) ? pathToSpec : resolve(pathToSpec));
let pageHTML = await getPageHTML(spec, pathToSpec, options);

const server = createServer((request, response) => {
console.time('GET ' + request.url);
if (request.url === '/redoc.standalone.js') {
Expand Down Expand Up @@ -211,7 +217,7 @@ async function serve(port: number, pathToSpec: string, options: Options = {}) {

const handlePath = async _path => {
try {
spec = await loadAndBundleSpec(pathToSpec);
spec = await loadAndBundleSpec(resolve(pathToSpec));
pageHTML = await getPageHTML(spec, pathToSpec, options);
log('Updated successfully');
} catch (e) {
Expand All @@ -238,7 +244,7 @@ async function serve(port: number, pathToSpec: string, options: Options = {}) {

async function bundle(pathToSpec, options: Options = {}) {
const start = Date.now();
const spec = await loadAndBundleSpec(pathToSpec);
const spec = await loadAndBundleSpec(isURL(pathToSpec) ? pathToSpec : resolve(pathToSpec));
const pageHTML = await getPageHTML(spec, pathToSpec, { ...options, ssr: true });

mkdirp.sync(dirname(options.output!));
Expand Down
Loading

0 comments on commit 2505d81

Please sign in to comment.