Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: v9 backport of docs/test/build/refactor changes #1196

Merged
merged 26 commits into from
Mar 19, 2025

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Mar 19, 2025

🧰 Changes

backports a lot of random changes over to v9:

everything in this PR is more or less behind-the-scenes changes to our tests, our build process, etc. and shouldn't have any actual impact on customers, hence i'm marking this PR as a chore.

i've deliberately held off on bumping all of our deps in this PR since i want to have the changes from #1189 in their own PR that trigger a patch release on the v9 channel.

edit: i've decided that i'm packing everything into here and will merge this via a merge commit. this includes all dep bumps, including backporting fixes for #1187 and #1046.

quick before/after of the outdated dependencies:

before

Package                                 Current   Wanted   Latest  Location                                             Depended by
@commitlint/cli                          19.7.1   19.8.0   19.8.0  node_modules/@commitlint/cli                         rdme
@commitlint/config-conventional          19.7.1   19.8.0   19.8.0  node_modules/@commitlint/config-conventional         rdme
@oclif/core                               4.2.6   4.2.10   4.2.10  node_modules/@oclif/core                             rdme
@oclif/plugin-autocomplete               3.2.20   3.2.26   3.2.26  node_modules/@oclif/plugin-autocomplete              rdme
@oclif/plugin-help                       6.2.24   6.2.27   6.2.27  node_modules/@oclif/plugin-help                      rdme
@oclif/plugin-not-found                  3.2.40   3.2.47   3.2.47  node_modules/@oclif/plugin-not-found                 rdme
@oclif/plugin-warn-if-update-available   3.1.32   3.1.38   3.1.38  node_modules/@oclif/plugin-warn-if-update-available  rdme
@oclif/test                               4.1.9   4.1.12   4.1.12  node_modules/@oclif/test                             rdme
@readme/better-ajv-errors                 2.1.2    2.3.2    2.3.2  node_modules/@readme/better-ajv-errors               rdme
@readme/eslint-config                    14.1.2   14.6.0   14.6.0  node_modules/@readme/eslint-config                   rdme
@readme/oas-examples                     5.18.2   5.19.2   5.19.2  node_modules/@readme/oas-examples                    rdme
@rollup/plugin-commonjs                  28.0.2   28.0.3   28.0.3  node_modules/@rollup/plugin-commonjs                 rdme
@rollup/plugin-node-resolve              16.0.0   16.0.1   16.0.1  node_modules/@rollup/plugin-node-resolve             rdme
@vitest/coverage-v8                       3.0.5    3.0.9    3.0.9  node_modules/@vitest/coverage-v8                     rdme
@vitest/expect                            3.0.5    3.0.9    3.0.9  node_modules/@vitest/expect                          rdme
ci-info                                   4.1.0    4.2.0    4.2.0  node_modules/ci-info                                 rdme
eslint                                   8.57.1   8.57.1   9.22.0  node_modules/eslint                                  rdme
knip                                     5.43.6   5.46.0   5.46.0  node_modules/knip                                    rdme
nock                                     14.0.0   14.0.1   14.0.1  node_modules/nock                                    rdme
oas                                      25.3.0   25.3.0   26.0.2  node_modules/oas                                     rdme
oas-normalize                            12.1.0   12.1.0   13.1.2  node_modules/oas-normalize                           rdme
oclif                                   4.17.25  4.17.37  4.17.37  node_modules/oclif                                   rdme
prettier                                  3.4.2    3.5.3    3.5.3  node_modules/prettier                                rdme
rollup                                   4.34.1   4.36.0   4.36.0  node_modules/rollup                                  rdme
semver                                    7.7.0    7.7.1    7.7.1  node_modules/semver                                  rdme
tsx                                      4.19.2   4.19.3   4.19.3  node_modules/tsx                                     rdme
type-fest                                4.33.0   4.37.0   4.37.0  node_modules/type-fest                               rdme
typescript                                5.7.3    5.8.2    5.8.2  node_modules/typescript                              rdme
undici                                   5.28.5   5.29.0    7.5.0  node_modules/undici                                  rdme
vitest                                    3.0.5    3.0.9    3.0.9  node_modules/vitest                                  rdme

after

Package  Current  Wanted  Latest  Location             Depended by
eslint    8.57.1  8.57.1  9.22.0  node_modules/eslint  rdme
undici    5.29.0  5.29.0   7.5.0  node_modules/undici  rdme

🧬 QA & Testing

do tests pass?

kanadgupta and others added 19 commits March 19, 2025 12:25
- [x] forks `syncsDocsPath` logic and deprecates it (in favor of TBA)
- [x] cleaner arg definitions in `baseCommand.ts`
- [x] cleanups + improved response handling flexibility in
`handleAPIv2Res`

does the build + tests still pass?
## 🧰 Changes

This is just a **very** small typing improvement on some of our
`console.*` unit test spies.
cherry-picking over a few random refactors from
#1159 that are mostly unrelated to
the PR itself:

- [x] removes unused fixtures
- [x] smol copy tweaks for changelog command ("syncing" is reserved for
bidi, this is "uploading"
- [x] jsdoc tweaks, including deprecating APIv1-related cruft
- [x] various type enhancements
- [x] renaming a few things
- [x] adding `oclif`'s `this` context (so we can simplify functions and
add better debug logs)

do tests still pass?
chunks out a lot of PR feedback and random changes from #1159:

- [x] renames all "front matter" to "frontmatter"
- [x] better `nock` and `fs` setup/teardown
- [x] cherry-picking over
c871520
- [x] various cleanups
- [x] bumps deps:

before:

```Package                    Current   Wanted   Latest  Location                                Depended by
@readme/better-ajv-errors    2.0.0    2.1.2    2.1.2  node_modules/@readme/better-ajv-errors  rdme
eslint                      8.57.1   8.57.1   9.19.0  node_modules/eslint                     rdme
oclif                      4.17.20  4.17.21  4.17.21  node_modules/oclif                      rdme
semver                       7.6.3    7.7.0    7.7.0  node_modules/semver                     rdme
undici                      5.28.5   5.28.5    7.3.0  node_modules/undici                     rdme
```

after:

```
Package  Current  Wanted  Latest  Location             Depended by
eslint    8.57.1  8.57.1  9.19.0  node_modules/eslint  rdme
undici    5.28.5  5.28.5   7.3.0  node_modules/undici  rdme
```

do tests still pass?

---------

Co-authored-by: Jon Ursenbach <jon@ursenba.ch>
a few small behind-the-scenes changes to simplify how we build `rdme`
for GitHub Actions users — no actual customer impact here. quick
breakdown of the changes:

- [x] replaces `@rollup/plugin-terser` with `rollup-plugin-esbuild` for
minifying our GitHub Actions code. the latter accomplishes basically the
same result as the former, but in a tiny fraction of the time.
- [x] we previously forked our GHA build process into a development vs.
production setup since terser takes so long. since
`rollup-plugin-esbuild` adds a negligible amount of time to our build
process, there's no need to have two setups. this PR combines them into
a single build process.
- [x] added a bunch of steps to our CI to further assert that the GitHub
Actions build is what we expect.

does CI still pass?
The owner of `eslint-plugin-vitest` lost their NPM access to it was
moved into `@vitest/eslint-plugin` a little over a year ago. This
upgrades our `@readme/eslint-config` package to pull that in.
## 🧰 Changes

[node v20.18.3](https://nodejs.org/en/blog/release/v20.18.3) officially
marked import attributes [as
stable](https://nodejs.org/docs/latest-v20.x/api/esm.html#import-attributes).
we have a lot of weird workarounds with our `oclif` setup in this repo
in an effort to avoid import attributes and the ugly
`ExperimentalWarning` outputs we see, but i don't think those should be
a concern anymore, for a few reasons:

- our minimum required node.js version is node 20, so it should be a
non-disruptive change for users to upgrade to the latest node 20 channel
- even if folks are on <20.18.2, the `ExperimentalWarning` outputs log
to `stderr` so it shouldn't affect any command output-based workflows,
which almost always are relying on `stdout`. plus, we discourage this
kind of scripting and recommend folks use exit codes instead

given the above, this PR brings back JSON imports of `package.json` and
vastly simplifies a lot of weirdness in this codebase.

## 🧬 QA & Testing

we've added a lot of good test coverage now and i've been playing around
with the CLI and github actions build locally and everything seems to
work as expected.

very unlikely we'll run into the fiasco in
#1117, especially now with the
cleanups in this PR and #1172.
| 🚥 Resolves ISSUE_ID |
| :------------------- |

Ok take 2 updating the docs syncing command! Turns out I had a really
out of date version locally, so it was easier just to make a new branch
instead of trying to squash a bunch of merge conflicts.

This updates the docs syncing to use the new version of rdme now that
our main docs project is on Refactored.

Provide as much information as you can on how to test what you've done.

---------

Co-authored-by: Kanad Gupta <git@kanad.dev>
we lose some test coverage here but i'm not sure if there's a better solution
## 🧰 Changes

rewrites our tests for `openapi validate` to be more compliant with [our
contributing
guidelines](https://github.com/readmeio/rdme/blob/next/CONTRIBUTING.md#code-style-guidelines).
i initially wrote them this way to minimize the amount of legwork to get
`oclif` working but this approach to testing is far more comprehensive
and it should be much easier to drop in stray console logs for debugging
purposes.

## 🧬 QA & Testing

do tests still pass?
## 🧰 Changes

continuing my work in #1188 with
even more work to migrate over our tests to the more comprehensive
`runCommand` helper:

- [x] `openapi convert`
- [x] `openapi inspect`
- [x] `openapi reduce`
- [x] `login`
- [x] `logout`
- [x] `whoami`

the only outstanding tests using the now deprecated
`runCommandAndReturnResult` helper are the changelog tests, but i'll
swap those out if/when we get around to migrating that command over to
APIv2.

## 🧬 QA & Testing

no functional changes. do tests still pass?
@kanadgupta kanadgupta force-pushed the kanad-2025-03-19/v9-backport branch from 1e98f71 to 61fd7a8 Compare March 19, 2025 18:00
@kanadgupta kanadgupta marked this pull request as ready for review March 19, 2025 21:29
kanadgupta and others added 4 commits March 19, 2025 17:27
Before:

```
Package                                 Current   Wanted   Latest  Location                                             Depended by
@oclif/core                               4.2.6    4.2.8    4.2.8  node_modules/@oclif/core                             rdme
@oclif/plugin-autocomplete               3.2.20   3.2.24   3.2.24  node_modules/@oclif/plugin-autocomplete              rdme
@oclif/plugin-help                       6.2.24   6.2.26   6.2.26  node_modules/@oclif/plugin-help                      rdme
@oclif/plugin-not-found                  3.2.40   3.2.44   3.2.44  node_modules/@oclif/plugin-not-found                 rdme
@oclif/plugin-warn-if-update-available   3.1.32   3.1.35   3.1.35  node_modules/@oclif/plugin-warn-if-update-available  rdme
@oclif/test                               4.1.9   4.1.11   4.1.11  node_modules/@oclif/test                             rdme
@readme/better-ajv-errors                 2.1.2    2.3.2    2.3.2  node_modules/@readme/better-ajv-errors               rdme
@readme/eslint-config                    14.3.0   14.4.2   14.4.2  node_modules/@readme/eslint-config                   rdme
@vitest/coverage-v8                       3.0.5    3.0.7    3.0.7  node_modules/@vitest/coverage-v8                     rdme
@vitest/expect                            3.0.5    3.0.7    3.0.7  node_modules/@vitest/expect                          rdme
eslint                                   8.57.1   8.57.1   9.21.0  node_modules/eslint                                  rdme
knip                                     5.43.6   5.45.0   5.45.0  node_modules/knip                                    rdme
nock                                     14.0.0   14.0.1   14.0.1  node_modules/nock                                    rdme
oclif                                   4.17.25  4.17.34  4.17.34  node_modules/oclif                                   rdme
prettier                                  3.4.2    3.5.3    3.5.3  node_modules/prettier                                rdme
rollup                                   4.34.1   4.34.9   4.34.9  node_modules/rollup                                  rdme
rollup-plugin-esbuild                     6.2.0    6.2.1    6.2.1  node_modules/rollup-plugin-esbuild                   rdme
tsx                                      4.19.2   4.19.3   4.19.3  node_modules/tsx                                     rdme
type-fest                                4.33.0   4.36.0   4.36.0  node_modules/type-fest                               rdme
typescript                                5.7.3    5.8.2    5.8.2  node_modules/typescript                              rdme
undici                                   5.28.5   5.28.5    7.4.0  node_modules/undici                                  rdme
vitest                                    3.0.5    3.0.7    3.0.7  node_modules/vitest                                  rdme
```

After:

```
Package  Current  Wanted  Latest  Location             Depended by
eslint    8.57.1  8.57.1  9.21.0  node_modules/eslint  rdme
undici    5.28.5  5.28.5   7.4.0  node_modules/undici  rdme
```
…ors (#1189)

Over the past couple weeks I've been rewriting our OpenAPI parser,
`@readme/openapi-parser`, to support a new error leveling system -- you
can read up on details on this in
readmeio/oas#943. This PR pulls in the fruits of
my labor there and across `oas` and `oas-normalize`.

* [x] Upgrades `oas-normalize` to pull in our new parser engine and
error handling. The error leveling work is not being used within `rdme`
but for things like specification validation that our parser does `rdme`
will now be able to surface more than one of these errors at a time. 🎉
  * Support for Node 18 has also been removed.
* [x] Upgrades `oas` and `@readme/oas-examples` to pull in the removal
of Node 18 support.

All told this overhaul is mostly a drop-in replacement with the
exception that instead of `SyntaxError` and `MissingPointerError`
exceptions being thrown from the parser for some invalid API definition
cases it will now always be a `ValidationError.`
@kanadgupta kanadgupta requested review from erunion and emilyskuo March 19, 2025 22:38
@kanadgupta kanadgupta added dependencies Pull requests that update a dependency file refactor Issues about tackling technical debt bug Something isn't working labels Mar 19, 2025
@kanadgupta kanadgupta merged commit 046dd89 into v9 Mar 19, 2025
10 checks passed
@kanadgupta kanadgupta deleted the kanad-2025-03-19/v9-backport branch March 19, 2025 22:45
@kanadgupta
Copy link
Member Author

🎉 This PR is included in version 9.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kanadgupta
Copy link
Member Author

🎉 This PR is included in version 10.2.0-next.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file refactor Issues about tackling technical debt released on @next released on @v9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants