From ac2ae9b1a0f70a465400c5d9e54945715ecd1d4d Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Fri, 27 Nov 2020 10:24:47 +0000 Subject: [PATCH 1/3] Add material theme to paradox --- README.md | 2 +- build.sbt | 14 +++++++++----- docs/src/{main/paradox => }/index.md | 13 ++++++++++--- project/plugins.sbt | 1 + 4 files changed, 21 insertions(+), 9 deletions(-) rename docs/src/{main/paradox => }/index.md (96%) diff --git a/README.md b/README.md index 0c917524..8785db19 120000 --- a/README.md +++ b/README.md @@ -1 +1 @@ -docs/src/main/paradox/index.md \ No newline at end of file +docs/src/index.md \ No newline at end of file diff --git a/build.sbt b/build.sbt index 0eaaa7a7..791871ea 100644 --- a/build.sbt +++ b/build.sbt @@ -79,19 +79,23 @@ lazy val root = project .settings(scalaVersion := "2.13.4") lazy val docs = project - .enablePlugins(ParadoxPlugin, MdocPlugin, NoPublishPlugin) + .enablePlugins(ParadoxPlugin, ParadoxMaterialThemePlugin, MdocPlugin, NoPublishPlugin) .settings( name := "paradox-docs", libraryDependencies += jawnAst, - paradoxTheme := Some(builtinParadoxTheme("generic")), paradoxProperties in Compile ++= Map( "empty" -> "", "version" -> version.value ), githubWorkflowArtifactUpload := false, - mdocIn := (paradox / sourceDirectory).value, - paradox / sourceManaged := mdocOut.value, - Compile / paradox := (Compile / paradox).dependsOn(mdoc.toTask("")).value + mdocIn := (Compile / baseDirectory).value / "src", + Compile / paradox / sourceDirectory := mdocOut.value, + Compile / paradox := (Compile / paradox).dependsOn(mdoc.toTask("")).value, + Compile / paradoxMaterialTheme := ParadoxMaterialTheme() + .withColor("red", "orange") + .withFont("Ubuntu", "Ubuntu Mono") + .withCopyright("Copyright (c) 2020 Typelevel") + .withRepository(uri("https://github.com/typelevel/cats-parse")) ) .dependsOn(coreJVM, bench) diff --git a/docs/src/main/paradox/index.md b/docs/src/index.md similarity index 96% rename from docs/src/main/paradox/index.md rename to docs/src/index.md index 4c3aa4e6..806b1f87 100644 --- a/docs/src/main/paradox/index.md +++ b/docs/src/index.md @@ -4,9 +4,15 @@ A parsing library for the cats ecosystem. -To use in sbt add, the following to your `libraryDependencies`: -* `"org.typelevel" %% "cats-parse" % "0.1.0"` -* or `"org.typelevel" %%% "cats-parse" % "0.1.0"` in a Scala.js project. +To use in sbt add, the following to your `libraryDependencies`: + +```scala +// use this snippet for the JVM +libraryDependencies += "org.typelevel" %% "cats-parse" % "0.1.0" + +// use this snippet for JS, or cross-building +libraryDependencies += "org.typelevel" %%% "cats-parse" % "0.1.0" +``` The [API docs](https://oss.sonatype.org/service/local/repositories/releases/archive/org/typelevel/cats-parse_2.12/0.0.1/cats-parse_2.12-0.0.1-javadoc.jar/!/cats/parse/index.html) are published. @@ -25,6 +31,7 @@ this library has a few goals: Below is most of a json parser (the string unescaping is elided). This example can give you a feel for what it is like to use this library. + ```scala mdoc:invisible import cats.parse.bench.self.JsonStringUtil ``` diff --git a/project/plugins.sbt b/project/plugins.sbt index a2fd8cbe..75c6f75c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,3 +9,4 @@ addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.19.1") addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.9.5") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13") +addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0") From 1500f47bb864f69b88eaf8dc670b023f26f7d239 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Mon, 7 Dec 2020 13:59:36 +0000 Subject: [PATCH 2/3] Add paradox site publish on release --- .github/workflows/ci.yml | 8 ++++++++ build.sbt | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60d70950..962dabaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,6 +147,14 @@ jobs: - run: sbt ++${{ matrix.scala }} release + - run: sbt ++${{ matrix.scala }} docs/paradox + + - uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: docs/target/paradox/site/main + build-docs: name: Build docs strategy: diff --git a/build.sbt b/build.sbt index 791871ea..cfcc483a 100644 --- a/build.sbt +++ b/build.sbt @@ -59,6 +59,20 @@ ThisBuild / githubWorkflowAddedJobs ++= Seq( ) ) +ThisBuild / githubWorkflowPublish ++= Seq( + WorkflowStep.Sbt(List("docs/paradox")), + WorkflowStep.Use( + "JamesIves", + "github-pages-deploy-action", + "3.7.1", + params = Map( + "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}", + "BRANCH" -> "gh-pages", + "FOLDER" -> "docs/target/paradox/site/main" + ) + ) +) + ThisBuild / homepage := Some(url("https://github.com/typelevel/cats-parse")) ThisBuild / scmInfo := Some( From 3341f47b19c7daaa5bce7112fa573746e5580022 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Mon, 7 Dec 2020 17:48:51 +0000 Subject: [PATCH 3/3] Add sbt-site and sbt-ghpages --- .github/workflows/ci.yml | 4 ++-- build.sbt | 13 ++++++++++--- project/plugins.sbt | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 962dabaf..0f4a77df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,13 +147,13 @@ jobs: - run: sbt ++${{ matrix.scala }} release - - run: sbt ++${{ matrix.scala }} docs/paradox + - run: sbt ++${{ matrix.scala }} docs/makeSite - uses: JamesIves/github-pages-deploy-action@3.7.1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages - FOLDER: docs/target/paradox/site/main + FOLDER: docs/target/site build-docs: name: Build docs diff --git a/build.sbt b/build.sbt index cfcc483a..ebcf3e3c 100644 --- a/build.sbt +++ b/build.sbt @@ -60,7 +60,7 @@ ThisBuild / githubWorkflowAddedJobs ++= Seq( ) ThisBuild / githubWorkflowPublish ++= Seq( - WorkflowStep.Sbt(List("docs/paradox")), + WorkflowStep.Sbt(List("docs/makeSite")), WorkflowStep.Use( "JamesIves", "github-pages-deploy-action", @@ -68,7 +68,7 @@ ThisBuild / githubWorkflowPublish ++= Seq( params = Map( "GITHUB_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}", "BRANCH" -> "gh-pages", - "FOLDER" -> "docs/target/paradox/site/main" + "FOLDER" -> "docs/target/site" ) ) ) @@ -93,7 +93,13 @@ lazy val root = project .settings(scalaVersion := "2.13.4") lazy val docs = project - .enablePlugins(ParadoxPlugin, ParadoxMaterialThemePlugin, MdocPlugin, NoPublishPlugin) + .enablePlugins( + ParadoxSitePlugin, + ParadoxMaterialThemePlugin, + MdocPlugin, + NoPublishPlugin, + GhpagesPlugin + ) .settings( name := "paradox-docs", libraryDependencies += jawnAst, @@ -102,6 +108,7 @@ lazy val docs = project "version" -> version.value ), githubWorkflowArtifactUpload := false, + git.remoteRepo := "git@github.com:typelevel/cats-parse.git", mdocIn := (Compile / baseDirectory).value / "src", Compile / paradox / sourceDirectory := mdocOut.value, Compile / paradox := (Compile / paradox).dependsOn(mdoc.toTask("")).value, diff --git a/project/plugins.sbt b/project/plugins.sbt index 75c6f75c..73df7a13 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,3 +10,5 @@ addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.9.5") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13") addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0") +addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1") +addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")