Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Bandwidth/redoc into sync-r…
Browse files Browse the repository at this point in the history
…ebase
  • Loading branch information
ckoegel committed Dec 3, 2024
2 parents 13681f1 + 8da2ccc commit be19bdf
Show file tree
Hide file tree
Showing 12 changed files with 301 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Redoc Contributing Guide

Hi! We're really excited that you are interested in contributing to Redoc. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
Hi! We're really excited that you are interested in contributing to ReDoc. This is the wrong place to do that if you don't work at Bandwidth :). Please contribute to [Redocly/redoc](https://github.com/Redocly/redoc) instead. If you are from Bandwidth, before submitting your contribution, please make sure to take a moment and read through the following guidelines.

- [Redoc Contributing Guide](#redoc-contributing-guide)
- [Issue Reporting Guidelines](#issue-reporting-guidelines)
Expand Down
156 changes: 94 additions & 62 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Publish Package to NPM on Release

on:
push:
branches: [main]
release:
types:
- published

jobs:
bundle:
Expand All @@ -23,8 +24,13 @@ jobs:
restore-keys: |
npm-${{ hashFiles('package-lock.json') }}
npm-
- run: npm ci
- run: npm run bundle
- name: Clean Install
run: npm ci

- name: Bundle
run: npm run bundle

- name: Store bundle artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -36,43 +42,38 @@ jobs:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm test
- name: Checkout
uses: actions/checkout@v4

- name: Clean Install
run: npm ci

- name: Unit Test
run: npm test

e2e-tests:
name: E2E Tests
needs: [bundle]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- name: Checkout
uses: actions/checkout@v4

- name: Clean Install
run: npm ci

- name: Download bundled artifact
uses: actions/download-artifact@v4
with:
name: bundles
path: bundles
- run: npm run e2e
check-version:
name: Check Version
runs-on: ubuntu-latest
needs: [bundle, unit-tests, e2e-tests]
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
- name: Check if version has been updated
id: check
uses: EndBug/[email protected]
with:
file-url: https://cdn.jsdelivr.net/npm/redoc/package.json
static-checking: localIsNew

- name: E2E Test
run: npm run e2e

publish:
name: Publish to NPM
needs: [check-version]
if: needs.check-version.outputs.changed == 'true'
name: Publish
needs: [unit-tests, e2e-tests]
runs-on: ubuntu-latest
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
steps:
Expand Down Expand Up @@ -105,41 +106,72 @@ jobs:
- name: Before deploy
run: npm ci && npm run declarations

publish-cdn:
name: Publish to CDN
needs: [check-version]
if: needs.check-version.outputs.changed == 'true'
- name: Publish npm Package
run: |
npm version $RELEASE_VERSION --no-git-tag-version
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

publish-beta:
name: Publish Beta to NPM
needs: [unit-tests, e2e-tests]
runs-on: ubuntu-latest
if: ${{ github.event.release.prerelease }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1
- name: Check Branch Name Format
run: |
re=v[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+
if ! [[ ${{ github.event.release.target_commitish }} =~ $re ]]; then
echo "Target branch does not match expected regex pattern for beta releases ($re)."
echo "${{ github.event.release.target_commitish }}"
echo "Please update your branch name to match the expected regex pattern."
exit 1
fi
- name: Set Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV

- name: Check Release Version Format
run: |
re=[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+
if ! [[ $RELEASE_VERSION =~ $re ]]; then
echo "Tag does not match expected regex pattern for beta releases (v$re)."
echo $RELEASE_VERSION
echo "Please update your tag to match the expected regex pattern."
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download all artifact
uses: actions/download-artifact@v3
- name: Publish to S3
run: npm run publish-cdn

invalidate-cache:
name: Clear cache
runs-on: ubuntu-latest
needs: [check-version, publish, publish-cdn]
if: needs.check-version.outputs.changed == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Checkout
uses: actions/checkout@v4

- name: Download bundled artifacts
uses: actions/download-artifact@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Invalidate cache
run: ./scripts/invalidate-cache.sh
shell: bash
name: bundles
path: bundles

- name: Cache node modules
uses: actions/cache@v4
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-${{ hashFiles('package-lock.json') }}
npm-
- name: Before deploy
run: npm ci && npm run declarations

- name: Publish npm Package
run: |
npm version $RELEASE_VERSION --no-git-tag-version
npm publish --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<img alt="Bandwidth Logo" src="https://raw.githubusercontent.com/Bandwidth/redoc/main//docs/images/bw-icon.svg" width="150px" />
<img alt="Redoc logo" src="https://raw.githubusercontent.com/Redocly/redoc/main//docs/images/redoc.png" width="400px" />

# Generate beautiful API documentation from OpenAPI
## Generate beautiful API documentation from OpenAPI

[![npm](http://img.shields.io/npm/v/redoc.svg)](https://www.npmjs.com/package/redoc) [![License](https://img.shields.io/npm/l/redoc.svg)](https://github.com/Redocly/redoc/blob/main/LICENSE)

Expand Down
2 changes: 1 addition & 1 deletion docs/deployment/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ npm install -g http-server
Then, `cd` into your project directory and run the following command:

```node
http-server
http - server;
```

The output after entering the command provides the local URL where the preview can be accessed.
Expand Down
37 changes: 0 additions & 37 deletions e2e/integration/menu.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,6 @@ describe('Menu', () => {
cy.get('.menu-content').find('li').should('have.length', 35);
});

it('should sync active menu items while scroll', () => {
cy.contains('h2', 'Introduction')
.scrollIntoView()
.get('[role=menuitem] > label.active')
.should('have.text', 'Introduction');

cy.contains('h2', 'Add a new pet to the store')
.scrollIntoView()
.wait(100)
.get('[role=menuitem] > label.active')
.children()
.last()
.should('have.text', 'Add a new pet to the store')
.should('be.visible');
});

it('should sync active menu items while scroll back and scroll again', () => {
cy.contains('h2', 'Add a new pet to the store')
.scrollIntoView()
.wait(100)
.get('[role=menuitem] > label.active')
.children()
.last()
.should('have.text', 'Add a new pet to the store')
.should('be.visible');

cy.contains('h1', 'Swagger Petstore').scrollIntoView().wait(100);

cy.contains('h2', 'Introduction')
.scrollIntoView()
.wait(100)
.get('[role=menuitem] > label.active')
.should('have.text', 'Introduction');

cy.url().should('include', '#section/Introduction');
});

it('should update URL hash when clicking on menu items', () => {
cy.contains('[role=menuitem] > label.-depth1', 'pet').click({ force: true });
cy.get('li[data-item-id="schema/Cat"]')
Expand Down
22 changes: 12 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "redoc",
"version": "2.2.0",
"description": "ReDoc",
"name": "bandwidth-redoc",
"version": "0.1.0",
"description": "Bandwidth ReDoc Fork",
"repository": {
"type": "git",
"url": "git://github.com/Bandwidth/redoc"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Endpoint/Endpoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
return (
<OptionsContext.Consumer>
{options => (
<OperationEndpointWrap>
<OperationEndpointWrap className="endpoint">
<EndpointInfo onClick={this.toggle} $expanded={expanded} $inverted={inverted}>
<HttpVerb type={operation.httpVerb} $compact={this.props.compact}>
{operation.httpVerb}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SecurityRequirement/SecurityRequirement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function SecurityRequirements(props: SecurityRequirementsProps) {

return (
<>
<Wrap $expanded={expanded}>
<Wrap $expanded={expanded} className="operation-security">
<AuthHeaderColumn onClick={() => setExpanded(!expanded)}>
<AuthHeader>Authorizations:</AuthHeader>
<ShelfIcon size={'1.3em'} direction={expanded ? 'down' : 'right'} />
Expand Down
Loading

0 comments on commit be19bdf

Please sign in to comment.