Skip to content

Commit df5f9de

Browse files
committed
chore: move generator aliases to its own file as in the generated project
1 parent be9ccbb commit df5f9de

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ If you use macOS, we would recommend using SDKMAN! to manage different JDK versi
8989
- Opinions:
9090
- 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.
9191
- [`.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.
92-
- 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`
92+
- 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`
9393
9494
## 🤽‍ Pre-push Git hook
9595

build.sbt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ lazy val root = (project in file("."))
1919
)(Resolver.ivyStylePatterns)
2020
)
2121

22-
/** ********* COMMANDS ALIASES ******************/
23-
addCommandAlias("t", "test")
24-
addCommandAlias("to", "testOnly")
25-
addCommandAlias("tq", "testQuick")
26-
addCommandAlias("tsf", "testShowFailed")
27-
28-
addCommandAlias("c", "compile")
29-
addCommandAlias("tc", "Test / compile")
30-
31-
addCommandAlias("f", "scalafmt") // Format production files according to ScalaFmt
32-
addCommandAlias("fc", "scalafmtCheck") // Check if production files are formatted according to ScalaFmt
33-
addCommandAlias("tf", "Test / scalafmt") // Format test files according to ScalaFmt
34-
addCommandAlias("tfc", "Test / scalafmtCheck") // Check if test files are formatted according to ScalaFmt
35-
36-
// All the needed tasks before pushing to the repository (compile, compile test, format check in prod and test)
37-
addCommandAlias("prep", ";c;tc;fc;tfc")
22+
SbtAliases.aliases.flatMap { case (alias, command) =>
23+
addCommandAlias(alias, command)
24+
}

project/SbtAliases.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
object SbtAliases {
2+
val aliases: Seq[(String, String)] = Seq(
3+
"t" -> "test",
4+
"to" -> "testOnly",
5+
"tq" -> "testQuick",
6+
"tsf" -> "testShowFailed",
7+
"c" -> "compile",
8+
"tc" -> "Test / compile",
9+
"f" -> "scalafmt", // Format production files according to ScalaFmt
10+
"fc" -> "scalafmtCheck", // Check if production files are formatted according to ScalaFmt
11+
"tf" -> "Test / scalafmt", // Format test files according to ScalaFmt
12+
"tfc" -> "Test / scalafmtCheck", // Check if test files are formatted according to ScalaFmt
13+
"prep" -> ";c;tc;fc;tfc" // All the needed tasks before pushing to the repository (compile, compile test, format check in prod and test)
14+
)
15+
}

0 commit comments

Comments
 (0)