Skip to content

Commit

Permalink
Build webpage with Docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrohdezma committed Mar 20, 2023
1 parent c57a626 commit 3d57e69
Show file tree
Hide file tree
Showing 27 changed files with 7,906 additions and 132 deletions.
8 changes: 3 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ThisBuild / pluginCrossBuild / sbtVersion := "1.2.8"
ThisBuild / Test / parallelExecution := false

addCommandAlias("ci-test", "fix --check; mdoc; test; publishLocal; scripted")
addCommandAlias("ci-docs", "github; mdoc; headerCreateAll; publishToGitHubPages")
addCommandAlias("ci-docs", "github; mdoc; headerCreateAll; docusaurusPublishGhpages")
addCommandAlias("ci-publish", "github; ci-release")

val `sbt-mdoc` = "org.scalameta" % "sbt-mdoc" % "[2.0,)" % Provided // scala-steward:off
Expand All @@ -13,14 +13,12 @@ val `sbt-header` = "de.heikoseeberger" % "sbt-header" % "[5.6.0,)" % Provided //

lazy val documentation = project.enablePlugins(MdocPlugin)

lazy val site = project
.enablePlugins(MdocPlugin)
lazy val website = project
.enablePlugins(MdocPlugin, DocusaurusPlugin)
.settings(mdocIn := baseDirectory.value / "docs")
.settings(mdocOut := (Compile / target).value / "mdoc")
.settings(watchTriggers += mdocIn.value.toGlob / "*.md")
.settings(mdocVariables += "EXCLUDED" -> excludedContributors.value.mkString("- ", "\n- ", ""))
.enablePlugins(GitHubPagesPlugin)
.settings(gitHubPagesSiteDir := mdocOut.value)

lazy val `sbt-github` = module
.enablePlugins(SbtPlugin)
Expand Down
2 changes: 2 additions & 0 deletions project/dependencies.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ Compile / unmanagedSourceDirectories ++= Seq(
(ThisBuild / baseDirectory).value.getParentFile / "modules" / "sbt-github-header" / "src" / "main" / "scala",
(ThisBuild / baseDirectory).value.getParentFile / "modules" / "sbt-github" / "src" / "main" / "scala"
)

libraryDependencies += "org.typelevel" %% "jawn-parser" % "1.4.0"
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.2")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("io.kevinlee" % "sbt-github-pages" % "0.12.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-modules" % "0.2.0")
29 changes: 0 additions & 29 deletions site/docs/_coverpage.md

This file was deleted.

20 changes: 0 additions & 20 deletions site/docs/_media/octocat.svg

This file was deleted.

8 changes: 0 additions & 8 deletions site/docs/_sidebar.md

This file was deleted.

65 changes: 0 additions & 65 deletions site/docs/index.html

This file was deleted.

20 changes: 20 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 1
---

# Getting Started

## Installation
Expand Down Expand Up @@ -45,5 +49,5 @@ sbt "github; ci-release"

There are some integrations available also:

- If you use [mdoc](https://scalameta.org/mdoc/) there's also available an [mdoc integration module](sbt-mdoc.md)
- If you use [sbt-header](https://github.com/sbt/sbt-header) there's also available an [sbt-header integration module](sbt-header.md)
- If you use [mdoc](https://scalameta.org/mdoc/) there's also available an [mdoc integration module](integrations/sbt-mdoc.md)
- If you use [sbt-header](https://github.com/sbt/sbt-header) there's also available an [sbt-header integration module](integrations/sbt-header.md)
File renamed without changes.
3 changes: 3 additions & 0 deletions website/docs/integrations/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
label: Integrations
collapsible: true
collapsed: false
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ If you use [sbt-header](https://github.com/sbt/sbt-header) for creating/updating
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "@VERSION@")
```

!> Important! So we don't force a version of sbt-header, it is requested as a ["Provided"](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html) dependency so you'll need to provide your own version of [sbt-header](https://github.com/sbt/sbt-header).
:::note

So we don't force a version of sbt-header, it is requested as a ["Provided"](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html) dependency so you'll need to provide your own version of [sbt-header](https://github.com/sbt/sbt-header).

:::

## What does this integration do?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ If you use [mdoc](https://scalameta.org/mdoc/) for creating your documentation y
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "@VERSION@")
```

!> Important! So we don't force a version of mdoc, it is requested as a ["Provided"](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html) dependency so you'll need to provide your own version of mdoc following [its own tutorial](https://scalameta.org/mdoc/docs/installation.html).
:::note

So we don't force a version of mdoc, it is requested as a ["Provided"](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html) dependency so you'll need to provide your own version of mdoc following [its own tutorial](https://scalameta.org/mdoc/docs/installation.html).

:::

The plugin provides the following `mdocVariables`:

Expand Down
File renamed without changes.
74 changes: 74 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'sbt-github',
tagline: 'SBT plugin to read several settings from Github',
favicon: 'img/favicon.ico',

url: 'https://alejandrohdezma.github.io',
baseUrl: '/sbt-github/',

organizationName: 'alejandrohdezma',
projectName: 'sbt-github',

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

i18n: {
defaultLocale: 'en',
locales: ['en'],
},

presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
path: 'target/mdoc/',
editUrl: params => 'https://github.com/alejandrohdezma/sbt-github/edit/main/site/docs/' + params.docPath,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: 'img/removed_settings.png',
colorMode: {
disableSwitch: true,
respectPrefersColorScheme: true,
},
navbar: {
title: 'sbt-github',
logo: {
alt: 'sbt-github Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'getting-started',
position: 'left',
label: 'Docs',
},
{
href: 'https://github.com/alejandrohdezma/sbt-github',
className: "header-github-link",
"aria-label": "GitHub repository",
position: 'right',
},
],
},
prism: {
theme: require('prism-react-renderer/themes/github'),
darkTheme: require('prism-react-renderer/themes/dracula'),
additionalLanguages: ['java', 'scala'],
},
}),
};

module.exports = config;
28 changes: 28 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"publish-gh-pages": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "2.3.1",
"@docusaurus/preset-classic": "2.3.1",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.3.1"
},
"engines": {
"node": ">=16.14"
}
}
38 changes: 38 additions & 0 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
:root {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}

.header-github-link:hover {
opacity: 0.6;
}

.header-github-link:before {
background: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;
content: "";
display: flex;
height: 24px;
width: 24px;
}

[data-theme='dark'] .header-github-link::before {
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='white' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;
}
Loading

0 comments on commit 3d57e69

Please sign in to comment.