MiniScaffold, setting up a new F# project the easy way
Setting up a new project can be a pain. Especially if you want to split it into separate folders for clarity. You might want a src
folder for the project itself, a test
folder for the unit and integration tests, a docs
folder for documentation. You are writing documentation for your work, right?
If you're writing in F# you've probably long ago moved from NuGet to Paket, but the standard .NET templates still use NuGet so that has to be migrated. There's build scripts to write too. It could be an hour or more of work before you start working on the code you actually wanted to write.
Enter MiniScaffold, a dotnet template that is for creating and publishing applications (supporting .NET Core 3.1) and libraries (supporting both .NETStandard 2.1 and .NET Framework 4.6.1
It's designed and built to take care of the humdrum for you, it gives you
- a clean and well separated folder structure
- a matching
.gitignore
file - an
.editorconfig
file tweaked for F# development - configures CI builds on Appveyor (for Windows) and TravisCI (for Linux and macOS)
- fully configured build scripts using FAKE
- integrated package management with Paket
- integrated unit testing (Expecto) and code coverage reports (AltCover/ReportGenerator)
- automatic code formatting with Fantomas
And that's just to get started, also included is a file named CHANGELOG.md
. All you have to do is keep it updated with your notable changes, even reference the associated pull requests for those changes.
The generated build scripts include a Release
action that will parse the CHANGELOG.md
file, create a tag in GitHub with the version number specified, update any pull requests mentioned with the version number, publish a GitHub release for the version and even include any build artifacts in the dist
folder! Doing all that is as easy as typing seven extra characters
# Development build
./build.sh
# Release build
./build.sh Release
It's certainly an opiniated template, if you really wanted to go with a different test library for example, you'd have enough repeated work changing it each time that it would probably be better to fork the github project and customise it yourself. But I'd recommend trying it out first, it becomes second nature and is now my go to template for all F# projects!
To get started, install the template
dotnet new -i "MiniScaffold::*"
Then go with
# I'm building a library
dotnet new mini-scaffold -n MyCoolNewLib --githubUsername MyGithubUsername
# I'm building an application
dotnet new mini-scaffold -n MyCoolNewApp --githubUsername MyGithubUsername -ou console
The author of this template, Jimmy Byrd, has clearly put an incredible amount of effort into this and it is a great example of how creating a template (or any project) to simplify some repetitive task is always worth sharing with the community.