Skip to content

Commit

Permalink
chore: move generator aliases to its own file as in the generated pro…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
JavierCane committed Jun 22, 2024
1 parent be9ccbb commit df5f9de
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ If you use macOS, we would recommend using SDKMAN! to manage different JDK versi
- 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 the `src/main/scala/` and `src/test/scala/` folders you will be able to code right in `src/main/` and `src/test/` ones.
- [`.gitignore`](src/main/g8/.gitignore): Avoid including particular ignore rules for any specific IDE or OS. They must be included in [your global Git config](https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer) saving that noise from the project-specific rules.
- Include [SBT aliases for common tasks](src/main/g8/build.sbt). You will be able to run your tests with `t`, compile with `c`, or run all the tasks needed to execute before doing a Git push (compile source and test, and check source and test code style) with `prep`
- Include [SBT aliases for common tasks](src/main/g8/project/SbtAliases.scala). You will be able to run your tests with `t`, compile with `c`, or run all the tasks needed to execute before doing a Git push (compile source and test, and check source and test code style) with `prep`
## 🤽‍ Pre-push Git hook
Expand Down
19 changes: 3 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,6 @@ lazy val root = (project in file("."))
)(Resolver.ivyStylePatterns)
)

/** ********* COMMANDS ALIASES ******************/
addCommandAlias("t", "test")
addCommandAlias("to", "testOnly")
addCommandAlias("tq", "testQuick")
addCommandAlias("tsf", "testShowFailed")

addCommandAlias("c", "compile")
addCommandAlias("tc", "Test / compile")

addCommandAlias("f", "scalafmt") // Format production files according to ScalaFmt
addCommandAlias("fc", "scalafmtCheck") // Check if production files are formatted according to ScalaFmt
addCommandAlias("tf", "Test / scalafmt") // Format test files according to ScalaFmt
addCommandAlias("tfc", "Test / scalafmtCheck") // Check if test files are formatted according to ScalaFmt

// All the needed tasks before pushing to the repository (compile, compile test, format check in prod and test)
addCommandAlias("prep", ";c;tc;fc;tfc")
SbtAliases.aliases.flatMap { case (alias, command) =>
addCommandAlias(alias, command)
}
15 changes: 15 additions & 0 deletions project/SbtAliases.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
object SbtAliases {
val aliases: Seq[(String, String)] = Seq(
"t" -> "test",
"to" -> "testOnly",
"tq" -> "testQuick",
"tsf" -> "testShowFailed",
"c" -> "compile",
"tc" -> "Test / compile",
"f" -> "scalafmt", // Format production files according to ScalaFmt
"fc" -> "scalafmtCheck", // Check if production files are formatted according to ScalaFmt
"tf" -> "Test / scalafmt", // Format test files according to ScalaFmt
"tfc" -> "Test / scalafmtCheck", // Check if test files are formatted according to ScalaFmt
"prep" -> ";c;tc;fc;tfc" // All the needed tasks before pushing to the repository (compile, compile test, format check in prod and test)
)
}

0 comments on commit df5f9de

Please sign in to comment.