diff --git a/cli/README.md b/cli/README.md index 32bb0e0e..bc6d8bcf 100644 --- a/cli/README.md +++ b/cli/README.md @@ -3,20 +3,29 @@ **[ReDoc](https://github.com/Redocly/redoc)'s Command Line Interface** ## Installation -You can use redoc cli by installing `redoc-cli` globally or using [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b). + +You can use `redoc-cli` by installing [the package](https://www.npmjs.com/package/redoc-cli) globally, +or using [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b). ## Usage -Two following commands are available: +The two following commands are available: -- `redoc-cli serve [spec]` - starts the server with `spec` rendered with ReDoc. Supports SSR mode (`--ssr`) and can watch the spec (`--watch`) -- `redoc-cli bundle [spec]` - bundles spec and ReDoc into **zero-dependency** HTML file. +- `redoc-cli serve [spec]` - starts the server with `spec` rendered with ReDoc. + Supports a server-side rendering mode (`--ssr`), + and can watch the spec (`--watch`) to automatically reload the page whenever it changes. +- `redoc-cli bundle [spec]` - bundles `spec` and ReDoc into a **zero-dependency** HTML file. Some examples: -- Bundle with main color changed to `orange`: `$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange` -- Serve with `nativeScrollbars` option set to true: `$ redoc-cli serve [spec] --options.nativeScrollbars` -- Bundle using custom template (check [default template](https://github.com/Redocly/redoc/blob/master/cli/template.hbs) for reference): `$ redoc-cli bundle [spec] -t custom.hbs` -- Bundle using custom template and add custom `templateOptions`: `$ redoc-cli bundle [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"` +- Bundle with the main color changed to `orange`: + `$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange` +- Serve with the `nativeScrollbars` option set to true: + `$ redoc-cli serve [spec] --options.nativeScrollbars` +- Bundle using a custom [Handlebars](https://handlebarsjs.com/) template + (check the [default template](https://github.com/Redocly/redoc/blob/master/cli/template.hbs) for an example): + `$ redoc-cli bundle [spec] -t custom.hbs` +- Bundle using a custom template and add custom `templateOptions`: + `$ 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`. diff --git a/cli/package.json b/cli/package.json index cb55452e..862d795e 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "redoc-cli", - "version": "0.12.1", + "version": "0.12.2", "description": "ReDoc's Command Line Interface", "main": "index.js", "bin": "index.js", @@ -19,7 +19,7 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.54", + "redoc": "2.0.0-rc.55", "styled-components": "^5.3.0", "yargs": "^17.0.1" }, diff --git a/package-lock.json b/package-lock.json index 5601ef16..79a0831f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "path-browserify": "^1.0.1", "perfect-scrollbar": "^1.5.1", "polished": "^4.1.3", - "prismjs": "^1.24.0", + "prismjs": "^1.24.1", "prop-types": "^15.7.2", "react-tabs": "^3.2.2", "slugify": "~1.4.7", @@ -15962,9 +15962,9 @@ } }, "node_modules/prismjs": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.0.tgz", - "integrity": "sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ==" + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz", + "integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow==" }, "node_modules/process": { "version": "0.11.10", @@ -33230,9 +33230,9 @@ } }, "prismjs": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.0.tgz", - "integrity": "sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ==" + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz", + "integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow==" }, "process": { "version": "0.11.10", diff --git a/package.json b/package.json index 6f85f321..ead71f3e 100644 --- a/package.json +++ b/package.json @@ -163,7 +163,7 @@ "path-browserify": "^1.0.1", "perfect-scrollbar": "^1.5.1", "polished": "^4.1.3", - "prismjs": "^1.24.0", + "prismjs": "^1.24.1", "prop-types": "^15.7.2", "react-tabs": "^3.2.2", "slugify": "~1.4.7", diff --git a/src/components/ApiInfo/ApiInfo.tsx b/src/components/ApiInfo/ApiInfo.tsx index ae4b4b20..6debaf7e 100644 --- a/src/components/ApiInfo/ApiInfo.tsx +++ b/src/components/ApiInfo/ApiInfo.tsx @@ -14,6 +14,7 @@ import { InfoSpanBox, InfoSpanBoxWrap, } from './styled.elements'; +import { l } from '../../services/Labels'; export interface ApiInfoProps { store: AppStore; @@ -79,14 +80,14 @@ export class ApiInfo extends React.Component { {!hideDownloadButton && ( - Download OpenAPI specification: + {l('downloadSpecification')}: - Download + {l('download')} )} diff --git a/src/components/RequestSamples/RequestSamples.tsx b/src/components/RequestSamples/RequestSamples.tsx index 89b12d74..7a06d89f 100644 --- a/src/components/RequestSamples/RequestSamples.tsx +++ b/src/components/RequestSamples/RequestSamples.tsx @@ -6,6 +6,7 @@ import { SourceCodeWithCopy } from '../SourceCode/SourceCode'; import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements'; import { OptionsContext } from '../OptionsProvider'; +import { l } from '../../services/Labels'; export interface RequestSamplesProps { operation: OperationModel; @@ -26,7 +27,7 @@ export class RequestSamples extends React.Component { return ( (hasSamples && ( - Request samples + {l('requestSamples')} diff --git a/src/components/ResponseSamples/ResponseSamples.tsx b/src/components/ResponseSamples/ResponseSamples.tsx index 3f9eefa0..72384fe5 100644 --- a/src/components/ResponseSamples/ResponseSamples.tsx +++ b/src/components/ResponseSamples/ResponseSamples.tsx @@ -5,6 +5,7 @@ import { OperationModel } from '../../services/models'; import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements'; import { PayloadSamples } from '../PayloadSamples/PayloadSamples'; +import { l } from '../../services/Labels'; export interface ResponseSamplesProps { operation: OperationModel; @@ -23,7 +24,7 @@ export class ResponseSamples extends React.Component { return ( (responses.length > 0 && ( - Response samples + {l('responseSamples')} diff --git a/src/components/Responses/ResponsesList.tsx b/src/components/Responses/ResponsesList.tsx index 157aca58..e578a1cf 100644 --- a/src/components/Responses/ResponsesList.tsx +++ b/src/components/Responses/ResponsesList.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { l } from '../../services/Labels'; import { ResponseModel } from '../../services/models'; import styled from '../../styled-components'; import { ResponseView } from './Response'; @@ -26,7 +27,7 @@ export class ResponsesList extends React.PureComponent { return ( - {isCallback ? 'Callback responses' : 'Responses'} + {isCallback ? l('callbackResponses') : l('responses')} {responses.map(response => { return ; })} diff --git a/src/services/Labels.ts b/src/services/Labels.ts index 8e89bc2f..71b83e58 100644 --- a/src/services/Labels.ts +++ b/src/services/Labels.ts @@ -10,6 +10,12 @@ export interface LabelsConfig { arrayOf: string; webhook: string; const: string; + download: string; + downloadSpecification: string; + responses: string; + callbackResponses: string; + requestSamples: string; + responseSamples: string; } export type LabelsConfigRaw = Partial; @@ -26,6 +32,12 @@ const labels: LabelsConfig = { arrayOf: 'Array of ', webhook: 'Event', const: 'Value', + download: 'Download', + downloadSpecification: 'Download OpenAPI specification', + responses: 'Responses', + callbackResponses: 'Callback responses', + requestSamples: 'Request samples', + responseSamples: 'Response samples', }; export function setRedocLabels(_labels?: LabelsConfigRaw) { diff --git a/src/utils/highlight.ts b/src/utils/highlight.ts index d86ee374..036b9129 100644 --- a/src/utils/highlight.ts +++ b/src/utils/highlight.ts @@ -19,6 +19,7 @@ import 'prismjs/components/prism-ruby.js'; import 'prismjs/components/prism-scala.js'; import 'prismjs/components/prism-sql.js'; import 'prismjs/components/prism-swift.js'; +import 'prismjs/components/prism-yaml.js'; const DEFAULT_LANG = 'clike';
- Download OpenAPI specification: + {l('downloadSpecification')}: - Download + {l('download')}