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: Convert simple prompts to TypeScript #1273

Merged
merged 9 commits into from
Dec 3, 2024
Merged

chore: Convert simple prompts to TypeScript #1273

merged 9 commits into from
Dec 3, 2024

Conversation

kemmerle
Copy link
Contributor

@kemmerle kemmerle commented Nov 25, 2024

Description and Context

In this PR, I convert simple prompts to TypeScript. These include:

accountNamePrompt.ts
cleanUploadPrompt.ts
createFunctionPrompt.ts
createModulePrompt.ts
createTemplatePrompt.ts
projectsLogsPrompt.ts
secretPrompt.ts
setAsDefaultAccountPrompt.ts

IMPORTANT: I was having trouble importing inquirer when converting prompts to TS. We're currently using inquirer v.8.2.0, which is a CommonJS module. We need to bump to the current version (v.12.1.0) to import it using ES module syntax.

Currently, we're wrapping inquirer.createPromptModule() in our helper function, promptUser. My gut feeling is that we should convert promptUser to inquirer.prompt in one PR, once all the files that consume promptUser are converted to TS. Is that a reasonable plan?

I don't see how we can support two inquirer versions (one CommonJS andv one ES module syntax), but let me know if that's possible/preferable.

TODO

  • Figure out how we're going to handle inquirer
  • Address other feedback

Who to Notify

@camden11 @brandenrodgers @joe-yeager

// Accounts for deprecated and new config
const defaultAccount = getConfigDefaultAccount(config);
const defaultAccount = getConfigDefaultAccount();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

getConfigDefaultAccount doesn't take any arguments--the power of TypeScript!

Copy link
Contributor

@camden11 camden11 left a comment

Choose a reason for hiding this comment

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

Looking good! Just a few minor comments

lib/prompts/accountNamePrompt.ts Outdated Show resolved Hide resolved
lib/prompts/accountNamePrompt.ts Outdated Show resolved Hide resolved
lib/prompts/accountNamePrompt.ts Outdated Show resolved Hide resolved
@kemmerle kemmerle mentioned this pull request Nov 26, 2024
1 task
Copy link
Contributor

@camden11 camden11 left a comment

Choose a reason for hiding this comment

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

One tiny thing I noticed but otherwise LGTM

commands/account/remove.ts Outdated Show resolved Hide resolved
@kemmerle kemmerle merged commit aab3260 into next Dec 3, 2024
1 check passed
@kemmerle kemmerle deleted the convert/ts4 branch December 3, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants