diff --git a/.github/workflows/zola-deploy.yml b/.github/workflows/zola-deploy.yml index 017954ff..e81d1d20 100644 --- a/.github/workflows/zola-deploy.yml +++ b/.github/workflows/zola-deploy.yml @@ -33,12 +33,19 @@ jobs: with: repository: valkey-io/valkey path: valkey - + + - name: Checkout valkey-bloom + uses: actions/checkout@v4 + with: + repository: valkey-io/valkey-bloom + path: valkey-bloom + - name: Init commands, topics and clients run: | cd website ./build/init-topics-and-clients.sh ../valkey-doc/topics ../valkey-doc/clients - ./build/init-commands.sh ../valkey-doc/commands ../valkey/src/commands + ./build/init-commands.sh ../valkey-doc/commands ../valkey/src/commands ../valkey-bloom/src/commands + - name: Build only uses: shalzz/zola-deploy-action@v0.19.1 env: diff --git a/.gitignore b/.gitignore index ae415375..69433c28 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ _site _data/groups.json _data/resp2_replies.json _data/resp3_replies.json +_data/modules.json diff --git a/README.md b/README.md index b61bd52a..f12ec773 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Valkey.io website This repo contains the source for the valkey.io website (build scripts, template, blog posts, stylesheets, etc.). -The build integrates content from [`valkey-io/valkey-doc`](https://github.com/valkey-io/valkey-doc) and the commands definitions from [`valkey-io/valkey`](https://github.com/valkey-io/valkey) (see [Build Locally](#build-locally) below for more details). +The build integrates content from [`valkey-io/valkey-doc`](https://github.com/valkey-io/valkey-doc) and the commands definitions from [`valkey-io/valkey`](https://github.com/valkey-io/valkey) and [`valkey-io/valkey-bloom`](https://github.com/valkey-io/valkey-bloom) (see [Build Locally](#build-locally) below for more details). ## Contributing @@ -63,8 +63,8 @@ Commit your changes to your local copy of `valkey-io/valkey-doc`. ### Building the command reference -The command reference (i.e. `/commands/set/`, `/commands/get/`, `/commands/lolwut/`) sources information from `valkey-io/valkey`, and `valkey-io/valkey-doc`. -`valkey-io/valkey` provides the command metadata (items like computational complexity, version history, arguments, etc) whilst `valkey-io/valkey-doc` provides the command description and the command reply. +The command reference (i.e. `/commands/set/`, `/commands/get/`, `/commands/lolwut/`) sources information from `valkey-io/valkey`, `valkey-io/valkey-bloom`, and `valkey-io/valkey-doc`. +`valkey-io/valkey` and `valkey-io/valkey-bloom` provides the command metadata (items like computational complexity, version history, arguments, etc) whilst `valkey-io/valkey-doc` provides the command description and the command reply. ```mermaid flowchart TD @@ -75,13 +75,13 @@ flowchart TD H --> J[Files: /resp2_replies.json,
/resp3_replies.json] --> Z[Command Reply] ``` -Let's say that this repo and your local copy of `valkey-io/valkey-doc` and `valkey-io/valkey` reside in the same directories. +Let's say that this repo and your local copy of `valkey-io/valkey-doc`, `valkey-io/valkey-bloom` and `valkey-io/valkey` reside in the same directories. First, stop the `zola serve` process if you're running it. From the root directory of this repo run: ```shell # You should only need to run this once or when you add a new command. -./build/init-commands.sh ../valkey-doc/commands ../valkey/src/commands +./build/init-commands.sh ../valkey-doc/commands ../valkey/src/commands ../valkey-bloom/src/commands ``` Then, restart Zola. diff --git a/build/init-commands.sh b/build/init-commands.sh index 031eec04..f23f58e2 100755 --- a/build/init-commands.sh +++ b/build/init-commands.sh @@ -24,20 +24,30 @@ if [ ! -d "$2" ]; then exit 1 fi +if [ ! -d "$3" ]; then + echo "The bloom module command JSON directory must exist and be a valid path" + exit 1 +fi + ln -s $1 ./build-command-docs ln -s $2 ./build-command-json - +ln -s $3 ./build-bloom-command-json for fname in $(find $1 -maxdepth 1 -iname "*.md") do base=${fname##*/} command=${base%.*} command_upper=$(awk '{ print toupper($0) }' <<< $command) if [[ "$command" != "index" ]]; then + if [ -f "$2/$command.json" ]; then + metadata_path="/commands/$command.json in the 'valkey' repo" + elif [ -f "$3/$command.json" ]; then + metadata_path="/commands/$command.json in the 'valkey-bloom' repo" + fi cat << EOF > "./content/commands/$command.md" +++ # This is a generated stub file. # To edit the command description see /commands/$command.md in the 'valkey-doc' repo -# The command metadata is generated from /src/$command.json in the 'valkey' repo +# The command metadata is generated from $metadata_path aliases = ["/commands/$command_upper/"] +++ EOF @@ -46,7 +56,7 @@ done echo "Command stub files created." -for datafile in groups.json resp2_replies.json resp3_replies.json; do +for datafile in groups.json resp2_replies.json resp3_replies.json modules.json; do ln -s "../${1}/../${datafile}" "./_data/${datafile}" echo "Created link to ${datafile}" diff --git a/config.toml b/config.toml index 8998ae86..e7ea2663 100644 --- a/config.toml +++ b/config.toml @@ -21,6 +21,7 @@ highlight_code = true [extra] command_description_path = "../build-command-docs/" command_json_path = "../build-command-json/" +command_bloom_json_path = "../build-bloom-command-json/" client_json_path = "../build-clients/" doc_topic_path = "../build-topics/" diff --git a/templates/command-page.html b/templates/command-page.html index b431896f..1e41182d 100644 --- a/templates/command-page.html +++ b/templates/command-page.html @@ -7,7 +7,13 @@ {% set upper_slug = page.slug | upper %} {% set command_description = load_data(path=config.extra.command_description_path ~ page.slug ~ ".md", required= false) %} -{% set command_data = load_data(path= commands::command_json_path(slug= page.slug), required= false) %} +{% set command_sources = [ + load_data(path= commands::command_json_path(slug= page.slug), required= false), + load_data(path= commands::command_bloom_json_path(slug= page.slug), required= false) +] %} + +{% set command_data = command_sources | filter(attribute="") | first %} + {% if command_data %} {% set command_obj_name = commands::command_obj_name(command_data= command_data) %} {% set command_data_obj = command_data[command_obj_name] %} @@ -48,13 +54,25 @@
{{ command_data_obj.complexity }}
{% endif %} + {% if command_data_obj.module_since %} +
+ {% if "bf." in page.slug %} + {% set module_reply = load_data(path="../_data/modules.json", required=false) -%} +
Module:
+
{{module_reply.valkey_bloom.name}}
+ {% endif %} +
+
+
Since module version:
+
{{ command_data_obj.module_since }}
+
+ {% endif %} {% if command_data_obj.since %}
Since:
{{ command_data_obj.since }}
{% endif %} -
{% else %} diff --git a/templates/commands.html b/templates/commands.html index 57fd53df..9c84ac84 100644 --- a/templates/commands.html +++ b/templates/commands.html @@ -16,23 +16,27 @@ {% for page in section.pages %} - {% set command_data = load_data(path= commands::command_json_path(slug= page.slug), required= false) %} - {% if command_data %} - {% set command_obj_name = commands::command_obj_name(command_data= command_data) %} - {% set command_data_obj = command_data[command_obj_name] %} - {% set command_display = command_obj_name %} - {% if command_data_obj.container %} - {% set command_display = command_data_obj.container ~ " " ~ command_display %} + {% for json_path in [ + commands::command_json_path(slug=page.slug), + commands::command_bloom_json_path(slug=page.slug) + ] %} + {% set command_data = load_data(path= json_path, required= false) %} + {% if command_data %} + {% set command_obj_name = commands::command_obj_name(command_data= command_data) %} + {% set command_data_obj = command_data[command_obj_name] %} + {% set command_display = command_obj_name %} + {% if command_data_obj.container %} + {% set command_display = command_data_obj.container ~ " " ~ command_display %} + {% endif %} + {% set command_entry = [ + command_display, + page.permalink | safe, + command_data_obj.summary, + command_data_obj.group + ] %} + {% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %} {% endif %} - - {% set command_entry = [ - command_display, - page.permalink | safe, - command_data_obj.summary, - command_data_obj.group - ] %} - {% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %} - {% endif %} + {% endfor %} {% endfor %} {% set_global grouped = commands_entries | sort(attribute="3") | group_by(attribute="3") %} diff --git a/templates/macros/command.html b/templates/macros/command.html index fdf9eb2a..81d55d93 100644 --- a/templates/macros/command.html +++ b/templates/macros/command.html @@ -52,6 +52,10 @@ {{config.extra.command_json_path }}{{ slug }}.json {%- endmacro load_command_json -%} +{%- macro command_bloom_json_path(slug) -%} +{{config.extra.command_bloom_json_path }}{{ slug }}.json +{%- endmacro load_bloom_command_json -%} + {%- macro fix_links(content) -%} {{ content | regex_replace(pattern=`\]\(\.\./topics/(?P.*?).md#(?P.*?)\)`, rep=`](/topics/$fname#$hash)`)