This commit is contained in:
Roman 2026-02-07 16:51:14 +00:00 committed by GitHub
commit 54dc93b012
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 12069 additions and 34519 deletions

View File

@ -6,7 +6,7 @@ Hi! We're really excited that you are interested in contributing to Redoc. Befor
- [Issue Reporting Guidelines](#issue-reporting-guidelines)
- [Pull Request Guidelines](#pull-request-guidelines)
- [Development Setup](#development-setup)
- [Commonly used NPM scripts](#commonly-used-npm-scripts)
- [Commonly used pnpm scripts](#commonly-used-pnpm-scripts)
- [Project Structure](#project-structure)
## Issue Reporting Guidelines
@ -17,58 +17,58 @@ Hi! We're really excited that you are interested in contributing to Redoc. Befor
Before submitting a pull request, please make sure the following is done:
1. Fork the repository and create your branch from main.
2. Run `npm install` in the repository root.
2. Run `pnpm install` in the repository root.
3. If youve fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`npm test`). Tip: `npm test -- --watch TestName` is helpful in development.
5. Format your code with prettier (`npm run prettier`).
4. Ensure the test suite passes (`pnpm test`). Tip: `pnpm test -- --watch TestName` is helpful in development.
5. Format your code with prettier (`pnpm run prettier`).
## Development Setup
You need [Node.js](http://nodejs.org) at `v12.0.0+`.
You need [Node.js](http://nodejs.org) at `v18.0.0+`.
After cloning the repo, run:
```bash
$ npm install # or npm
pnpm install
```
### Commonly used NPM scripts
### Commonly used pnpm scripts
``` bash
# dev-server, watch and auto reload playground
$ npm start
$ pnpm start
# start playground app in production environment
$ npm run start:prod
$ pnpm run start:prod
# runt tslint
$ npm run lint
$ pnpm run lint
# try autofix tslint issues
$ npm run lint -- --fix
$ pnpm run lint -- --fix
# run unit tests
$ npm run unit
$ pnpm run unit
# run e2e tests
$ npm run e2e
$ pnpm run e2e
# Make sure you have created bundle before running e2e test
# E.g. run `npm run bundle` and wait for the finishing process.
# E.g. run `pnpm run bundle` and wait for the finishing process.
# open cypress UI to debug e2e test
$ npm run cy:open
$ pnpm run cy:open
# run the unit tests (includes linting and license checks)
$ npm test
$ pnpm test
# prepare bundles
$ npm run bundle
$ pnpm run bundle
# format the code using prettier
$ npm run prettier
$ pnpm run prettier
# auto-generate changelog
$ npm run changelog
$ pnpm run changelog
```
There are some other scripts available in the `scripts` section of the `package.json` file.

View File

@ -8,8 +8,8 @@ jobs:
name: markdownlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DavidAnson/markdownlint-cli2-action@v15
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: DavidAnson/markdownlint-cli2-action@07035fd053f7be764496c0f8d8f9f41f98305101 # v22.0.0
with:
config: .markdownlint.yaml
globs: |
@ -20,7 +20,7 @@ jobs:
name: vale action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: errata-ai/vale-action@reviewdog
with:
files: '["README.md", "docs"]'
@ -30,8 +30,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Markup Link Checker (mlc)
uses: becheran/mlc@v0.16.1
uses: becheran/mlc@7ec24825cefe0c9c8c6bac48430e1f69e3ec356e # v1.2.0
with:
args: ./docs

View File

@ -1,12 +1,26 @@
name: Tests e2e
on: [push]
on: [push, pull_request]
jobs:
build-and-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm run bundle
- run: npm run e2e
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 18
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
version: 10
- run: pnpm install --frozen-lockfile
- run: pnpm run bundle
- run: pnpm run e2e

View File

@ -8,28 +8,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: crazy-max/ghaction-docker-meta@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: redocly/redoc
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ./config/docker/Dockerfile

View File

@ -8,20 +8,20 @@ jobs:
bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Cache node modules
uses: actions/cache@v3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
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-
- run: npm ci
- run: npm run bundle
node-version: 18
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
version: 10
- run: pnpm install --frozen-lockfile
- run: pnpm run bundle
- name: Store bundle artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: bundles
path: bundles
@ -29,21 +29,21 @@ jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm test
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: pnpm install --frozen-lockfile
- run: pnpm test
e2e-tests:
needs: [bundle]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: pnpm install --frozen-lockfile
- name: Download bundled artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: bundles
path: bundles
- run: npm run e2e
- run: pnpm run e2e
check-version:
name: Check Version
runs-on: ubuntu-latest
@ -52,14 +52,14 @@ jobs:
changed: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2.0.1
uses: EndBug/version-check@5102328418c0130d66ca712d755c303e93368ce2 # v2.1.7
with:
file-url: https://cdn.jsdelivr.net/npm/redoc/package.json
file-url: https://cdn.jsdelivr.net/pnpm/redoc/package.json
static-checking: localIsNew
publish:
name: Publish to NPM
@ -67,28 +67,25 @@ jobs:
if: needs.check-version.outputs.changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- uses: actions/checkout@v3
node-version: 18
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
version: 10
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download bundled artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: bundles
path: bundles
- name: Cache node modules
uses: actions/cache@v3
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
run: pnpm install --frozen-lockfile && pnpm run declarations
- name: Publish to NPM
run: npm publish
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@ -99,17 +96,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
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@v4
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
- name: Publish to S3
run: npm run publish-cdn
run: pnpm run publish-cdn
invalidate-cache:
name: Clear cache
@ -118,9 +115,9 @@ jobs:
if: needs.check-version.outputs.changed == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

View File

@ -1,12 +1,24 @@
name: Unit Tests
on: [push]
on: [push, pull_request]
jobs:
build-and-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm run bundle
- run: npm test
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 18
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
version: 10
- run: pnpm install --frozen-lockfile
- run: pnpm test

View File

@ -17,7 +17,7 @@ const localDistDir = './benchmark/revisions/local/bundles';
sh.rm('-rf', localDistDir);
console.log(`Building local dist: ${localDistDir}`);
sh.mkdir('-p', localDistDir);
exec(`npm run bundle:lib --output-path ${localDistDir}`);
exec(`pnpm run bundle:lib --output-path ${localDistDir}`);
const revisions = [];
for (const arg of args) {
@ -33,7 +33,7 @@ console.log(`Writing config "${configDir}"`);
fs.writeFileSync(configDir, configFile);
console.log('Starting benchmark server');
const proc = spawn('npm', ['run', 'start:benchmark']);
const proc = spawn('pnpm', ['run', 'start:benchmark']);
proc.stdout.on('data', data => {
if (data.toString().indexOf('Compiled successfully') > -1) {
@ -119,7 +119,7 @@ function buildRevisionDist(revision) {
const pwd = sh.pwd();
sh.cd(buildDir);
exec('npm uninstall cypress puppeteer && npm install && npm run bundle:lib');
exec('pnpm uninstall cypress puppeteer && pnpm install && pnpm run bundle:lib');
sh.cd(pwd);
return distDir;
}

View File

@ -9,11 +9,13 @@ FROM node:18-alpine
RUN apk update && apk add --no-cache git
# Enable corepack
RUN corepack enable
# Install dependencies
WORKDIR /build
COPY package.json package-lock.json /build/
RUN npm ci --no-optional --ignore-scripts
RUN npm explore esbuild -- npm run postinstall
COPY package.json pnpm-lock.yaml /build/
RUN pnpm install --frozen-lockfile --no-optional
# copy only required for the build files
COPY src /build/src
@ -21,7 +23,7 @@ COPY webpack.config.ts tsconfig.json custom.d.ts /build/
COPY config/webpack-utils.ts /build/config/
COPY typings/styled-patch.d.ts /build/typings/styled-patch.d.ts
RUN npm run bundle:standalone
RUN pnpm run bundle:standalone
FROM nginx:alpine

34423
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
],
"engines": {
"node": ">=6.9",
"npm": ">=3.0.0"
"pnpm": ">=10.28.2"
},
"author": "Roman Hotsiy <gotsijroman@gmail.com>",
"license": "MIT",
@ -32,7 +32,7 @@
"start": "webpack serve --mode=development --env playground --hot --config demo/webpack.config.ts",
"start:prod": "webpack serve --env playground --mode=production --config demo/webpack.config.ts",
"start:benchmark": "webpack serve --mode=production --env.bench --config demo/webpack.config.ts",
"test": "npm run unit && npm run license-check",
"test": "pnpm run unit && pnpm run license-check",
"unit": "jest --coverage",
"test:update-snapshot": "jest --updateSnapshot",
"e2e": "cypress run",
@ -42,9 +42,9 @@
"cy:open": "cypress open",
"bundle:clean": "rimraf bundles",
"bundle:standalone": "webpack --env production --env standalone --mode=production",
"bundle:lib": "webpack --mode=production && npm run declarations",
"bundle:lib": "webpack --mode=production && pnpm run declarations",
"bundle:browser": "webpack --env production --env browser --mode=production",
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:browser && npm run bundle:standalone",
"bundle": "pnpm run bundle:clean && pnpm run bundle:lib && pnpm run bundle:browser && pnpm run bundle:standalone",
"declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json && cp -R src/types typings/",
"stats": "webpack --env production --env standalone --json --profile --mode=production > stats.json",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
@ -58,7 +58,7 @@
"license-check": "license-checker --production --onlyAllow 'MIT;ISC;Apache-2.0;BSD;BSD-2-Clause;BSD-3-Clause;CC-BY-4.0;CC0-1.0;Python-2.0 ' --summary",
"docker:build": "docker build -f config/docker/Dockerfile -t redoc .",
"prepare": "husky install",
"pre-commit": "pretty-quick --staged && npm run lint"
"pre-commit": "pretty-quick --staged && pnpm run lint"
},
"devDependencies": {
"@cfaester/enzyme-adapter-react-18": "^0.8.0",

11948
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff