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

🚀 Feature: Enhance/streamline the CLI's startup (mode switching) #884

Closed
3 tasks done
JoshuaKGoldberg opened this issue Sep 24, 2023 · 1 comment · Fixed by #919
Closed
3 tasks done

🚀 Feature: Enhance/streamline the CLI's startup (mode switching) #884

JoshuaKGoldberg opened this issue Sep 24, 2023 · 1 comment · Fixed by #919
Assignees
Labels
status: accepting prs Please, send a pull request to resolve this!

Comments

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Sep 24, 2023

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

Right now, if you npx create-typescript-app in an existing Git repository, you still get:

┌  Welcome to create-typescript-app ! 🎉
│
│  ⚠️ This template is early stage, opinionated, and not endorsed by the TypeScript team. ⚠️
│  ⚠️ If any tooling it sets displeases you, you can always remove that portion manually. ⚠️
│
◆  How would you like to use the template?
│  ○ create a new repository in a child directory
│  ○ initialize a freshly repository in the current directory
│  ● migrate an existing repository in the current directory
└

Seems a little silly. Can't the package figure out only the last one makes sense?

Prior to / as a part of #734, let's make that bit a bit cleaner. Maybe:

  • If already in a Git directory, assume migration mode
  • If in a blank directory, ask whether to create or initialize in the current directory
  • Otherwise (populated directory), ask to create or initialize in a named directory? (allowing either a new one or an existing child one)

Additional Info

No response

@JoshuaKGoldberg JoshuaKGoldberg added the status: accepting prs Please, send a pull request to resolve this! label Sep 24, 2023
@JoshuaKGoldberg JoshuaKGoldberg added this to the Post-Rename Migration milestone Sep 24, 2023
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Sep 24, 2023
JoshuaKGoldberg added a commit that referenced this issue Oct 1, 2023
## PR Checklist

- [x] Addresses an existing open issue: fixes #884
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

Enhances `promptForMode` to give different options based on the current
directory:

* If it's empty, offer to `create` a new repository in it or a child
directory
* If it's a Git directory, offer to `initialize` or `migrate`
* If it's not a Git directory, runs `create` for a new repository in a
child directory

In doing so, adds an optional `--directory` that defaults to the
repository's name.

Also cleans up `getPrefillOrPromptedOption` a bit. Instead of allowing
an `existingValue` parameter, calls to `getPrefillOrPromptedOption` are
just put in the right-hand-side of a `??`.
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

🎉 This is included in version v1.32.0 🎉

The release is available on:

Cheers! 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant