Skip to content

Commit

Permalink
feat: v6
Browse files Browse the repository at this point in the history
  • Loading branch information
icidasset committed Jul 2, 2024
1 parent 57a087a commit 1e0e71c
Show file tree
Hide file tree
Showing 18 changed files with 3,762 additions and 6,894 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 6.0.0

- Updated to gren 0.4.x and the new node package.
- Replaced Path & Focus modules with `FileSystem.Path` from Gren's node package.
- Should technically work on Windows now (not tested though)

## 5.1.0

Changed the behaviour of the `Shikensu.programs` function, programs are now performed sequentially instead of concurrently (+ the documentation of the function now states this).
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
# Shīkensu

> シーケンス
> シーケンス
> Sequence
Run a sequence of functions on in-memory representations of files.
Run a sequence of functions on in-memory representations of files.
__Build static websites with ease__, without conforming to a specific structure.

### Markdown example

```gren
import Bytes exposing ( Bytes )
import FileSystem.Path as Path exposing ( Path )
import Shikensu
import Shikensu.Contrib as Shikensu
import Shikensu.Definition as Shikensu
import Shikensu.Focus as Shikensu exposing ( Focus(..) )
import Shikensu.Path as Path
import Task
main : Shikensu.Program
main =
-- 🚀
Shikensu.program sequence CurrentDirectory
-- 🚀 List current directory
Shikensu.program sequence Path.empty
sequence : Shikensu.Task -> Shikensu.Task
Expand All @@ -39,12 +38,12 @@ sequence task =
|> Task.andThen (Shikensu.write destination)
destination : Shikensu.Focus
destination : Path
destination =
Relative (Path.directory [ "build" ])
Path.fromPosix "./dist"
renderMarkdown : Shikensu.Definition -> Maybe Bytes
renderMarkdown def =
Maybe.map renderMarkdownBytes def.content
```
```
2 changes: 1 addition & 1 deletion docs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/content/category/example.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Markdown Header

Content
Content
33 changes: 18 additions & 15 deletions example/gren.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{
"type": "application",
"platform": "node",
"source-directories": [
"src"
],
"gren-version": "0.3.0",
"dependencies": {
"direct": {
"gren-lang/core": "4.0.1",
"gren-lang/node": "3.0.1",
"icidasset/shikensu-gren": "local:.."
},
"indirect": {
"gren-lang/url": "3.0.0"
"type": "application",
"platform": "node",
"source-directories": [
"src"
],
"gren-version": "0.4.4",
"dependencies": {
"direct": {
"gren-lang/core": "5.0.0",
"gren-lang/node": "4.1.1",
"icidasset/html-gren": "4.2.0",
"icidasset/markdown-gren": "3.2.0",
"icidasset/shikensu-gren": "local:.."
},
"indirect": {
"gren-lang/parser": "4.0.0",
"gren-lang/url": "4.0.0"
}
}
}
}
55 changes: 19 additions & 36 deletions example/src/Main.gren
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ module Main exposing ( main )
{-|-}

import Bytes exposing ( Bytes )
import Bytes.Decode
import Bytes.Encode
import FileSystem.Path as Path exposing ( Path )
import Markdown
import Shikensu
import Shikensu.Contrib as Shikensu
import Shikensu.Definition as Shikensu
import Shikensu.Focus as Shikensu exposing ( Focus(..) )
import Shikensu.Focus
import Shikensu.Path as Path
import Task
import Transmutable.Html


main : Shikensu.Program
Expand All @@ -21,22 +19,16 @@ main =


{-| Which directory are we working with? -}
source : Shikensu.Focus
source : Path
source =
[ "content"
]
|> Path.directory
|> Relative
Path.fromPosixString "./content"


{-| Optional, the destination of the output we'll be producing.
-}
destination : Shikensu.Focus
destination : Path
destination =
[ "build"
]
|> Path.directory
|> Relative
Path.fromPosixString "./build"


{-| A sequence of operations.
Expand Down Expand Up @@ -75,13 +67,8 @@ sequence =
>> Task.map
(\bundle ->
destination
|> Shikensu.Focus.toAbsolutePath
{ cwd = bundle.workingDirectory
}
|> Path.toPosix
{ absolute = True
}
|> String.append "🛳️ Bundle successfully written to "
|> Path.toPosixString
|> String.prepend "🛳️ Bundle successfully written to "
|> Debug.log
|> (\debug -> debug bundle)
)
Expand All @@ -93,20 +80,16 @@ sequence =

renderMarkdown : Shikensu.Definition -> Maybe Bytes
renderMarkdown def =
-- TODO: Once there's a markdown parser/renderer written in Gren use it here.
def.content
|> Maybe.andThen
(\content ->
content
|> Bytes.width
|> Bytes.Decode.string
|> (\decoder -> Bytes.Decode.decode decoder content)
)
|> Maybe.andThen Bytes.toString
|> Maybe.map
(\_ ->
"""
<h1>Markdown Header</h1>
<p>Content</p>
"""
(\markdown ->
markdown
|> Markdown.parse
{ frontmatter = Nothing
}
|> .blocks
|> Array.map Markdown.toHtml
|> Transmutable.Html.arrayToString
)
|> Maybe.map (Bytes.Encode.string >> Bytes.Encode.encode)
|> Maybe.map Bytes.fromString
13 changes: 5 additions & 8 deletions gren.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@
"name": "icidasset/shikensu-gren",
"summary": "Run a sequence of functions on in-memory representations of files",
"license": "BSD-3-Clause",
"version": "5.1.0",
"version": "6.0.0",
"exposed-modules": [
"Shikensu",
"Shikensu.Bundle",
"Shikensu.Contrib",
"Shikensu.Definition",
"Shikensu.Error",
"Shikensu.Focus",
"Shikensu.Path",
"Shikensu.Path.Encapsulated"
"Shikensu.Error"
],
"gren-version": "0.2.0 <= v < 1.0.0",
"gren-version": "0.4.0 <= v < 1.0.0",
"dependencies": {
"gren-lang/core": "4.0.0 <= v < 5.0.0",
"gren-lang/node": "3.0.0 <= v < 4.0.0"
"gren-lang/core": "5.0.0 <= v < 6.0.0",
"gren-lang/node": "4.1.1 <= v < 5.0.0"
}
}
Loading

0 comments on commit 1e0e71c

Please sign in to comment.