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(api): addition of a new uninstall command #776

Merged
merged 16 commits into from
Oct 20, 2023
Merged

Conversation

erunion
Copy link
Member

@erunion erunion commented Oct 20, 2023

🚥 Resolves RM-4127

🧰 Changes

This creates a new uninstall command that folks can use to uninstall codegen'd SDKs from their codebase. Not only will it run npm uninstall @api/<identifier> it will also delete the generated SDK out of the .api/ directory. Here's what it all looks like.

Screen Shot 2023-10-19 at 11 28 26 PM

Screen Shot 2023-10-19 at 11 30 25 PM

Screen Shot 2023-10-19 at 11 29 33 PM

@erunion erunion marked this pull request as ready for review October 20, 2023 06:30
@erunion erunion added enhancement New feature or request area:api Issues related to the `api` CLI, which builds the SDKs labels Oct 20, 2023
@@ -45,6 +45,12 @@
"sha512-ld+djZk8uRWmzXC+JYla1PTBScg0NjP/8x9vOOKRW+DuJ3NNMRjrpfbY7T77Jgnc87dZZsU49robbQfYe3ukug=="
]
},
"language": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping track of what language we generated the SDK for will allow us to know how to uninstall it from that languages package manager. And because this didn't exist before this we'll default to js everywhere we access this.

@@ -30,6 +30,7 @@ cmd
logger(`package name (${chalk.red('private')}): ${chalk.grey(`@api/${api.identifier}`)}`);
}

logger(`language: ${chalk.grey(api.language || SupportedLanguages.JS)}`);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2023-10-19 at 11 35 45 PM

@@ -226,30 +282,17 @@ export default class Storage {
}

/**
* @example <caption>Storage directory structure</caption>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because I don't want to have to maintain it alongside the same tree in docs/how-it-works.md.

@erunion erunion added this to the v7 milestone Oct 20, 2023
Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty much only docs feedback below but this works great in my testing! if we're uninstalling the last remaining SDK, should we also remove the top-level .api directory and all of its contents or nah?

packages/api/src/codegen/codegenerator.ts Outdated Show resolved Hide resolved
docs/how-it-works.md Outdated Show resolved Hide resolved
docs/how-it-works.md Outdated Show resolved Hide resolved
docs/how-it-works.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for all the feedback in this file — i definitely plan on doing a full comb through our docs before we release v7

const entry = Storage.getFromLockfile(identifier);
if (!entry) {
logger(
`You do not appear to have ${identifier} installed. You can run \`npx api list\` to see what SDKs are present.`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great 🫶🏽

Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more tiny thing — otherwise LGTM!

docs/how-it-works.md Outdated Show resolved Hide resolved
Co-authored-by: Kanad Gupta <[email protected]>
@erunion erunion merged commit e44461a into main Oct 20, 2023
4 checks passed
@erunion erunion deleted the feat/uninstall-command branch October 20, 2023 17:12
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.

2 participants