Skip to content

Commit

Permalink
Merge pull request #26 from KacperFKorban/scaladoc
Browse files Browse the repository at this point in the history
Setup scaladoc
  • Loading branch information
KacperFKorban authored Mar 19, 2024
2 parents 1c56b67 + a15c5f9 commit 8e1346e
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/scaladoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: docs

on:
push:
branches: ["main"]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
scaladoc:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Generate GUInep documentation
run: sbt web3/doc

- name: Setup Pages
uses: actions/configure-pages@v2

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'web/target/jvm-3/api'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ lazy val web = projectMatrix
.settings(commonSettings)
.settings(
name := "GUInep-web",
Compile / doc / scalacOptions ++= Seq(
"-siteroot", "docs"
),
libraryDependencies ++= Seq(
"dev.zio" %% "zio-http" % "3.0.0-RC4",
"dev.zio" %% "zio-json" % "0.6.2"
Expand Down
57 changes: 57 additions & 0 deletions docs/_docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# GUInep

> Guinep are small tropical fruits from the Caribbean and Central/Southern America. They are described to taste like a cross between Lime and Lychee.
PoC library to turn Scala 3 functions into UI forms with a single line of code.

## Example

```scala
def upperCaseText(text: String): String =
text.toUpperCase

@main
def run =
guinep.web(upperCaseText)
```

This will start a local web server with auto generated endpoints for running all listed functions. And an auto generated front-end with a form for each function.

## Usage (with build tools)

### sbt

```scala
libraryDependencies ++= Seq(
"io.github.kacperfkorban" %% "guinep-web" % "version_from_releases"
)
```

### scala-cli

```scala
//> using lib "io.github.kacperfkorban::guinep-web:version_from_releases"
```

## Usage (in code)

`GUInep` only exposes one function `guinep.web` which takes some number of functions as arguments.

```scala
def upperCaseText(text: String): String =
text.toUpperCase

def rollDice(sides: Int): Int =
scala.util.Random.nextInt(sides) + 1

@main
def run =
guinep.web(
upperCaseText,
rollDice
)
```

## Demo

![GUInep_classes_demo](https://github.com/KacperFKorban/GUInep/assets/39772805/556b6c1b-ea72-4089-8cbd-16f680484177)
1 change: 1 addition & 0 deletions docs/sidebar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
index : index.md

0 comments on commit 8e1346e

Please sign in to comment.