Template for bootstrapping your new Scala project following idiomatic best practices powered by Giter 8.
π‘ Related resources | π Repository Stargazers
Run the following command and you're ready to go:
sbt new codelytv/scala-basic-skeleton.g8
You can now move to your project's directory, enter the SBT shell with the sbt
command, and run the tests with test
or t
.
It will ask for some parameters like your desired project name or the organization to customize the generated project package name.
It will also ask for the version of some dependencies such as Scala (the language itself), SBT, or ScalaTest. If you do not know which version to choose for any of these dependencies, just go with the default one. These suggestions are dynamically generated based on the latest stable version available in Maven at the moment of creating your project ππ€
You only need the common tooling used for developing Scala applications:
Installing instructions for macOS with SDKMAN!
If you use macOS, we would recommend using SDKMAN! to manage different JDK versions and tooling:
- Install SDKMAN with homebrew
- Install the JDK you prefer. If you ask us, we will opt for:
- Check the latest Java LTS JDK version
- Check the latest Zulu distribution version for that LTS with:
sdk list java
- Install it:
sdk install java XX.YY.ZZ-zulu
- Install the latest SBT:
sdk install sbt
- Permissive
LICENSE
: Allow using projects created with this template for commercial and private purposes. - Continuous Integration for the template: Use GitHub Actions to validate every commit merging to
main
to guarantee correctness. - Complete
README.md
example: Include badges for CI status and other fancy stuff. - Latest versions of Scala, SBT and ScalaTest. Always: They are dynamically suggested based on the latest stable version available while creating your project.
- Minimum dependencies: Just the most common for starting up, and you can delete them in your
build.sbt
once the project has been created:- ScalaTest: Test runner.
- ScalaMock: Test doubles generator.
- nscala-time: Commonly used library wrapping Joda Time offering a Scala-friendly API like:
2.hours + 45.minutes
. - pprint: Much better than
System.out.println(x.toString)
.
- Other ecosystem tools already configured to follow idiomatic best practices:
- Scalafmt Code formatter: Already configured following idiomatic best practices.
- EditorConfig: Ready to follow Scala conventions.
- Opinions:
- Configured to avoid the
scala/
default subdirectory because we don't want to split source code by programming language. That is, instead of having thesrc/main/scala/
andsrc/test/scala/
folders you will be able to code right insrc/main/
andsrc/test/
ones. .gitignore
: Avoid including particular ignore rules for any specific IDE or OS. They must be included in your global Git config saving that noise from the project-specific rules.- Include SBT aliases for common tasks. You will be able to run your tests with
t
, compile withc
, or run all the tasks needed to execute before doing a Git push (compile source and test, and check source and test code style) withprep
- Configured to avoid the
There's one Git hook included. It's inside the doc/hooks
folder, and it will run the prep
SBT task before pushing to any remote.
This prep
task is intended to run all the checks you consider before pushing.
At this very moment, it tries to compile and check the code style rules with ScalaFmt.
You can define what this task does by modifying the prep
task in the build.sbt
file.
We like the approach of just having to run 1 single SBT task instead of multiple tasks because it's more efficient (the hook doesn't have to create multiple SBT sessions), and also because this way we can control the pre push tasks with the SBT alias defined at the build.sbt
without altering the hooks.
If you want to install this hook, just cd doc/hooks
and run ./install-hooks.sh
.
- π± TypeScript Basic Skeleton
- πΈοΈ TypeScript Web Skeleton
- π TypeScript API Skeleton
- β¨ TypeScript DDD Skeleton
- π― TypeScript DDD Example
See LICENSE
.
See CONTRIBUTING.md
.
This hopefully helpful resource has been developed by Codely and contributors.
If you appreciate this contribution and want to show some support to our Open Source contributions, you have several options:
- Without leaving GitHub:
- Give a star to this repository and be listed as a stargazer
- Follow CodelyTV on GitHub
- Follow us on other social networks:
- Sponsoring our work: