diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 700607719..4349d0156 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: with: fetch-depth: 0 - name: Setup Java - uses: actions/setup-java@v3.1.1 + uses: actions/setup-java@v3.4.1 with: distribution: temurin java-version: 17 @@ -43,7 +43,7 @@ jobs: with: fetch-depth: 0 - name: Setup Java - uses: actions/setup-java@v3.1.1 + uses: actions/setup-java@v3.4.1 with: distribution: temurin java-version: ${{ matrix.java }} @@ -53,9 +53,26 @@ jobs: - name: Run tests run: ./sbt ++${{ matrix.scala }}! test + website: + runs-on: ubuntu-20.04 + timeout-minutes: 10 + steps: + - name: Checkout current branch + uses: actions/checkout@v3.0.2 + - name: Setup Java + uses: actions/setup-java@v3.4.1 + with: + distribution: temurin + java-version: 17 + check-latest: true + - name: Cache scala dependencies + uses: coursier/cache-action@v6 + - name: Check Website Generation + run: ./sbt docs/docusaurusCreateSite + ci: runs-on: ubuntu-20.04 - needs: [lint, test] + needs: [lint, test, website] steps: - name: Aggregate outcomes run: echo "build succeeded" diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml new file mode 100644 index 000000000..ba1195054 --- /dev/null +++ b/.github/workflows/site.yml @@ -0,0 +1,27 @@ +name: Website + +on: + push: + branches: + - 'main' + release: + types: + - published + +jobs: + publish: + runs-on: ubuntu-20.04 + timeout-minutes: 30 + steps: + - name: Checkout current branch + uses: actions/checkout@v3 + - name: Setup Java + uses: actions/setup-java@v3.4.1 + with: + distribution: temurin + java-version: 17 + check-latest: true + - name: Publish the site + run: ./sbt docs/docusaurusPublishGhpages + env: + GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }} diff --git a/build.sbt b/build.sbt index 185948834..96b302511 100644 --- a/build.sbt +++ b/build.sbt @@ -37,3 +37,20 @@ lazy val example = .settings( publish / skip := true ) + +lazy val docs = + project + .in(file("modules/zio-elasticsearch-docs")) + .enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin) + .dependsOn(library) + .settings( + publish / skip := true, + moduleName := "zio-elasticsearch-docs", + scalacOptions -= "-Yno-imports", + scalacOptions -= "-Xfatal-warnings", + ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(library), + ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api", + cleanFiles += (ScalaUnidoc / unidoc / target).value, + docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value, + docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(Compile / unidoc).value + ) diff --git a/docs/about/code_of_conduct.md b/docs/about/code_of_conduct.md new file mode 100644 index 000000000..22bc88c99 --- /dev/null +++ b/docs/about/code_of_conduct.md @@ -0,0 +1,135 @@ +--- +id: about_code_of_conduct +title: "Code of Conduct" +--- + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +support@lambdaworks.io. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/docs/about/contributing.md b/docs/about/contributing.md new file mode 100644 index 000000000..43f32c698 --- /dev/null +++ b/docs/about/contributing.md @@ -0,0 +1,37 @@ +--- +id: about_contributing +title: "Contributing" +--- + +We welcome contributions from anybody wishing to participate. All code or documentation that is provided must be licensed under [Apache 2.0](https://github.com/lambdaworks/zio-elasticsearch/blob/main/LICENSE). + +## General Workflow + +1. Make sure you can license your work under Apache 2.0. + +2. Before starting work, make sure there is a ticket on the issue, and if not, make sure to create one. It can help accelerate the acceptance process if the change is agreed upon. + +3. If you don't have write access to the repository, you should do your work on a local branch of your own fork. If you do have write access to the repository, you should avoid working directly on the main branch. + +4. When your work is completed, verify it with following commands: + +``` +sbt check +sbt +test +``` + +5. Submit a Pull Request. + +6. Anyone can comment on a Pull Request, and you are expected to answer questions or to incorporate feedback. + +## General Guidelines + +- We recommend for the work to be accompanied by unit tests. + +- The commit messages should be clear and short, and if more details are needed, specify a body. + +- Follow the structure of the code in this repository, and the formatting rules used. You can format your code properly with the following command: + +``` +sbt prepare +``` \ No newline at end of file diff --git a/docs/about/index.md b/docs/about/index.md new file mode 100644 index 000000000..f14c48056 --- /dev/null +++ b/docs/about/index.md @@ -0,0 +1,6 @@ +--- +id: about_index +title: "About ZIO Elasticsearch" +--- + +TBD diff --git a/docs/overview/index.md b/docs/overview/index.md new file mode 100644 index 000000000..9a0c002f5 --- /dev/null +++ b/docs/overview/index.md @@ -0,0 +1,6 @@ +--- +id: overview_index +title: "Summary" +--- + +TBD diff --git a/project/plugins.sbt b/project/plugins.sbt index 9eacac08d..5ace8b075 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,4 @@ -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3") +addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") diff --git a/website/babel.config.js b/website/babel.config.js new file mode 100644 index 000000000..e00595dae --- /dev/null +++ b/website/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: [require.resolve('@docusaurus/core/lib/babel/preset')], +}; diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js new file mode 100644 index 000000000..3e61faaa3 --- /dev/null +++ b/website/docusaurus.config.js @@ -0,0 +1,105 @@ +const lightCodeTheme = require('prism-react-renderer/themes/github'); +const darkCodeTheme = require('prism-react-renderer/themes/dracula'); + +const config = { + title: 'ZIO Elasticsearch', + tagline: 'Elasticsearch client for ZIO', + url: 'https://lambdaworks.github.io', + baseUrl: '/zio-elasticsearch/', + onBrokenLinks: 'throw', + onBrokenMarkdownLinks: 'warn', + favicon: 'img/favicon.png', + organizationName: 'lambdaworks', + projectName: 'zio-elasticsearch', + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + presets: [ + [ + 'classic', + ({ + docs: { + path: '../modules/zio-elasticsearch-docs/target/mdoc', + routeBasePath: '/', + sidebarPath: require.resolve('./sidebars.js'), + editUrl: + ({ docPath }) => `https://github.com/lambdaworks/zio-elasticsearch/edit/main/docs/${docPath}` + }, + blog: false, + theme: { + customCss: require.resolve('./src/css/custom.css') + } + }) + ] + ], + themeConfig: + ({ + navbar: { + title: 'ZIO Elasticsearch', + logo: { + alt: 'lambdaworks', + src: 'img/logo.svg', + srcDark: 'img/logo-dark.svg', + }, + items: [ + { + type: 'doc', + docId: 'overview/overview_index', + position: 'right', + label: 'Overview' + }, + { + type: 'doc', + docId: 'about/about_index', + position: 'right', + label: 'About' + }, + { + href: 'https://github.com/lambdaworks/zio-elasticsearch', + label: 'GitHub', + position: 'right' + } + ] + }, + footer: { + style: 'dark', + logo: { + alt: 'lambdaworks', + src: 'img/logo-footer.svg', + href: 'https://www.lambdaworks.io/' + }, + links: [ + { + title: 'GitHub', + items: [ + { + html: ` + + github + + ` + } + ] + }, + { + title: 'Additional resources', + items: [ + { + label: 'Scaladoc of ZIO Elasticsearch', + to: 'pathname:///zio-elasticsearch/api/' + } + ] + } + ], + copyright: `Copyright © ${new Date().getFullYear()} LambdaWorks d.o.o.` + }, + prism: { + theme: lightCodeTheme, + darkTheme: darkCodeTheme, + additionalLanguages: ['java', 'scala'] + } + }) +}; + +module.exports = config; diff --git a/website/package.json b/website/package.json new file mode 100644 index 000000000..c2f371088 --- /dev/null +++ b/website/package.json @@ -0,0 +1,44 @@ +{ + "name": "website", + "version": "0.0.0", + "private": true, + "scripts": { + "docusaurus": "docusaurus", + "start": "docusaurus start", + "build": "docusaurus build", + "swizzle": "docusaurus swizzle", + "deploy": "docusaurus deploy", + "clear": "docusaurus clear", + "serve": "docusaurus serve", + "write-translations": "docusaurus write-translations", + "write-heading-ids": "docusaurus write-heading-ids", + "publish-gh-pages": "docusaurus deploy" + }, + "dependencies": { + "@docusaurus/core": "2.0.1", + "@docusaurus/preset-classic": "2.0.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.0.1" + }, + "browserslist": { + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "engines": { + "node": ">=16.14" + } +} diff --git a/website/sidebars.js b/website/sidebars.js new file mode 100644 index 000000000..ebde4a8ba --- /dev/null +++ b/website/sidebars.js @@ -0,0 +1,8 @@ +module.exports = { + about_sidebar: + [ + 'about/about_index', + 'about/about_contributing', + 'about/about_code_of_conduct' + ] +} diff --git a/website/src/css/custom.css b/website/src/css/custom.css new file mode 100644 index 000000000..28b29b973 --- /dev/null +++ b/website/src/css/custom.css @@ -0,0 +1,22 @@ +:root { + --ifm-color-primary: #2958a8; + --ifm-color-primary-dark: #254f97; + --ifm-color-primary-darker: #234b8f; + --ifm-color-primary-darkest: #214686; + --ifm-color-primary-light: #2d61b9; + --ifm-color-primary-lighter: #2f65c1; + --ifm-color-primary-lightest: #326acb; + --ifm-code-font-size: 95% + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); +} + +[data-theme='dark'] { + --ifm-color-primary: #80aeff; + --ifm-color-primary-dark: #5a96ff; + --ifm-color-primary-darker: #4789ff; + --ifm-color-primary-darkest: #337dff; + --ifm-color-primary-light: #a6c6ff; + --ifm-color-primary-lighter: #b9d3ff; + --ifm-color-primary-lightest: #cddfff; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); +} diff --git a/website/src/pages/index.js b/website/src/pages/index.js new file mode 100644 index 000000000..4b383076c --- /dev/null +++ b/website/src/pages/index.js @@ -0,0 +1,36 @@ +import React from 'react'; +import clsx from 'clsx'; +import Link from '@docusaurus/Link'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import Layout from '@theme/Layout'; + +import styles from './index.module.css'; + +function HomepageHeader() { + const {siteConfig} = useDocusaurusContext(); + return ( +
+
+

{siteConfig.title}

+

{siteConfig.tagline}

+
+ + Overview + +
+
+
+ ); +} + +export default function Home() { + const {siteConfig} = useDocusaurusContext(); + return ( + + + + ); +} diff --git a/website/src/pages/index.module.css b/website/src/pages/index.module.css new file mode 100644 index 000000000..9f71a5da7 --- /dev/null +++ b/website/src/pages/index.module.css @@ -0,0 +1,23 @@ +/** + * CSS files with the .module.css suffix will be treated as CSS modules + * and scoped locally. + */ + +.heroBanner { + padding: 4rem 0; + text-align: center; + position: relative; + overflow: hidden; +} + +@media screen and (max-width: 996px) { + .heroBanner { + padding: 2rem; + } +} + +.buttons { + display: flex; + align-items: center; + justify-content: center; +} diff --git a/website/static/.nojekyll b/website/static/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/website/static/img/favicon.png b/website/static/img/favicon.png new file mode 100644 index 000000000..feec22943 Binary files /dev/null and b/website/static/img/favicon.png differ diff --git a/website/static/img/logo-dark.svg b/website/static/img/logo-dark.svg new file mode 100644 index 000000000..bc6eed346 --- /dev/null +++ b/website/static/img/logo-dark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/website/static/img/logo-footer.svg b/website/static/img/logo-footer.svg new file mode 100644 index 000000000..f06ad5bea --- /dev/null +++ b/website/static/img/logo-footer.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/website/static/img/logo.svg b/website/static/img/logo.svg new file mode 100644 index 000000000..6ad1a5290 --- /dev/null +++ b/website/static/img/logo.svg @@ -0,0 +1,5 @@ + + + + +