JoshuaKGoldberg / create-typescript-app

Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝
MIT License
1.2k stars 75 forks source link

🛠 Tooling: can --bin be used to create CLI tools? #1677

Closed johnnyreilly closed 1 week ago

johnnyreilly commented 2 weeks ago

Bug Report Checklist

Overview

I write CLI tools with TypeScript. I've started trying to use CTA for this and realised that either the bin functionality doesn't create all the src/bin code that CTA itself has built in. I'm assuming this is deliberate?

Either way, I'm just about to (for the second time) copy paste src/bin code into a project I'm starting as it's so gosh darn useful!

Does CTA create this stuff if you just do it the right way? I can see a --bin option here:

https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/docs/Options.md#optional-options

But it doesn't appear to do anything more than package.json fiddling. Am I getting this right?

Additional Info

-

JoshuaKGoldberg commented 2 weeks ago

That's correct, it doesn't create the bin/ file. The contents of that file are up to you based on how you'd like to structure your API. This would be a good thing to mention in the docs!

johnnyreilly commented 1 week ago

Awesome - I'll try and add that soon. Follow up question:

I've now scaffolded out my second CLI app borrowing heavily from CTAs bin internals (you can see it here: https://github.com/johnnyreilly/ado-npm-auth-lite) and I've found all the bin stuff really handy!

Is there a desire that bin mode could include this code deliberately, rather than the copy / pasta that I've been doing?

JoshuaKGoldberg commented 1 week ago

I think it'd be best to not 😞. Having a standard unified set would be really nice. But this is edging into enforcing opinions on how folks structure their apps. Decisions like "export a bin from src/bin/index.ts" is a pretty specific thing.

github-actions[bot] commented 20 hours ago

:tada: This is included in version v1.73.5 :tada:

The release is available on:

Cheers! 📦🚀