Skip to content

Unofficial giter8 template for scala3/sbt cli and servers using typelevel stack

Notifications You must be signed in to change notification settings

acando86/scala3.ce3.g8

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala3.ce3.g8

Scala CI

Unofficial opinionated Giter8 template for sbt-based scala 3 projects making usage of the typelevel stack. The template can be helpful for both web servers and CLIs.

Run

Using sbt

Assuming sbt is available, generate a new project using

sbt new [email protected]:alessandrocandolini/scala3.ce3.g8.git  --name=<project name>

or from a local clone of this repo

sbt new file:///<local-checkout-dir>/scala3.ce3.g8/  --name=<project name>

Using g8

On MAC OS X, Giter8 is available via the Homebrew package manager:

brew update
brew install giter8

For more options, refer to the original documentation http://www.foundweekends.org/giter8/setup.html

Once g8 is installed on the machine (see next section), it is also possible to generate a new project from a local clone of the repo

g8 file:///<local-checkout-dir>/scala3.ce3.g8/ --name=<project name>

See http://www.foundweekends.org/giter8/usage.html#Usage for more details

Description

The generated project includes the following dependencies:

the following sbt-plugins:

and will setup opinionated compiler options, eg, -language:strictEquality", -Yexplicit-nulls, -source:future, etc.

The generated project is setup to run unit and integration tests (with sbt test and sbt it:test respectively)

The generated project contains a simple .github/workflow/scala.yml configuration to setup github actions to run sbt assembly. It's a very basic setup, completely independent from the scala project. If you are not using github, just remove the .github folder. If you want a more advanced setup, you might be interested in exploring sbt-github-actions.

Todo

  • the CI is relying on g8test, unfortunately this does not easily detect issues like An unexpected error occurred while processing the template. Check that all literal '$' are properly escaped with '\$' due to foundweekends/giter8#334
  • scaffolding (to generate a cli or a server)
  • improve github actions pipeline
  • consider using make-g8

Giter8 crash course

  • Giter8 generates a project that has exactly the same structure of the src/main/g8 folder
  • template variables are defined in the default.properties file
  • template variables can be accessed as $name of the variable$ (ie, between $) from everywhere
  • $ is the reserved symbol, whenever you need to use a $ for purposes other than referring to a template variable be sure to escape it as \$; this is a typical source of errors

A more comprehensive guide here: http://www.foundweekends.org/giter8/Contents+in+Depth.html

Template license

Written in 2021 by Alessandro Candolini [email protected]

To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this template to the public domain worldwide. This template is distributed without any warranty. See http://creativecommons.org/publicdomain/zero/1.0/.

About

Unofficial giter8 template for scala3/sbt cli and servers using typelevel stack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 94.2%
  • Dockerfile 5.8%