jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.26k stars 508 forks source link

Feature request: do git init with create command #755

Open capaj opened 4 years ago

capaj commented 4 years ago

Would be nice if tsdx could also run this git init command for me while calling tsdx create mylib. I know there are people out there who use other version control systems, but for them, could we introduce a flag --noGitInit or something like that?

agilgur5 commented 4 years ago

We do have some git specific references in the code as well as use of gitignore in templates and use of git hooks via Husky, so I think it's reasonable to do so and optimize for the case that is likely the vast majority of usage. Although the first ref is behind an if statement, gitignore is harmless, and there's #419 to install without Husky which is very highly requested.

This feature I think will run into the same issue as #419 for monorepos as well as existing repos more generally. So a PR for this should check if already inside a git repo and only perform git init if not inside one.

Per https://github.com/formium/tsdx/issues/438#issuecomment-578110253, the eventual plan is to have a command like tsdx add that allows for easier adoption in existing repos as well as partial adoption of TSDX. So I would probably suggest using that over the flag sprawl that would be various --no flags for every use-case. create can be reserved for an opinionated workflow. There are some trade-offs with that too (e.g. how granular is add?) so there's more to think about on that front though.

agilgur5 commented 4 years ago

Related: https://github.com/facebook/create-react-app/issues/8280