$ show scala-text/scala_text
This repository is the source code for the 'Scala็ ไฟฎใใญในใ' (Scala Training Textbook), a comprehensive Japanese-language textbook for learning the Scala programming language. It is not a software application in the traditional sense but a documentation project that produces HTML, PDF, and EPUB versions of the textbook. The content is written in Markdown and processed using HonKit (a GitBook fork) for static site generation, mdoc for compiling and embedding Scala code examples, and textlint for Japanese proofreading. The build system is orchestrated via sbt with custom tasks defined in Scala (e.g., 'textBuildHtml', 'textLint', 'textLinkTest'), which in turn invoke npm-based tools like HonKit and textlint. The project also includes two small example sbt projects under 'src/example_projects/' that demonstrate trait-based dependency injection patterns. Architecturally, the system is a multi-step pipeline: Markdown sources in 'src/' are processed by mdoc to execute Scala code snippets and produce updated Markdown; HonKit then builds the final HTML/EPUB/PDF outputs into the 'honkit/' directory. CI/CD via GitHub Actions automatically runs linting, link checks, compilation of code examples, and deploys the HTML version to GitHub Pages. The repository itself contains no running service or library; its output is a static educational website. Key entry points are the sbt tasks defined in 'build.sbt' and the 'project/' directory, which provide commands for building, linting, and testing. External dependencies include sbt 2.0.9, Scala 3.8.4, HonKit 6.2.2, various npm packages (e.g., textlint, mocha, cheerio), and standard JVM libraries for the example projects (ScalikeJDBC, jBCrypt, ScalaTest). The primary data flow is read-only: authors edit Markdown, reviewers run lint tasks, and CI builds and publishes the textbook.
The LLM identified 2 files worth highlighting for reuse:
A reusable trait providing a common base for sbt tasks that run npm-based tools (e.g., HonKit, textlint, mocha). It defines paths, a helper to run shell commands, and a parser for raw string arguments. While tightly coupled to the project's directory structure, the pattern of wrapping npm commands in sbt tasks is clean and could be extracted into a reusable sbt plugin for documentation projects.
Demonstrates a clean dependency injection pattern using Scala traits and self-type annotations. The UserService trait declares self-type dependencies on PasswordService and UserRepository, allowing the concrete class UserServiceImpl to mix in implementations. This pattern improves testability (as shown in the spec) and modularity, and is a classic example of the cake pattern in Scala.