Skip to content

Commit 253cb84

Browse files
github-actions[bot]DmitryAnanskyRomanHotsiytatomyr
authored
chore: 🧪 release (feat: wip, introduce "respect") (#1922)
* feat: add respect to cli * chore: prettier * chore: changes to e2e and rename to respect-core * feat: remove respect auth * fix: add ignored module * chore: add files * fix: type issue in utils * fix: update all e2e tests * chore: renaming * chore: fix and simplify go-to logic * chore: fix lint and unit tests * chore: fix e2e for new goto * chore: fix scripts to support respect-core * fix parser:generate * chore: rename ResultObject type * chore: remove todos * chore: sync package-lock * chore: fix some lint errors * chore: add secret * chore: prettier fix * chore: add abnf-parser to prettierignore * chore: publish respect-core snaphot to npm * chore: comment ignored e2e snapshot and update regexp * fix: update cert regexp * chore: try fixing publish and yarn smokes * chore: try fixing publish * chore: try fixing publish and remove smokes for node 14 and 16 * chore: fix docker smoke test * chore: improve README and CONTRIBUTING files * fix: cookies from workflows and step are not set to the request (#1918) * chore: update respect command handler (#1920) * fix: the $file decorator resolves wrong path to the file (#1921) --------- Co-authored-by: DmitryAnansky <dmytro@redocly.com> Co-authored-by: Roman Hotsiy <gotsijroman@gmail.com> Co-authored-by: Andrew Tatomyr <andrew.tatomyr@redocly.com>
1 parent 84a6252 commit 253cb84

File tree

313 files changed

+122191
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

313 files changed

+122191
-323
lines changed

.github/workflows/smoke-plugins.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,3 @@ jobs:
6464
with:
6565
node-version: 18
6666
- run: bash ./__tests__/smoke-plugins/run-smoke.sh
67-
68-
run-smoke-plugins--npm--node-16:
69-
needs: prepare-smoke-plugins
70-
runs-on: ubuntu-latest
71-
steps:
72-
- uses: actions/cache@v3
73-
with:
74-
path: __tests__/smoke-plugins/
75-
key: cache-plugins-${{ github.run_id }}-${{ github.run_attempt }}
76-
- uses: actions/setup-node@v3
77-
with:
78-
node-version: 16
79-
- run: bash ./__tests__/smoke-plugins/run-smoke.sh
80-
81-
run-smoke-plugins--npm--node-14:
82-
needs: prepare-smoke-plugins
83-
runs-on: ubuntu-latest
84-
steps:
85-
- uses: actions/cache@v3
86-
with:
87-
path: __tests__/smoke-plugins/
88-
key: cache-plugins-${{ github.run_id }}-${{ github.run_attempt }}
89-
- uses: actions/setup-node@v3
90-
with:
91-
node-version: 14
92-
- run: bash ./__tests__/smoke-plugins/run-smoke.sh

.github/workflows/snapshot-release.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ jobs:
3131
# Update Core package version
3232
jq ".version = \"$VERSION\"" packages/core/package.json > tmp.json && mv tmp.json packages/core/package.json
3333
34-
# Update CLI package version and the Core dependency
34+
# Update Respect Core package version and dependencies
35+
jq ".version = \"$VERSION\"" packages/respect-core/package.json > tmp.json && mv tmp.json packages/respect-core/package.json
36+
jq ".dependencies[\"@redocly/openapi-core\"] = \"$VERSION\"" packages/respect-core/package.json > tmp.json && mv tmp.json packages/respect-core/package.json
37+
38+
# Update CLI package version and dependencies
3539
jq ".version = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
3640
jq ".dependencies[\"@redocly/openapi-core\"] = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
41+
jq ".dependencies[\"@redocly/respect-core\"] = \"$VERSION\"" packages/cli/package.json > tmp.json && mv tmp.json packages/cli/package.json
3742
3843
# Add comment with installation instructions
3944
COMMENT="📦 A new experimental version **v$VERSION** of Redocly CLI has been published for testing.
@@ -66,5 +71,11 @@ jobs:
6671
6772
cd packages/core
6873
npm publish --tag snapshot
74+
sleep 10
75+
76+
cd ../respect-core
77+
npm publish --tag snapshot
78+
sleep 10
79+
6980
cd ../cli
7081
npm publish --tag snapshot

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: npm run e2e
2929
env:
3030
CI: true
31-
31+
SANDBOX_REBILLY_TOKEN: ${{ secrets.SANDBOX_REBILLY_TOKEN }}
3232
cli-package-test:
3333
runs-on: ubuntu-latest
3434
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ output/
1313
*.tgz
1414
redoc-static.html
1515
packages/cli/README.md
16+
.env

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ lib/
44
output/
55
*snapshot.js
66
packages/core/src/rules/__tests__/fixtures/invalid-yaml.yaml
7+
packages/respect-core/src/modules/runtime-expressions/abnf-parser.js
78
__tests__/webpack-bundle/bundle-workflows/metafile.json
89
benchmark/api-definitions/
910
LICENSE.md

CONTRIBUTING.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Redocly CLI Contributing Guide
22

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

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

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

51-
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.
52+
To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint resources/museum.yaml --format=stylish`.
53+
Please notice that the extra `--` is required to pass arguments to the CLI rather than to NPM itself.
5254

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

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

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

73-
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.
75+
1. Run `npm run pack:prepare` in the repository's root.
76+
This generates **redocly-cli.tgz**, **respect-core.tgz**, and **openapi-core.tgz** files.
7477

75-
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.
76-
77-
Don't forget to revert the changes to **package.json** files later.
78+
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.
7879

7980
## Contribute documentation
8081

81-
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.
82+
Additions and updates to our documentation are very welcome.
83+
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.
8284

8385
To preview your documentation changes locally:
8486

@@ -92,11 +94,14 @@ redocly preview
9294

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

95-
> 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.
97+
> 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.
98+
> 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.
9699
97100
### Prose linting
98101

99-
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:
102+
We are proud of our docs.
103+
When you open a pull request, we lint the prose using [Vale](https://vale.sh/).
104+
You can also install this tool locally and run it from the root of the project with:
100105

101106
```bash
102107
vale docs/
@@ -112,7 +117,9 @@ We use [Markdownlint](https://github.com/DavidAnson/markdownlint) to check that
112117
113118
### Markdown link checking
114119

115-
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:
120+
We use [`mlc`](https://github.com/becheran/mlc) to check the links in the `docs/` folder.
121+
This tool runs automatically on every pull request, but you can also run it locally if you want to.
122+
Visit the project homepage to find the installation instructions for your platform, and then run the command like this:
116123

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

123130
## Built-in rules changes
124131

125-
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`.
132+
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.
133+
The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
126134
Also add the rule to the built-in rules list in [the config types tree](./packages/core/src/types/redocly-yaml.ts).
127135

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

140148
### Command line arguments
141149

142-
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.
150+
Use them to provide some arguments that are specific to a certain command.
151+
Think of them as modifiers.
152+
They should not affect the **core** package logic.
143153

144154
### Configuration file
145155

146-
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.
156+
The **redocly.yaml** file is the most flexible way of providing arguments.
157+
Please use it to provide arguments that are common for all the commands, for a specific command, or for a specific API.
158+
It could be used for providing arguments for both **cli** and **core** packages.
159+
Please refer to the [configuration file](https://redocly.com/docs/cli/configuration/) documentation for more details.
147160

148161
## Exit codes
149162

@@ -217,14 +230,17 @@ If you made any changes, make sure to compile the code before running the tests.
217230
- **`packages/core/src/types`**: contains the common types for several OpenAPI versions.
218231
- **`packages/core/src/typings`**: contains the common Typescript typings.
219232

233+
- **`packages/respect-core`**: contains the Respect core package.
234+
220235
- **`resources`**: contains some example API descriptions and configuration files that might be useful for testing.
221236

222237
## Release flow
223238

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

227-
If the pipelines are not starting, close and reopen the PR. Merging that PR triggers the release process.
242+
If the pipelines are not starting, close and reopen the PR.
243+
Merging that PR triggers the release process.
228244

229245
### Revert a release
230246

Dockerfile

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,20 @@
11
FROM node:alpine
22

33
WORKDIR /build
4-
5-
# Copy files required for npm install only
6-
COPY package.json package-lock.json /build/
7-
COPY packages/cli/package.json /build/packages/cli/
8-
COPY packages/core/package.json /build/packages/core/
9-
COPY packages/cli/bin/ /build/packages/cli/bin/
10-
11-
RUN npm ci --no-optional --ignore-scripts
12-
13-
# Copy rest of the files
14-
COPY . /build/
15-
RUN npm run prepare
16-
17-
# Install redocly-cli globally, similar to npm install --global @redocly/cli
18-
# but the local package is used here
19-
RUN apk update && apk add jq && \
20-
apk add git && \
4+
COPY . .
5+
RUN apk add --no-cache jq git && \
6+
npm ci --no-optional --ignore-scripts && \
7+
npm run prepare && \
218
npm run pack:prepare && \
22-
npm install --global redocly-cli.tgz
23-
24-
# npm pack in the previous RUN command does not include these assets
25-
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 && \
26-
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 && \
27-
cp packages/cli/src/commands/build-docs/template.hbs /usr/local/lib/node_modules/@redocly/cli/lib/commands/build-docs/template.hbs
28-
29-
# Clean up to reduce image size
30-
RUN npm cache clean --force && rm -rf /build
9+
npm install --global redocly-cli.tgz && \
10+
cp packages/cli/src/commands/preview-docs/preview-server/default.hbs \
11+
packages/cli/src/commands/preview-docs/preview-server/hot.js \
12+
/usr/local/lib/node_modules/@redocly/cli/lib/commands/preview-docs/preview-server/ && \
13+
cp packages/cli/src/commands/build-docs/template.hbs \
14+
/usr/local/lib/node_modules/@redocly/cli/lib/commands/build-docs/ && \
15+
# Clean up to reduce image size
16+
npm cache clean --force && rm -rf /build
3117

3218
WORKDIR /spec
33-
34-
ENTRYPOINT [ "redocly" ]
35-
19+
ENTRYPOINT ["redocly"]
3620
ENV REDOCLY_ENVIRONMENT=docker

0 commit comments

Comments
 (0)