diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..bfeb0d2c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +* @Redocly/keyboard-warriors +/docs/ @Redocly/technical-writers \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cd5b34de..8beb2e59 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -98,3 +98,37 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + dockerhub: + needs: [publish] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: redocly/redoc + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./config/docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f0575e1..d43ea681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,58 @@ +# [2.0.0-rc.68](https://github.com/Redocly/redoc/compare/v2.0.0-rc.67...v2.0.0-rc.68) (2022-05-10) + + +### Bug Fixes + +* examples in json schema object([5b9aa27](https://github.com/Redocly/redoc/commit/5b9aa27af03a1c4616f7e0195afeba47d1deeaa0)) +* handle error when definition load fails ([#1979](https://github.com/Redocly/redoc/issues/1979)) ([508ebd5](https://github.com/Redocly/redoc/commit/508ebd58a3d66f2337e9641852322458a1bd9e6b)) +* large text in examples value ([#1974](https://github.com/Redocly/redoc/issues/1974)) ([60bc603](https://github.com/Redocly/redoc/commit/60bc603e9bb85a0c9c7ac38f7014876d397f0191)) +* not show scopes if keys empty or not exist ([#1975](https://github.com/Redocly/redoc/issues/1975)) ([4e793f0](https://github.com/Redocly/redoc/commit/4e793f07a81fa8bcd4ad384d1f87b3e6c290edb7)) +* remove dropdown-aria and use native select ([#1954](https://github.com/Redocly/redoc/issues/1954)) ([186f5a9](https://github.com/Redocly/redoc/commit/186f5a98bd466b1820121aadb865291bef8c6755)) +* make Redoc lib compatible with Webpack 5 ([#1982](https://github.com/Redocly/redoc/issues/1982)) ([867861](https://github.com/Redocly/redoc/commit/8678615a0e19c9484b4cd495d70293b542d196a5)) + +### Features + +* implement configurable minimum characer length to init search ([#1402](https://github.com/Redocly/redoc/issues/1402)) ([0fa08fa](https://github.com/Redocly/redoc/commit/0fa08faab1c176a4bfc5a553e8e8f8b07aca659f)) +* support OAS 3.1 unevaluatedProperties ([#1978](https://github.com/Redocly/redoc/issues/1978)) ([0755ac6](https://github.com/Redocly/redoc/commit/0755ac6f04514eb0c08f90afceeda7858206b435)) +* publish dockerhub ([#1971](https://github.com/Redocly/redoc/issues/1971)) ([7e01a0](https://github.com/Redocly/redoc/commit/7e01a0cfe2ad8d06075bfc66ef3860edbef033f8)) + + +# [2.0.0-rc.67](https://github.com/Redocly/redoc/compare/v2.0.0-rc.66...v2.0.0-rc.67) (2022-04-28) + + +### Bug Fixes + +* Expand/Collapse all buttons disappears for flat structures ([#1424](https://github.com/Redocly/redoc/issues/1424)) ([2ca8e08](https://github.com/Redocly/redoc/commit/2ca8e081baea6996eb01b5df27b8cd88331d5c96)) +* improve markdown render with CRLF ([#1953](https://github.com/Redocly/redoc/issues/1953)) ([aba2d1a](https://github.com/Redocly/redoc/commit/aba2d1ad2d8dda9f52055c36ebde1323457dfd3e)) +* issue with navigation when operationId contains backslash or quotes ([#1513](https://github.com/Redocly/redoc/issues/1513)) ([8f7e56c](https://github.com/Redocly/redoc/commit/8f7e56c747d88be5c5eb5c4bbaee0ff69e9cb2ec)) +* prefix operation ids with parent id ([#1245](https://github.com/Redocly/redoc/issues/1245)) ([fd8917e](https://github.com/Redocly/redoc/commit/fd8917e5c109840c1bfa4c2c0902b6dcec200286)) + + +### Features + +* add optional BASE_PATH to Docker config ([#1378](https://github.com/Redocly/redoc/issues/1378)) ([90f71c0](https://github.com/Redocly/redoc/commit/90f71c0d77719871910cfba883a32ad131bef059)) +* theme add sidebar activeBackgroundColor and activeTextColor ([#1600](https://github.com/Redocly/redoc/issues/1600)) ([6716b08](https://github.com/Redocly/redoc/commit/6716b08e8871d95880e9f5a6c5491038002754e8)) + + + +# [2.0.0-rc.66](https://github.com/Redocly/redoc/compare/v2.0.0-rc.65...v2.0.0-rc.66) (2022-03-30) + + +### Bug Fixes + +* add handle local files for serve command ([#1810](https://github.com/Redocly/redoc/issues/1810)) ([117071e](https://github.com/Redocly/redoc/commit/117071ee83a32d9b3350d8afe2bdb6365a44e2ec)) +* move comma out of code block in SecurityRequirement.tsx ([#1924](https://github.com/Redocly/redoc/issues/1924)) ([ab3e8a8](https://github.com/Redocly/redoc/commit/ab3e8a8f80f453066c5495e73ac932a8fef0830a)) +* rename bandle command and add deprecate notice ([#1935](https://github.com/Redocly/redoc/issues/1935)) ([eb096b6](https://github.com/Redocly/redoc/commit/eb096b69be52568fc581027161c7d0c4b26c56c1)) + + +### Features + +* add support for displaying operationId in the sidebar ([#1927](https://github.com/Redocly/redoc/issues/1927)) ([09786f2](https://github.com/Redocly/redoc/commit/09786f2a5ade6303ea00512483b172347721ca70)) +* add nonce support ([#1566](https://github.com/Redocly/redoc/issues/1566)) ([c75ac9c](https://github.com/Redocly/redoc/commit/c75ac9cf70012e2d539b379aab2f0974d088db07)) +* h2 set color form theme.colors.text.primary ([#1491](https://github.com/Redocly/redoc/pull/1491)) ([25be93](https://github.com/Redocly/redoc/commit/25be934bb184d7b2b6b47d004b3c83ce4d16a2c6)) + + + # [2.0.0-rc.65](https://github.com/Redocly/redoc/compare/v2.0.0-rc.64...v2.0.0-rc.65) (2022-03-15) @@ -6,7 +61,8 @@ * auth link scroll for Firerox ([#1922](https://github.com/Redocly/redoc/issues/1922)) ([fe67e9c](https://github.com/Redocly/redoc/commit/fe67e9c332fee716582a00d60fdf34767bff22d4)) * improve customization fab ([#1891](https://github.com/Redocly/redoc/issues/1891)) ([635f379](https://github.com/Redocly/redoc/commit/635f379eb086268c91eef715148eca8f080cfb86)) * sanitize array of items ([#1920](https://github.com/Redocly/redoc/issues/1920)) ([059bd80](https://github.com/Redocly/redoc/commit/059bd8000e5fd65753d5ca9e0c47940394e0c79b)) -* use x-displayName in securityDefinitions [#1444](https://github.com/Redocly/redoc/pull/1444)) ([ac6fb4](https://github.com/Redocly/redoc/commit/ +* use x-displayName in securityDefinitions ([#1444](https://github.com/Redocly/redoc/pull/1444)) ([ac6fb4](https://github.com/Redocly/redoc/commit/ac6fb458a4eee8d0da4b63f9bafc7669adc8af03)) +* deprecated badge on one of any of buttons ([#1930](https://github.com/Redocly/redoc/pull/1930)) ([f60b47](https://github.com/Redocly/redoc/commit/f60b4758330dd756d670309827da60d3465b672a)) diff --git a/README.md b/README.md index 292a23aa..625931ee 100644 --- a/README.md +++ b/README.md @@ -131,11 +131,11 @@ Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(d ## Lint OpenAPI definitions -Redocly's OpenAPI CLI is an open source command-line tool that you can use to lint +Redocly's CLI is an [open source command-line tool](https://github.com/Redocly/redocly-cli) that you can use to lint your OpenAPI definition. Linting helps you to catch errors and inconsistencies in your OpenAPI definition before publishing. -Refer to [Lint configuration](https://redoc.ly/docs/cli/guides/lint/) in the OpenAPI documentation for more information. +Refer to [Redocly configuration](https://redocly.com/docs/cli/configuration/) in the OpenAPI documentation for more information. ## Deployment @@ -174,14 +174,11 @@ replace the `spec-url` attribute with the url or local file address to your defi For step-by-step instructions for how to get started using Redoc to render your OpenAPI definition, refer to the -[**Redoc quickstart guide**](https://redoc.ly/docs/redoc/quickstart/intro/). - -See [**IE11 Support Notes**](docs/usage-with-ie11.md) for information on -IE support for Redoc. +[**Redoc quickstart guide**](https://redocly.com/docs/redoc/quickstart/) and [**How to use the HTML element**](https://redocly.com/docs/redoc/deployment/html/). ## Redoc CLI For more information on Redoc's commmand-line interface, refer to -[**Using the Redoc CLI**](https://redoc.ly/docs/redoc/quickstart/cli/). +[**Using the Redoc CLI**](https://redocly.com/docs/redoc/deployment/cli/). ## Configuration @@ -191,7 +188,7 @@ You can inject the Security Definitions widget into any place in your definition For more information, refer to [Security definitions injection](docs/security-definitions-injection.md). ### OpenAPI specification extensions -Redoc uses the following [specification extensions](https://swagger.io/specification/#specificationExtensions): +Redoc uses the following [specification extensions](https://redocly.com/docs/api-reference-docs/spec-extensions/): * [`x-logo`](docs/redoc-vendor-extensions.md#x-logo) - is used to specify API logo * [`x-traitTag`](docs/redoc-vendor-extensions.md#x-traitTag) - useful for handling out common things like Pagination, Rate-Limits, etc * [`x-codeSamples`](docs/redoc-vendor-extensions.md#x-codeSamples) - specify operation code samples @@ -210,6 +207,7 @@ Redoc uses the following [specification extensions](https://swagger.io/specifica You can use all of the following options with the standalone version of the tag by kebab-casing them. For example, `scrollYOffset` becomes `scroll-y-offset`, and `expandResponses` becomes `expand-responses`. * `disableSearch` - disable search indexing and search box. +* `minCharacterLengthToInitSearch` - set minimal characters length to init search, default `3`, minimal `1`. * `expandDefaultServerVariables` - enable expanding default server variables, default `false`. * `expandResponses` - specify which responses to expand by default by response codes. Values should be passed as comma-separated list without spaces e.g. `expandResponses="200,201"`. Special value `"all"` expands all responses by default. Be careful: this option can slow-down documentation rendering time. * `generatedPayloadSamplesMaxDepth` - set the maximum render depth for JSON payload samples (responses and request body). The default value is `10`. @@ -246,9 +244,11 @@ You can use all of the following options with the standalone version of the ` theme object * `spacing` @@ -286,21 +286,25 @@ You can use all of the following options with the standalone version of the - `$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange` + `$ redoc-cli build [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` + `$ redoc-cli build [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"` + `$ redoc-cli build [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"` For more details, run `redoc-cli --help`. diff --git a/cli/index.ts b/cli/index.ts index 10e82b2c..9f6d764d 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -6,7 +6,7 @@ import { ServerStyleSheet } from 'styled-components'; import { compile } from 'handlebars'; import { createServer, IncomingMessage, ServerResponse } from 'http'; -import { dirname, join, resolve } from 'path'; +import { dirname, join, resolve, extname as getExtName } from 'path'; import * as zlib from 'zlib'; @@ -39,9 +39,78 @@ interface Options { redocOptions?: any; } +export const mimeTypes = { + '.html': 'text/html', + '.js': 'text/javascript', + '.css': 'text/css', + '.json': 'application/json', + '.png': 'image/png', + '.jpg': 'image/jpg', + '.gif': 'image/gif', + '.svg': 'image/svg+xml', + '.wav': 'audio/wav', + '.mp4': 'video/mp4', + '.woff': 'application/font-woff', + '.ttf': 'application/font-ttf', + '.eot': 'application/vnd.ms-fontobject', + '.otf': 'application/font-otf', + '.wasm': 'application/wasm', +}; + const BUNDLES_DIR = dirname(require.resolve('redoc')); -/* tslint:disable-next-line */ +const builderForBuildCommand = yargs => { + yargs.positional('spec', { + describe: 'path or URL to your spec', + }); + + yargs.option('o', { + describe: 'Output file', + alias: 'output', + type: 'string', + default: 'redoc-static.html', + }); + + yargs.options('title', { + describe: 'Page Title', + type: 'string', + }); + + yargs.options('disableGoogleFont', { + describe: 'Disable Google Font', + type: 'boolean', + default: false, + }); + + yargs.option('cdn', { + describe: 'Do not include ReDoc source code into html page, use link to CDN instead', + type: 'boolean', + default: false, + }); + + yargs.demandOption('spec'); + return yargs; +}; + +const handlerForBuildCommand = async (argv: any) => { + const config = { + ssr: true, + output: argv.o as string, + cdn: argv.cdn as boolean, + title: argv.title as string, + disableGoogleFont: argv.disableGoogleFont as boolean, + templateFileName: argv.template as string, + templateOptions: argv.templateOptions || {}, + redocOptions: getObjectOrJSON(argv.options), + }; + + try { + await bundle(argv.spec, config); + } catch (e) { + handleError(e); + } +}; + YargsParser.command( 'serve ', 'start the server', @@ -104,60 +173,32 @@ YargsParser.command( handleError(e); } }, + [ + res => { + console.log( + `\n⚠️ This command is deprecated. Use "npx @redocly/openapi-cli preview-docs petstore.yaml"\n`, + ); + return res; + }, + ], ) + .command( + 'build ', + 'build definition into zero-dependency HTML-file', + builderForBuildCommand, + handlerForBuildCommand, + ) .command( 'bundle ', - 'bundle spec into zero-dependency HTML-file', - yargs => { - yargs.positional('spec', { - describe: 'path or URL to your spec', - }); - - yargs.option('o', { - describe: 'Output file', - alias: 'output', - type: 'string', - default: 'redoc-static.html', - }); - - yargs.options('title', { - describe: 'Page Title', - type: 'string', - }); - - yargs.options('disableGoogleFont', { - describe: 'Disable Google Font', - type: 'boolean', - default: false, - }); - - yargs.option('cdn', { - describe: 'Do not include ReDoc source code into html page, use link to CDN instead', - type: 'boolean', - default: false, - }); - - yargs.demandOption('spec'); - return yargs; - }, - async (argv: any) => { - const config = { - ssr: true, - output: argv.o as string, - cdn: argv.cdn as boolean, - title: argv.title as string, - disableGoogleFont: argv.disableGoogleFont as boolean, - templateFileName: argv.template as string, - templateOptions: argv.templateOptions || {}, - redocOptions: getObjectOrJSON(argv.options), - }; - - try { - await bundle(argv.spec, config); - } catch (e) { - handleError(e); - } - }, + 'bundle spec into zero-dependency HTML-file [deprecated]', + builderForBuildCommand, + handlerForBuildCommand, + [ + res => { + console.log(`\n⚠️ This command is deprecated. Use "build" command instead.\n`); + return res; + }, + ], ) .demandCommand() .options('t', { @@ -197,9 +238,19 @@ async function serve(host: string, port: number, pathToSpec: string, options: Op 'Content-Type': 'application/json', }); } else { - response.writeHead(404); - response.write('Not found'); - response.end(); + try { + const filePath = join(dirname(pathToSpec), request.url || ''); + const extname = String(getExtName(filePath)).toLowerCase() as keyof typeof mimeTypes; + + const contentType = mimeTypes[extname] || 'application/octet-stream'; + respondWithGzip(createReadStream(filePath), request, response, { + 'Content-Type': contentType, + }); + } catch (e) { + response.writeHead(404); + response.write('Not found'); + response.end(); + } } console.timeEnd('GET ' + request.url); diff --git a/cli/npm-shrinkwrap.json b/cli/npm-shrinkwrap.json index 8aa5319e..9d6258bc 100644 --- a/cli/npm-shrinkwrap.json +++ b/cli/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "redoc-cli", - "version": "0.13.8", + "version": "0.13.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redoc-cli", - "version": "0.13.8", + "version": "0.13.11", "license": "MIT", "dependencies": { "chokidar": "^3.5.1", @@ -17,9 +17,9 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.64", + "redoc": "2.0.0-rc.67", "styled-components": "^5.3.0", - "yargs": "^17.0.1" + "yargs": "^17.3.1" }, "bin": { "redoc-cli": "index.js" @@ -216,9 +216,9 @@ } }, "node_modules/@redocly/openapi-core": { - "version": "1.0.0-beta.80", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.80.tgz", - "integrity": "sha512-IAQECLt/fDxjlfNdLGnJszt40BaiA6b78+zB6+7Rk8ums0HHLfwWFJPMTzh1bzJ5f+sZ4zDBi4gaIJ1n4XGCHg==", + "version": "1.0.0-beta.91", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.91.tgz", + "integrity": "sha512-8RhZGn5jSoy3oZE0sAdXxhPPHrqKgy2JVJzLqjgX9LDjNf7cXOTYOXkXIkjv1tfZHFBV/H7c08rRLEdxnzn0dg==", "dependencies": { "@redocly/ajv": "^8.6.4", "@types/node": "^14.11.8", @@ -236,9 +236,9 @@ } }, "node_modules/@redocly/openapi-core/node_modules/@types/node": { - "version": "14.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.9.tgz", - "integrity": "sha512-j11XSuRuAlft6vLDEX4RvhqC0KxNxx6QIyMXNb0vHHSNPXTPeiy3algESWmOOIzEtiEL0qiowPU3ewW9hHVa7Q==" + "version": "14.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", + "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" }, "node_modules/@redocly/react-dropdown-aria": { "version": "2.0.12", @@ -1273,9 +1273,7 @@ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "hasInstallScript": true, "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } @@ -1698,9 +1696,9 @@ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1709,9 +1707,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/mkdirp": { "version": "1.0.4", @@ -2219,11 +2217,11 @@ } }, "node_modules/redoc": { - "version": "2.0.0-rc.64", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.64.tgz", - "integrity": "sha512-zrM/vcONpbmyDUOpk7Ai7R/yZrT7W1+8ANJUB3b5kzaLQUx4VbrDoT4D6HHHquOnKx+5We4nOPPAi8fi/cqa8g==", + "version": "2.0.0-rc.67", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.67.tgz", + "integrity": "sha512-u6rEKB0LylSisN+mFa3flj7zf+prXDB+G02foqC9BOlcXkUYXHFDZM4L3BTBL/DstyGTgjhe2dA9csAjIVti/g==", "dependencies": { - "@redocly/openapi-core": "^1.0.0-beta.54", + "@redocly/openapi-core": "^1.0.0-beta.88", "@redocly/react-dropdown-aria": "^2.0.11", "classnames": "^2.3.1", "decko": "^1.2.0", @@ -2238,7 +2236,7 @@ "path-browserify": "^1.0.1", "perfect-scrollbar": "^1.5.1", "polished": "^4.1.3", - "prismjs": "^1.24.1", + "prismjs": "^1.27.0", "prop-types": "^15.7.2", "react-tabs": "^3.2.2", "slugify": "~1.4.7", @@ -2493,24 +2491,24 @@ } }, "node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" @@ -2953,28 +2951,28 @@ "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==" }, "node_modules/yargs": { - "version": "17.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz", - "integrity": "sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==", + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz", + "integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==", "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.0.0" }, "engines": { "node": ">=12" } }, "node_modules/yargs-parser": { - "version": "20.2.7", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==", "engines": { - "node": ">=10" + "node": ">=12" } } }, @@ -3148,9 +3146,9 @@ } }, "@redocly/openapi-core": { - "version": "1.0.0-beta.80", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.80.tgz", - "integrity": "sha512-IAQECLt/fDxjlfNdLGnJszt40BaiA6b78+zB6+7Rk8ums0HHLfwWFJPMTzh1bzJ5f+sZ4zDBi4gaIJ1n4XGCHg==", + "version": "1.0.0-beta.91", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.91.tgz", + "integrity": "sha512-8RhZGn5jSoy3oZE0sAdXxhPPHrqKgy2JVJzLqjgX9LDjNf7cXOTYOXkXIkjv1tfZHFBV/H7c08rRLEdxnzn0dg==", "requires": { "@redocly/ajv": "^8.6.4", "@types/node": "^14.11.8", @@ -3165,9 +3163,9 @@ }, "dependencies": { "@types/node": { - "version": "14.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.9.tgz", - "integrity": "sha512-j11XSuRuAlft6vLDEX4RvhqC0KxNxx6QIyMXNb0vHHSNPXTPeiy3algESWmOOIzEtiEL0qiowPU3ewW9hHVa7Q==" + "version": "14.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz", + "integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==" } } }, @@ -4415,17 +4413,17 @@ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mkdirp": { "version": "1.0.4", @@ -4824,11 +4822,11 @@ } }, "redoc": { - "version": "2.0.0-rc.64", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.64.tgz", - "integrity": "sha512-zrM/vcONpbmyDUOpk7Ai7R/yZrT7W1+8ANJUB3b5kzaLQUx4VbrDoT4D6HHHquOnKx+5We4nOPPAi8fi/cqa8g==", + "version": "2.0.0-rc.67", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.67.tgz", + "integrity": "sha512-u6rEKB0LylSisN+mFa3flj7zf+prXDB+G02foqC9BOlcXkUYXHFDZM4L3BTBL/DstyGTgjhe2dA9csAjIVti/g==", "requires": { - "@redocly/openapi-core": "^1.0.0-beta.54", + "@redocly/openapi-core": "^1.0.0-beta.88", "@redocly/react-dropdown-aria": "^2.0.11", "classnames": "^2.3.1", "decko": "^1.2.0", @@ -4843,7 +4841,7 @@ "path-browserify": "^1.0.1", "perfect-scrollbar": "^1.5.1", "polished": "^4.1.3", - "prismjs": "^1.24.1", + "prismjs": "^1.27.0", "prop-types": "^15.7.2", "react-tabs": "^3.2.2", "slugify": "~1.4.7", @@ -5050,21 +5048,21 @@ } }, "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "style-loader": { @@ -5378,23 +5376,23 @@ "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==" }, "yargs": { - "version": "17.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz", - "integrity": "sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==", + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz", + "integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==", "requires": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.0.0" } }, "yargs-parser": { - "version": "20.2.7", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==" + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==" } } } diff --git a/cli/package.json b/cli/package.json index e33bb0af..bfd76e32 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "redoc-cli", - "version": "0.13.8", + "version": "0.13.11", "description": "ReDoc's Command Line Interface", "main": "index.js", "bin": "index.js", @@ -19,9 +19,9 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.64", + "redoc": "2.0.0-rc.67", "styled-components": "^5.3.0", - "yargs": "^17.0.1" + "yargs": "^17.3.1" }, "publishConfig": { "access": "public" diff --git a/config/docker/Dockerfile b/config/docker/Dockerfile index 94e1762d..55e5d0a9 100644 --- a/config/docker/Dockerfile +++ b/config/docker/Dockerfile @@ -26,6 +26,7 @@ FROM nginx:alpine ENV PAGE_TITLE="ReDoc" ENV PAGE_FAVICON="favicon.png" +ENV BASE_PATH= ENV SPEC_URL="http://petstore.swagger.io/v2/swagger.json" ENV PORT=80 ENV REDOC_OPTIONS= diff --git a/config/docker/README.md b/config/docker/README.md index b25f41bd..8e042f4a 100644 --- a/config/docker/README.md +++ b/config/docker/README.md @@ -45,9 +45,10 @@ Another issue with OpenShift is that the default exposed port `80` cannot be use - `PAGE_TITLE` (default `"ReDoc"`) - page title - `PAGE_FAVICON` (default `"favicon.png"`) - URL to page favicon +- `BASE_PATH` (optional) - prepend favicon & standalone bundle with this path - `SPEC_URL` (default `"http://petstore.swagger.io/v2/swagger.json"`) - URL to spec - `PORT` (default `80`) - nginx port -- `REDOC_OPTIONS` - [`` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes) +- `REDOC_OPTIONS` (optional) - [`` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes) ## Build diff --git a/config/docker/docker-run.sh b/config/docker/docker-run.sh index 2706b243..f9c69e0c 100644 --- a/config/docker/docker-run.sh +++ b/config/docker/docker-run.sh @@ -4,6 +4,7 @@ set -e sed -i -e "s|%PAGE_TITLE%|$PAGE_TITLE|g" /usr/share/nginx/html/index.html sed -i -e "s|%PAGE_FAVICON%|$PAGE_FAVICON|g" /usr/share/nginx/html/index.html +sed -i -e "s|%BASE_PATH%|$BASE_PATH|g" /usr/share/nginx/html/index.html sed -i -e "s|%SPEC_URL%|$SPEC_URL|g" /usr/share/nginx/html/index.html sed -i -e "s|%REDOC_OPTIONS%|${REDOC_OPTIONS}|g" /usr/share/nginx/html/index.html sed -i -e "s|\(listen\s*\) [0-9]*|\1 ${PORT}|g" /etc/nginx/nginx.conf diff --git a/config/docker/index.tpl.html b/config/docker/index.tpl.html index 15171edc..83258786 100644 --- a/config/docker/index.tpl.html +++ b/config/docker/index.tpl.html @@ -4,7 +4,7 @@ %PAGE_TITLE% - +