Skip to content

Commit

Permalink
Update docs with the newly added feature (i.e. DecVer)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lee committed Aug 28, 2024
1 parent 1d35c71 commit 77d1ab9
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 9 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ lazy val docs = (project in file("docs-gen-tmp/docs"))

List(
"io.kevinlee" %%% "just-semver-core" % latestVersion,
"io.kevinlee" %%% "just-semver-decver" % latestVersion,
)
},
mdocVariables := Map(
Expand Down
6 changes: 6 additions & 0 deletions docs/decver/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"label": "DecVer",
"position": 3,
"collapsible": true,
"collapsed": false
}
147 changes: 147 additions & 0 deletions docs/decver/decver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@

# DecVer (Decimal Version)

## `DecVer.parse`

```scala mdoc:reset-object
import just.decver.DecVer

val v = DecVer.parse("1.0")

// To render it to `String`,
v.map(_.render)

// Invalid version
DecVer.parse("a1.0")

// Invalid version
DecVer.parse("a1.0.0")

```

## `DecVer.unsafeParse`

```scala mdoc:reset-object
import just.decver.DecVer

// parse unsafe - NOT RECOMMENDED!!!
val v = DecVer.unsafeParse("1.0")

// to String
v.render
```

```scala mdoc:crash

// Invalid version
DecVer.unsafeParse("a1.0")
```

## DecVer with `pre-release` info
```scala mdoc:reset-object
import just.decver.DecVer

DecVer.parse("1.0-beta1")

val v = DecVer.parse("1.0-3.123.9a")

v.map(_.render)
```

## DecVer with build `meta-info`
```scala mdoc:reset-object
import just.decver.DecVer

val v = DecVer.parse("1.0+100.0.12abc")

v.map(_.render)
```

## DecVer with `pre-release` info and build `meta-info`
```scala mdoc:reset-object
import just.decver.DecVer

DecVer.parse("1.0-beta1")

val v = DecVer.parse("1.0-3.123.9a+100.0.12abc")

v.map(_.render)
```

## Compare `DecVer`
```scala mdoc:reset-object
import just.decver.DecVer

for {
a <- DecVer.parse("1.0")
b <- DecVer.parse("1.1")
} yield a < b

for {
a <- DecVer.parse("1.1")
b <- DecVer.parse("1.0")
} yield a < b

for {
a <- DecVer.parse("1.0")
b <- DecVer.parse("1.1")
} yield a <= b

for {
a <- DecVer.parse("1.0")
b <- DecVer.parse("1.0")
} yield a <= b

for {
a <- DecVer.parse("1.0")
b <- DecVer.parse("1.0")
} yield a == b

for {
a <- DecVer.parse("1.1")
b <- DecVer.parse("1.0")
} yield a > b

for {
a <- DecVer.parse("1.0")
b <- DecVer.parse("1.1")
} yield a > b

for {
a <- DecVer.parse("1.0")
b <- DecVer.parse("1.1")
} yield a >= b

for {
a <- DecVer.parse("1.0")
b <- DecVer.parse("1.0")
} yield a >= b

for {
a <- DecVer.parse("1.1")
b <- DecVer.parse("1.0")
} yield a >= b
```

## Matchers
```scala mdoc
DecVer.unsafeParse("1.0").unsafeMatches("1.0 - 2.0")
DecVer.unsafeParse("1.5").unsafeMatches("1.0 - 2.0")
DecVer.unsafeParse("2.0").unsafeMatches("1.0 - 2.0")
DecVer.unsafeParse("0.9").unsafeMatches("1.0 - 2.0")
DecVer.unsafeParse("2.1").unsafeMatches("1.0 - 2.0")

DecVer.unsafeParse("1.0").unsafeMatches(">1.0 <2.0")
DecVer.unsafeParse("1.0").unsafeMatches(">=1.0 <=2.0")
DecVer.unsafeParse("1.5").unsafeMatches(">1.0 <2.0")
DecVer.unsafeParse("2.0").unsafeMatches(">1.0 <2.0")
DecVer.unsafeParse("2.0").unsafeMatches(">=1.0 <=2.0")
DecVer.unsafeParse("0.9").unsafeMatches(">=1.0 <=2.0")
DecVer.unsafeParse("2.1").unsafeMatches(">=1.0 <=2.0")

DecVer.unsafeParse("1.0").unsafeMatches("1.0 - 2.0 || >3.0 <4.0")
DecVer.unsafeParse("2.0").unsafeMatches("1.0 - 2.0 || >3.0 <4.0")
DecVer.unsafeParse("3.0").unsafeMatches("1.0 - 2.0 || >3.0 <=4.0")
DecVer.unsafeParse("3.1").unsafeMatches("1.0 - 2.0 || >3.0 <=4.0")
DecVer.unsafeParse("4.0").unsafeMatches("1.0 - 2.0 || >3.0 <=4.0")
```
61 changes: 56 additions & 5 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: '/'

[![Build Status](https://github.com/Kevin-Lee/just-semver/workflows/Build%20All/badge.svg)](https://github.com/Kevin-Lee/just-semver/actions?workflow=Build+All)
[![Release Status](https://github.com/Kevin-Lee/just-semver/workflows/Release/badge.svg)](https://github.com/Kevin-Lee/just-semver/actions?workflow=Release)
[![Coverage Status](https://coveralls.io/repos/github/Kevin-Lee/just-semver/badge.svg?branch=master)](https://coveralls.io/github/Kevin-Lee/just-semver?branch=master)
[![codecov](https://codecov.io/gh/kevin-lee/just-semver/graph/badge.svg?token=SO5LB2BWOL)](https://codecov.io/gh/kevin-lee/just-semver)

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.kevinlee/just-semver_2.13/badge.svg)](https://search.maven.org/artifact/io.kevinlee/just-semver_2.13)
[![Latest version](https://index.scala-lang.org/kevin-lee/just-semver/just-semver/latest.svg)](https://index.scala-lang.org/kevin-lee/just-semver/just-semver)
Expand All @@ -26,14 +26,15 @@ Show [**all `just-semver` versions**](https://index.scala-lang.org/kevin-lee/jus

### `@VERSION@`

```scala
"io.kevinlee" %% "just-semver-core" % "@VERSION@"
```

[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.11.0.svg)](https://www.scala-js.org)

Since `0.6.0` `just-semver` supports Scala.js.

#### Core
```scala
"io.kevinlee" %% "just-semver-core" % "@VERSION@"
```

```scala
"io.kevinlee" %%% "just-semver-core" % "@VERSION@"
```
Expand All @@ -47,8 +48,58 @@ libraryDependencies += "io.kevinlee" %% "just-semver-core" % "@VERSION@"
libraryDependencies += "io.kevinlee" %%% "just-semver-core" % "@VERSION@"
```


#### DecVer: Decimal version module
```scala
"io.kevinlee" %% "just-semver-decver" % "@VERSION@"
```

```scala
"io.kevinlee" %%% "just-semver-decver" % "@VERSION@"
```


e.g.)
```scala
libraryDependencies += "io.kevinlee" %% "just-semver-decver" % "@VERSION@"
```
```scala
libraryDependencies += "io.kevinlee" %%% "just-semver-decver" % "@VERSION@"
```

#### All modules

```scala
"io.kevinlee" %% "just-semver-core" % "@VERSION@",
"io.kevinlee" %% "just-semver-decver" % "@VERSION@",
```

```scala
"io.kevinlee" %%% "just-semver-core" % "@VERSION@",
"io.kevinlee" %%% "just-semver-decver" % "@VERSION@",
```

```scala
libraryDependencies ++= Seq(
"io.kevinlee" %% "just-semver-core" % "@VERSION@",
"io.kevinlee" %% "just-semver-decver" % "@VERSION@",
)
```
```scala
libraryDependencies ++= Seq(
"io.kevinlee" %%% "just-semver-core" % "@VERSION@",
"io.kevinlee" %%% "just-semver-decver" % "@VERSION@",
)
```



## Older Versions

### `0.13.0`

### `0.12.0`

### `0.11.0`

:::info
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "How to use",
"label": "SemVer",
"position": 2,
"collapsible": true,
"collapsed": false
Expand Down
4 changes: 2 additions & 2 deletions docs/how-to-use/how-to-use.md → docs/semver/semver.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# How to Use
# SemVer (Semantic Version)

:::caution NOTE
For now, please do not use any types and methods from the package other than `just.semver`.
Expand Down Expand Up @@ -71,7 +71,7 @@ val v = SemVer.parse("1.0.0-3.123.9a+100.0.12abc")
v.map(_.render)
```

## Compare `SamVer`
## Compare `SemVer`
```scala mdoc:reset-object
import just.semver.SemVer

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const classicConfig = {
lastVersion: 'current',
"versions": {
"current": {
"label": "0.13.0"
"label": "1.0.0"
},
}
// Please change this to your repo.
Expand Down
8 changes: 8 additions & 0 deletions website/src/pages/versionsArchived.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[
{
"name": "0.13.0",
"label": "0.13.0"
},
{
"name": "0.12.0",
"label": "0.12.0"
},
{
"name": "0.11.0",
"label": "0.11.0"
Expand Down

0 comments on commit 77d1ab9

Please sign in to comment.