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

feat: oclif #962

Closed
wants to merge 112 commits into from
Closed

feat: oclif #962

wants to merge 112 commits into from

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Jan 11, 2024

🧰 Changes

Outstanding tasks:

  • Test coverage around hooks (namely the prerun hook and the --key flag handling)
  • Issues mocking certain functions
  • Getting a build working for GitHub Actions runners

Non-blocking outstanding tasks:

  • Consolidate styling on outputs
    • Debug outputs
    • Error outputs
    • Warning outputs
    • Info outputs
    • General log outputs
  • Eliminate JSON import assertions
  • Use this.userAgent in readmeAPIFetch calls
  • Use oclif readme to autogenerate arg docs
  • Do a pass at summary/description fields for all args

🧬 QA & Testing

npm ci && npm run build
bin/run.js

i think this is causing clashes with oclif — plus we may not need it anymore?
- recreate base command auth + flags in oclif
this is probably where should do some error handling too but not sure how yet
this was causing errors in tests, will have to tackle this a different way
this is weird (and maybe it's a vitest 1.0 thing?) but basically faketimers were causing the GHA onboarding e2e tests to fail. when reading the docs, we probably didn't need it anyways since the `vi.useFakeTimers()` call isn't required for the `vi.setSystemTime` calls to work
i think this is now taken care of with rootDir, and also it was maybe making it slightly more annoying to set import paths in vscode? plus the docs say we shouldn't use it outside of AMD module loaders

https://www.typescriptlang.org/tsconfig#baseUrl
@kanadgupta kanadgupta added the enhancement New feature or request label Jan 11, 2024
@readmeio readmeio deleted a comment from notion-workspace bot Feb 27, 2024
@kanadgupta kanadgupta mentioned this pull request May 7, 2024
26 tasks
@kanadgupta kanadgupta closed this Sep 16, 2024
@kanadgupta kanadgupta mentioned this pull request Nov 16, 2024
14 tasks
kanadgupta added a commit that referenced this pull request Nov 19, 2024
## 🧰 Changes

i took a stab at this in
[#962](#962) but ran into issues at
the time but oclif has since shipped a lot of handy features (and plus
the work that folks did on `owl` got me excited about oclif again) so i
decided to revive this and i got it all working 🥹

here's a high-level overview:
- [x] refactors all commands, associated helper functions, and github
actions build process to be oclif-friendly
- [x] converts all tests to use oclif test utilities


BREAKING CHANGE: the `rdme` GitHub Actions is now a [the `node20` JavaScript action](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions) rather than [a Docker container action](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-docker-container-actions).

BREAKING CHANGE: `rdme` is now powered by [`oclif`](https://oclif.io/). The formatting and content of certain error messages and outputs may have changed. Please continue to only utilize exit codes to determine command successes/failures.

completed tasks:

- [x] a handful of tests are still failing, hoping that
oclif/test#652 gets merged in)
- [x] github actions dry runs are failing (but i got them working in
[#1067](https://github.com/readmeio/rdme/pull/1067))[^1]
- [x] remove all docker build/tagging/release code
- [x] update `semantic-release` workflow to support this new process.
here are the assets we'll need to consider every time we tag a release
([link](https://github.com/readmeio/rdme/blob/d01d76fe3c2e4a98b4f5c415be03e589fbe3b56e/.releaserc.yml#L30)):
  - [x] command list README (i.e., the one generated by `oclif readme`
- [x] we do **not** need to update `action.yml` on every release anymore
- [x] everything in `dist-gha` (the two JS files ~~and `package.json`~~)
- [x] (do we need an `oclif` manifest in this directory? probably not?)
- [x] we might not actually need to track this duplicated `package.json`
— what if we used the
[`runs.pre`](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runspre)
script to generate it?
  - [x] package/package-lock.json
  - [x] CHANGELOG.md
- [x] `oclif` manifest (this one is interesting... we probably shouldn't
git track it but it should be included in our npm assets)

## 🧬 QA & Testing

to test this out, check out this branch and play around:

```sh
npm ci
bin/dev.js whoami
```

i've confirmed in a separate repo that the action works as expected:
https://github.com/readmeio/oas-examples/actions/runs/11902772744/job/33168462740

i ticketed a few follow-ups in RM-11447

(resolves RM-8260)

[^1]: i'm going to move away from the docker-based github action builds
— it's pretty complex and unfortunately doesn't play nicely with oclif.
i figured out a way to get it working with pre-built JS dists in
[#1067](#1067) that is just as fast
(if not faster) than before.
kanadgupta pushed a commit that referenced this pull request Nov 19, 2024
# [9.0.0-next.22](v9.0.0-next.21...v9.0.0-next.22) (2024-11-19)

* feat!: oclif (take 2) ([#1068](#1068)) ([5e05f93](5e05f93)), closes [#962](#962) [#1067](#1067) [/github.com/readmeio/rdme/blob/d01d76fe3c2e4a98b4f5c415be03e589fbe3b56e/.releaserc.yml#L30](https://github.com//github.com/readmeio/rdme/blob/d01d76fe3c2e4a98b4f5c415be03e589fbe3b56e/.releaserc.yml/issues/L30) [#1067](#1067)

### BREAKING CHANGES

* the `rdme` GitHub Actions is now a [the `node20` JavaScript action](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions) rather than [a Docker container action](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-docker-container-actions).
* `rdme` is now powered by [`oclif`](https://oclif.io/). The formatting and content of certain error messages and outputs may have changed. Please continue to only utilize exit codes to determine command successes/failures.

completed tasks:

- [x] a handful of tests are still failing, hoping that
oclif/test#652 gets merged in)
- [x] github actions dry runs are failing (but i got them working in

[skip ci]
@kanadgupta kanadgupta deleted the oclif branch November 19, 2024 12:44
kanadgupta pushed a commit that referenced this pull request Dec 6, 2024
# [9.0.0](v8.6.6...v9.0.0) (2024-12-06)

* feat!: deprecation notices for non-readme-refactored commands ([#1099](#1099)) ([732e32b](732e32b))
* feat!: drop node 18 ([#1085](#1085)) ([ebc2ac0](ebc2ac0))
* feat!: final v9 touchups ([#1106](#1106)) ([15447c5](15447c5)), closes [#1107](#1107)
* feat!: oclif (take 2) ([#1068](#1068)) ([5e05f93](5e05f93)), closes [#962](#962) [#1067](#1067) [/github.com/readmeio/rdme/blob/d01d76fe3c2e4a98b4f5c415be03e589fbe3b56e/.releaserc.yml#L30](https://github.com//github.com/readmeio/rdme/blob/d01d76fe3c2e4a98b4f5c415be03e589fbe3b56e/.releaserc.yml/issues/L30) [#1067](#1067)
* feat!: remove `validate`, deprecate/hide `open` ([#1072](#1072)) ([f1b46f6](f1b46f6))
* feat!: switch topic separator to space ([#1100](#1100)) ([13eb8ab](13eb8ab))

### Bug Fixes

* add better debugging for fetch failures ([a17f8da](a17f8da))
* add GITHUB_TOKEN ([e106e10](e106e10))
* attempt to use semantic-release/github instead of `gh` ([331d28b](331d28b))
* build `dist-gha/` files with every release ([f42392b](f42392b))
* bump semantic-release versions ([21efc66](21efc66))
* debug properly ([#1078](#1078)) ([5de0a4f](5de0a4f))
* **deps:** bump more deps ([#1042](#1042)) ([786a000](786a000))
* empty commit to trigger build ([51c1566](51c1566))
* empty commit to trigger build ([76efb7e](76efb7e))
* empty commit to trigger release ([3604f2a](3604f2a))
* fixed debug script ([#908](#908)) ([82c3541](82c3541))
* hide `ExperimentalWarning` ([#901](#901)) ([f9b5679](f9b5679))
* **npm:** tweak npm lifecycle scripts ([#1073](#1073)) ([35534db](35534db))
* oclif-friendly error logging ([#1080](#1080)) ([73c5f4c](73c5f4c))
* **openapi:** add spinner catch statement ([#961](#961)) ([4669b29](4669b29))
* **release:** track `dist-gha` assets properly ([b0934cb](b0934cb))
* **release:** track changes to commands doc directory ([78b6554](78b6554))
* swap out ts-node for tsx ([16f64b3](16f64b3))
* Update LICENSE for 2024 ([#963](#963)) ([23cf44b](23cf44b))
* use newest import attributes syntax ([#993](#993)) ([d76c0ae](d76c0ae)), closes [/github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md#2023-11-22-version-20100](https://github.com//github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md/issues/2023-11-22-version-20100)
* **versions/update:** various edge cases ([#965](#965)) ([580e307](580e307))

### chore

* type fixes for tests ([#903](#903)) ([d423b4c](d423b4c))

### Code Refactoring

* remove `oas`, `swagger`, `docs:edit` ([#902](#902)) ([9107d15](9107d15))

### Features

* add `@oclif/plugin-not-found`, other cleanups ([#1074](#1074)) ([6529b03](6529b03))
* add `title` flag to `openapi:convert` ([#1071](#1071)) ([1d71f3f](1d71f3f)), closes [#1068](#1068)
* convert to ESM (breaking change) ([#856](#856)) ([84b8571](84b8571)), closes [/www.stefanjudis.com/snippets/how-to-import-json-files-in-es-modules-node-js/#option-1](https://github.com//www.stefanjudis.com/snippets/how-to-import-json-files-in-es-modules-node-js//issues/option-1) [1#L228](https://github.com/1/issues/L228)
* **fetch:** use undici + `ProxyAgent`  ([#1000](#1000)) ([9da7132](9da7132)), closes [#999](#999)
* **openapi/convert:** support openapi in convert command ([#941](#941)) ([a33bbeb](a33bbeb))
* revamped `oclif`-powered docs ([#1081](#1081)) ([8a2833b](8a2833b))
* sort when syncing by parent ([#973](#973)) ([9795840](9795840))
* support `README_API_KEY` env var ([#950](#950)) ([bcf3f18](bcf3f18))
* support node 18 and up ([#900](#900)) ([a217904](a217904))
* **test:** moving unit tests over to vitest ([#857](#857)) ([36d561b](36d561b)), closes [#870](#870)
* use `actions/checkout@v4` everywhere ([#895](#895)) ([d30b71c](d30b71c))
* **versions:** flag parity with API, copy fixes ([#906](#906)) ([d424d9f](d424d9f))

### BREAKING CHANGES

* `rdme openapi` is deprecated and will be replaced in
`rdme@10` by a command with a simpler flag setup based on community
feedback.
* deprecates commands that are not supported in ReadMe
Refactored. For more information, please visit our migration guide:
https://github.com/readmeio/rdme/tree/v9/documentation/migration-guide.md

## 🧬 QA & Testing

Does the copy in these deprecation warnings make sense to you? Note that
the links will be broken for now since we haven't tagged a proper v9
release yet, but that will be fixed once this release is out!
* the topic separator (i.e., what separates a command
from its subcommand) has changed from a colon to a space by default. For
example, `rdme openapi:validate` is now `rdme openapi validate`. The
colon topic separator will continue to be supported so there is no need
to change any existing commands, but all documentation and help screens
will reflect the space topic separator.

## 🧬 QA & Testing

Do tests still pass?
* dropping support for Node.js v18. The minimum required
Node.js version is v20.10.0.
* `rdme validate` has been removed, use `rdme
openapi:validate` instead.
* `rdme open` is now deprecated

also updates our docs accordingly
* the `rdme` GitHub Actions is now a [the `node20` JavaScript action](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions) rather than [a Docker container action](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runs-for-docker-container-actions).
* `rdme` is now powered by [`oclif`](https://oclif.io/). The formatting and content of certain error messages and outputs may have changed. Please continue to only utilize exit codes to determine command successes/failures.

completed tasks:

- [x] a handful of tests are still failing, hoping that
oclif/test#652 gets merged in)
- [x] github actions dry runs are failing (but i got them working in
* **versions:** this flips the `isPublic` flag to `hidden`.
* removes several deprecated commands

* chore: knip cleanup

* chore: type fixes for tests
* removes several deprecated commands
* Node.js >= 18 required

[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant