Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a2c2675
feat: add respect to cli
DmitryAnansky Feb 17, 2025
4fda722
chore: prettier
DmitryAnansky Feb 17, 2025
a7e9701
chore: changes to e2e and rename to respect-core
DmitryAnansky Feb 18, 2025
a5aff49
feat: remove respect auth
DmitryAnansky Feb 18, 2025
e055d03
fix: add ignored module
DmitryAnansky Feb 18, 2025
a0a9f18
chore: add files
DmitryAnansky Feb 18, 2025
7e2890e
fix: type issue in utils
DmitryAnansky Feb 18, 2025
f7f892f
fix: update all e2e tests
DmitryAnansky Feb 18, 2025
b25b578
chore: renaming
DmitryAnansky Feb 18, 2025
2c246fc
chore: fix and simplify go-to logic
RomanHotsiy Feb 18, 2025
c5c28af
chore: fix lint and unit tests
RomanHotsiy Feb 18, 2025
4c3e706
chore: fix e2e for new goto
RomanHotsiy Feb 18, 2025
f83a71a
chore: fix scripts to support respect-core
tatomyr Feb 18, 2025
aff6682
fix parser:generate
tatomyr Feb 18, 2025
70f6ed3
chore: rename ResultObject type
RomanHotsiy Feb 18, 2025
d146a22
chore: remove todos
DmitryAnansky Feb 18, 2025
ee96261
chore: sync package-lock
RomanHotsiy Feb 18, 2025
fb6a001
chore: fix some lint errors
RomanHotsiy Feb 18, 2025
344de08
chore: add secret
RomanHotsiy Feb 18, 2025
d4cf1e2
chore: prettier fix
DmitryAnansky Feb 18, 2025
014a5f9
chore: add abnf-parser to prettierignore
RomanHotsiy Feb 18, 2025
7bc8fb7
chore: publish respect-core snaphot to npm
tatomyr Feb 18, 2025
d7eacd5
chore: comment ignored e2e snapshot and update regexp
DmitryAnansky Feb 18, 2025
e76493a
fix: update cert regexp
DmitryAnansky Feb 18, 2025
2da48ec
chore: try fixing publish and yarn smokes
tatomyr Feb 18, 2025
e0d0b20
chore: try fixing publish
tatomyr Feb 18, 2025
7e6ff71
chore: try fixing publish and remove smokes for node 14 and 16
tatomyr Feb 18, 2025
0d092b7
chore: fix docker smoke test
tatomyr Feb 18, 2025
1dfdd49
chore: improve README and CONTRIBUTING files
tatomyr Feb 18, 2025
b93df0f
fix: cookies from workflows and step are not set to the request (#1918)
DmitryAnansky Feb 19, 2025
e7be640
chore: update respect command handler (#1920)
tatomyr Feb 19, 2025
d7b2729
fix: the $file decorator resolves wrong path to the file (#1921)
DmitryAnansky Feb 19, 2025
d7bc3fc
chore: improve performance
tatomyr Feb 20, 2025
64e2f6b
fix dotenv directory
tatomyr Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 0 additions & 26 deletions .github/workflows/smoke-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,3 @@ jobs:
with:
node-version: 18
- run: bash ./__tests__/smoke-plugins/run-smoke.sh

run-smoke-plugins--npm--node-16:
needs: prepare-smoke-plugins
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke-plugins/
key: cache-plugins-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/setup-node@v3
with:
node-version: 16
- run: bash ./__tests__/smoke-plugins/run-smoke.sh

run-smoke-plugins--npm--node-14:
needs: prepare-smoke-plugins
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3
with:
path: __tests__/smoke-plugins/
key: cache-plugins-${{ github.run_id }}-${{ github.run_attempt }}
- uses: actions/setup-node@v3
with:
node-version: 14
- run: bash ./__tests__/smoke-plugins/run-smoke.sh
13 changes: 12 additions & 1 deletion .github/workflows/snapshot-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ jobs:
# Update Core package version
jq ".version = \"$VERSION\"" packages/core/package.json > tmp.json && mv tmp.json packages/core/package.json

# Update CLI package version and the Core dependency
# Update Respect Core package version and dependencies
jq ".version = \"$VERSION\"" packages/respect-core/package.json > tmp.json && mv tmp.json packages/respect-core/package.json
jq ".dependencies[\"@redocly/openapi-core\"] = \"$VERSION\"" packages/respect-core/package.json > tmp.json && mv tmp.json packages/respect-core/package.json

# Update CLI package version and dependencies
jq ".version = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
jq ".dependencies[\"@redocly/openapi-core\"] = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
jq ".dependencies[\"@redocly/respect-core\"] = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json

# Add comment with installation instructions
COMMENT="📦 A new experimental version **v$VERSION** of Redocly CLI has been published for testing.
Expand Down Expand Up @@ -66,5 +71,11 @@ jobs:

cd packages/core
npm publish --tag snapshot
sleep 10

cd ../respect-core
npm publish --tag snapshot
sleep 10

cd ../cli
npm publish --tag snapshot
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: npm run e2e
env:
CI: true

SANDBOX_REBILLY_TOKEN: ${{ secrets.SANDBOX_REBILLY_TOKEN }}
cli-package-test:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ output/
*.tgz
redoc-static.html
packages/cli/README.md
.env
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ lib/
output/
*snapshot.js
packages/core/src/rules/__tests__/fixtures/invalid-yaml.yaml
packages/respect-core/src/modules/runtime-expressions/abnf-parser.js
__tests__/webpack-bundle/bundle-workflows/metafile.json
benchmark/api-definitions/
LICENSE.md
55 changes: 41 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Redocly CLI Contributing Guide

Hi! We're really excited that you are interested in contributing to Redocly CLI. 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 Redocly CLI.
Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.

- [Issue reporting guidelines](#issue-reporting-guidelines)
- [Pull request guidelines](#pull-request-guidelines)
Expand Down Expand Up @@ -48,7 +49,8 @@ npm install # or npm i

To compile the code, run `npm run compile`. To do that on the fly, run `npm run watch` in a separate thread.

To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint resources/museum.yaml --format=stylish`. Please notice that the extra `--` is required to pass arguments to the CLI rather than to NPM itself.
To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint resources/museum.yaml --format=stylish`.
Please notice that the extra `--` is required to pass arguments to the CLI rather than to NPM itself.

Format your code with `npm run prettier` before committing.

Expand All @@ -70,15 +72,15 @@ To test local changes as a package, you can use the following steps:

1. Optionally, bump the version of the packages ([see details](#version-updating)).

1. Run `npm run pack:prepare` in the repository's root. This generates **redocly-cli.tgz** and **openapi-core.tgz** files and makes some changes to **packages/cli/package.json** file.
1. Run `npm run pack:prepare` in the repository's root.
This generates **redocly-cli.tgz**, **respect-core.tgz**, and **openapi-core.tgz** files.

1. Copy **redocly-cli.tgz** file to a destination folder and then run `npm install redocly-cli.tgz` there to install Redocly CLI. To install `openapi-core` do the same but with **openapi-core.tgz** file.

Don't forget to revert the changes to **package.json** files later.
1. Copy those **.tgz** files to a destination folder and then run `npm install redocly-cli.tgz` there to install Redocly CLI. To install `openapi-core` do the same but with **openapi-core.tgz** file.

## Contribute documentation

Additions and updates to our documentation are very welcome. You can find the documentation in the `docs/` folder, and this is published to https://redocly.com/docs/cli/ as part of our main website.
Additions and updates to our documentation are very welcome.
You can find the documentation in the `docs/` folder, and this is published to https://redocly.com/docs/cli/ as part of our main website.

To preview your documentation changes locally:

Expand All @@ -92,11 +94,14 @@ redocly preview

By default, you can access the docs preview at http://localhost:4000 or http://127.0.0.1:4000.

> Please note that currently the custom markdoc tags used in the main website are not available in the local preview version, and links that point to the wider website do show as errors when using a local platform. The pull request workflows generate a full preview, so rest assured that you are able to check everything is in good shape before we review and merge your changes.
> Please note that currently the custom markdoc tags used in the main website are not available in the local preview version, and links that point to the wider website do show as errors when using a local platform.
> The pull request workflows generate a full preview, so rest assured that you are able to check everything is in good shape before we review and merge your changes.

### Prose linting

We are proud of our docs. When you open a pull request, we lint the prose using [Vale](https://vale.sh/). You can also install this tool locally and run it from the root of the project with:
We are proud of our docs.
When you open a pull request, we lint the prose using [Vale](https://vale.sh/).
You can also install this tool locally and run it from the root of the project with:

```bash
vale docs/
Expand All @@ -112,7 +117,9 @@ We use [Markdownlint](https://github.com/DavidAnson/markdownlint) to check that

### Markdown link checking

We use [`mlc`](https://github.com/becheran/mlc) to check the links in the `docs/` folder. This tool runs automatically on every pull request, but you can also run it locally if you want to. Visit the project homepage to find the installation instructions for your platform, and then run the command like this:
We use [`mlc`](https://github.com/becheran/mlc) to check the links in the `docs/` folder.
This tool runs automatically on every pull request, but you can also run it locally if you want to.
Visit the project homepage to find the installation instructions for your platform, and then run the command like this:

```bash
mlc docs/
Expand All @@ -122,7 +129,8 @@ It only checks links within the local docs (it can't check links to other docs s

## Built-in rules changes

After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels. The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels.
The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
Also add the rule to the built-in rules list in [the config types tree](./packages/core/src/types/redocly-yaml.ts).

Separately, open a merge request with the corresponding documentation changes.
Expand All @@ -139,11 +147,16 @@ Environment variables should not affect the **core** package logic.

### Command line arguments

Use them to provide some arguments that are specific to a certain command. Think of them as modifiers. They should not affect the **core** package logic.
Use them to provide some arguments that are specific to a certain command.
Think of them as modifiers.
They should not affect the **core** package logic.

### Configuration file

The **redocly.yaml** file is the most flexible way of providing arguments. Please use it to provide arguments that are common for all the commands, for a specific command, or for a specific API. It could be used for providing arguments for both **cli** and **core** packages. Please refer to the [configuration file](https://redocly.com/docs/cli/configuration/) documentation for more details.
The **redocly.yaml** file is the most flexible way of providing arguments.
Please use it to provide arguments that are common for all the commands, for a specific command, or for a specific API.
It could be used for providing arguments for both **cli** and **core** packages.
Please refer to the [configuration file](https://redocly.com/docs/cli/configuration/) documentation for more details.

## Exit codes

Expand Down Expand Up @@ -183,6 +196,17 @@ To update snapshots, run `npm run e2e -- -u`.

If you made any changes, make sure to compile the code before running the tests.

### Performance benchmark

To run the performance benchmark locally, you should have `hyperfine` (v1.16.1+) installed on your machine.
Prepare the local build, go to the `benchmark` folder, clean it up, do the preparations, and run the actual benchmark:

```sh
(npm run compile && npm run pack:prepare && cd benchmark/ && git clean -dX -f . && git clean -dX -ff . && npm i && npm run make-test && npm test)
```

You might need to adjust the CLI versions that need to be tested in the `benchmark/package.json` file.

## Project structure

- **`__mocks__`**: contains basic mocks for e2e tests.
Expand Down Expand Up @@ -217,14 +241,17 @@ If you made any changes, make sure to compile the code before running the tests.
- **`packages/core/src/types`**: contains the common types for several OpenAPI versions.
- **`packages/core/src/typings`**: contains the common Typescript typings.

- **`packages/respect-core`**: contains the Respect core package.

- **`resources`**: contains some example API descriptions and configuration files that might be useful for testing.

## Release flow

We use [Changesets](https://github.com/changesets/changesets) flow.
After merging a PR with a changeset, the release PR is automatically created.

If the pipelines are not starting, close and reopen the PR. Merging that PR triggers the release process.
If the pipelines are not starting, close and reopen the PR.
Merging that PR triggers the release process.

### Revert a release

Expand Down
42 changes: 13 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
FROM node:alpine

WORKDIR /build

# Copy files required for npm install only
COPY package.json package-lock.json /build/
COPY packages/cli/package.json /build/packages/cli/
COPY packages/core/package.json /build/packages/core/
COPY packages/cli/bin/ /build/packages/cli/bin/

RUN npm ci --no-optional --ignore-scripts

# Copy rest of the files
COPY . /build/
RUN npm run prepare

# Install redocly-cli globally, similar to npm install --global @redocly/cli
# but the local package is used here
RUN apk update && apk add jq && \
apk add git && \
COPY . .
RUN apk add --no-cache jq git && \
npm ci --no-optional --ignore-scripts && \
npm run prepare && \
npm run pack:prepare && \
npm install --global redocly-cli.tgz

# npm pack in the previous RUN command does not include these assets
RUN cp packages/cli/src/commands/preview-docs/preview-server/default.hbs /usr/local/lib/node_modules/@redocly/cli/lib/commands/preview-docs/preview-server/default.hbs && \
cp packages/cli/src/commands/preview-docs/preview-server/hot.js /usr/local/lib/node_modules/@redocly/cli/lib/commands/preview-docs/preview-server/hot.js && \
cp packages/cli/src/commands/build-docs/template.hbs /usr/local/lib/node_modules/@redocly/cli/lib/commands/build-docs/template.hbs

# Clean up to reduce image size
RUN npm cache clean --force && rm -rf /build
npm install --global redocly-cli.tgz && \
cp packages/cli/src/commands/preview-docs/preview-server/default.hbs \
packages/cli/src/commands/preview-docs/preview-server/hot.js \
/usr/local/lib/node_modules/@redocly/cli/lib/commands/preview-docs/preview-server/ && \
cp packages/cli/src/commands/build-docs/template.hbs \
/usr/local/lib/node_modules/@redocly/cli/lib/commands/build-docs/ && \
# Clean up to reduce image size
npm cache clean --force && rm -rf /build

WORKDIR /spec

ENTRYPOINT [ "redocly" ]

ENTRYPOINT ["redocly"]
ENV REDOCLY_ENVIRONMENT=docker
Loading
Loading