Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: swagger-api/swagger-ui
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 77f4651cbf5b3767f0d79c91fd337de82b6ddee6
Choose a base ref
...
head repository: swagger-api/swagger-ui
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d3a1e9433f99be3146c3575de23dd44872be5132
Choose a head ref
Loading
Showing 442 changed files with 70,233 additions and 25,935 deletions.
46 changes: 0 additions & 46 deletions .babelrc

This file was deleted.

25 changes: 25 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"header-max-length": [
2,
"always",
69
],
"scope-case": [
2,
"always",
[
"camel-case",
"kebab-case",
"upper-case"
]
],
"subject-case": [
0,
"always"
]
}
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
parser: babel-eslint
parser: "@babel/eslint-parser"
env:
browser: true
node: true
es6: true
jest: true
jest/globals: true
parserOptions:
ecmaFeatures:
jsx: true
@@ -13,6 +15,7 @@ plugins:
- react
- mocha
- import
- jest
settings:
react:
pragma: React
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature request
about: Suggest an new feature or enhancement for this project
about: Suggest a new feature or enhancement for this project

---

23 changes: 23 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
commit-message:
prefix: "chore"
include: "scope"
open-pull-requests-limit: 3
ignore:
# node-fetch must be synced manually
- dependency-name: "node-fetch"
- dependency-name: "release-it"
- dependency-name: "@release-it/conventional-changelog"

- package-ecosystem: "docker"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"

37 changes: 37 additions & 0 deletions .github/workflows/dependabot-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Merge me!

on:
pull_request_target:
branches: [ master, next ]

jobs:
merge-me:
name: Merge me!
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
# This first step will fail if there's no metadata and so the approval
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Here the PR gets approved.
- name: Approve a PR
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
# Finally, tell dependabot to merge the PR if all checks are successful
- name: Instruct dependabot to squash & merge
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
uses: mshick/add-pr-comment@v2
with:
repo-token: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
allow-repeats: true
message: |
@dependabot squash and merge
env:
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/docker-image-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Security scan for docker image

on:
workflow_dispatch:
schedule:
- cron: '30 4 * * *'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'docker.io/swaggerapi/swagger-ui:unstable'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
83 changes: 83 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master, next ]

env:
CYPRESS_CACHE_FOLDER: cypress/cache

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16

- name: Cache Node Modules and Cypress binary
uses: actions/cache@v3
id: cache-primes
with:
path: |
node_modules
${{ env.CYPRESS_CACHE_FOLDER }}
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-primes.outputs.cache-hit != 'true'
run: npm ci

- name: Lint code for errors only
run: npm run lint-errors

- name: Run all tests
run: npm run just-test-in-node && npm run test:unit-jest
env:
CI: true

- name: Build SwaggerUI
run: npm run build

- name: Test build artifacts
run: npm run test:artifact

e2e-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: ['+(a11y|security|bugs)/**/*.js', 'features/**/+(o|d)*.js', 'features/**/m*.js', 'features/**/!(o|d|m)*.js']

steps:
- uses: actions/checkout@v3

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16

- name: Cache Node Modules and Cypress binary
uses: actions/cache@v3
id: cache-primes
with:
path: |
node_modules
${{ env.CYPRESS_CACHE_FOLDER }}
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-primes.outputs.cache-hit != 'true'
run: npm ci

- name: Cypress Test
run: npx start-server-and-test cy:start http://localhost:3204 'npm run cy:run -- --spec "test/e2e-cypress/tests/${{ matrix.containers }}"'
79 changes: 79 additions & 0 deletions .github/workflows/release-swagger-ui-react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build & Release SwaggerUI-React@next

# single-stage
on:
workflow_dispatch:
branches:
- next

# multi-stage automation
# on:
# workflow_run:
# workflows: ["Release SwaggerUI@next"]
# types:
# - completed
# branches: [next]

defaults:
run:
working-directory: flavors/swagger-ui-react/release
jobs:
release-swagger-ui-react:
name: Release SwaggerUI React
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
ref: next

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Prepare SwaggerUI dist
run: |
cd ../../../
npm ci
npm run build
- name: Install dependencies (to create package manifest)
run: npm ci

- name: MKDIR `dist` working directory
run: mkdir -p ../dist

- name: Copy SwaggerUI dist files to MKDIR
run: |
ls ../dist
cp ../../../dist/swagger-ui-es-bundle-core.js ../dist
cp ../../../dist/swagger-ui-es-bundle-core.js.map ../dist
cp ../../../dist/swagger-ui.css ../dist
cp ../../../dist/swagger-ui.css.map ../dist
- name: Create a releasable package manifest
run: node create-manifest.js > ../dist/package.json

- name: Transpile our top-level React Component
run: |
../../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/commonjs.js
../../../node_modules/.bin/cross-env BABEL_ENV=es ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/index.js
- name: Copy our README into the dist folder for npm
run: cp ../README.md ../dist

- name: Copy LICENSE & NOTICE into the dist folder for npm
run: |
cp ../../../LICENSE ../dist
cp ../../../NOTICE ../dist
- name: Run the release from the dist folder
run: |
cd ../dist
pwd
npm pack . --tag alpha
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading