Skip to content

Conversation

@kanadgupta
Copy link
Contributor

@kanadgupta kanadgupta commented Nov 8, 2023

🚥 Resolves RM-8193

🧰 Changes

This PR rips a couple pages from the rdme playbook:

  • Brings in update-notifier to ensure people are using the latest and greatest updates. People are unlikely to have this CLI globally installed, but it will still be valuable since npx caches versions.
  • Similar to rdme, we now detect whether the api CLI is being run from a CI environment and throw an error if the user attempts to prompt for something.

🧬 QA & Testing

The update-notifier changes are minimal enough and the package is weird enough where it's not particularly easy nor worth it to QA, but I confirmed that the CLI still works!

As for the prompt handler changes, you can check out this branch and try running the following command:

CI=true npm run debug:bin install https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore-simple.json

It should error out with an output like this:

> api@7.0.0-beta.4 debug:bin
> NODE_OPTIONS=--no-warnings node --loader ts-node/esm src/bin.ts install https://raw.githubusercontent.com/readmeio/oas-examples/main/3.0/json/petstore-simple.json

- Fetching your API definition
✔ Fetching your API definition

Yikes! Looks like we were about to prompt you for something in a CI environment. Are you missing an argument?

Try running `api <command> --help` to get more information.

npm ERR! Lifecycle script `debug:bin` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: api@7.0.0-beta.4 
npm ERR!   at location: /Users/kanadg/Code/readmeio/api/packages/api 

@kanadgupta kanadgupta added enhancement New feature or request area:api Issues related to the `api` CLI, which builds the SDKs labels Nov 8, 2023
@kanadgupta kanadgupta marked this pull request as ready for review November 8, 2023 21:40
@kanadgupta kanadgupta requested a review from erunion November 8, 2023 21:43
@kanadgupta kanadgupta merged commit 3339332 into main Nov 8, 2023
@kanadgupta kanadgupta deleted the kanad/rm-8193-bring-in-update-notifier branch November 8, 2023 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:api Issues related to the `api` CLI, which builds the SDKs enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants