Releasing NRepo, .NET Core Global Tool for simplify repository creation with good defaults for C# projects
.NET Core, .NET Core Global Tools
With the news that GitHub will allow us to have private repos, i have moved all of my new stuff over it.
Because i enjoy the ui and it’s simplicity, and the fact you have to add only a README to welcome your users is simple and nice.
I find myself doing a lot of POC and while adding/creating new repos both on my local machine and on github is trivial; it is time consuming and annoying if after a day of work you want to push your code in a safe place and go home.
Also you have to setup some .gitignore, .gitattributes and .editorconfig, so it’s more stuff to do for each repo.
Therefore, I have created NukedBit.NRepo a simple .NET Core Global Tool, that with an interactive console ui, it will help you get your repository configured and ready to push in matter of seconds.
It only support C# repositories, but I will look soon on how to add support for multiple languages, maybe with some external templates, and with custom local ones you can define.
Also at the moment it will only allow you to create public repositories on github, but in the next few days i will be adding an option for making the repository private.
Beware it’s a new tool and i do not take any responsibility over your data, so be safe and create a local backup of your data.
To install just use the following command.
dotnet tool install --global NukedBit.NRepo --version 0.1.0
If you want to enable the remote creation of the github repository you need to setup the environment variable NREPO_GITHUB_TOKEN with your github token you can follow this guide on how to create one, you just need to select the repo permission and it’s children’s setting https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
You can either run with –n:myawesomerepo to create a repository inside a new folder myawesomerepo or with no value with just –n and it will create it in the current folder, but it will ask for confirmation.
Examples
nrepo -n:myawesomerepo
nrepo -n
How it works
The configuration is done in a few steps:
- After you have chosen the destination path, it will check if the folder is already a git repository, if not it will initialize a new one.
- Next the defaults files will be downloaded, at this time the files are downloaded from the AspNetCore Repository, if the files already exist it will skip them, the files are:
.editorconfig .gitattributes .gitignore - Now it’s time to choose a license, for this the tool will call the github api to list all the licenses, and when you choose yours it will download the license text and save it as LICENSE.
- At this point you can either create a new repository over github or search for an existing one, or just skip the step, when the repository is selected the correct remote url will be set on your local git repository.
- Now you are done
Whats Next
I have in mind a few improvements, like enabling the creation of private repositories and providing templates for other projects type, like Angular, ReactJS etc..
Please give it a try and if you liked it, share it or leave a comment at the bottom of this article. If you find any issue or have a suggestion please send it over github.