Skip to content

Commit

Permalink
Added versioned docs for balena-sdk nodejs
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
  • Loading branch information
vipulgupta2048 committed Nov 18, 2024
1 parent a7823e3 commit 775eaab
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 13 deletions.
1 change: 1 addition & 0 deletions .cspell/balena-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ balena-builder
balenacli
balenahup
balenalib
balenasdk
balenista
balenistas
Barys
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tmp
.lycheecache

# Ignore external docs that are pulled via tools/fetch-external.sh
pages/reference/sdk/node-sdk.md
# pages/reference/sdk/node-sdk.md
pages/reference/sdk/python-sdk.md

pages/reference/supervisor/supervisor-api.md
Expand Down Expand Up @@ -46,6 +46,10 @@ shared/masterclass
config/dictionaries/balenacli.json
shared/balena-cli-versions/

# Ignore dynamic balena-SDK version docs
config/dictionaries/balenasdk.json
shared/balena-sdk-versions/

# Ignore dynamic assets generated for Getting Started
static/img/device/**
config/dictionaries/device.json
Expand Down
2 changes: 1 addition & 1 deletion config/navigation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Reference

CLI[/reference/balena-cli/$balenacli]
SDKs
Node.js SDK[/reference/sdk/node-sdk]
Node.js SDK[/reference/sdk/node-sdk/$balenasdk]
Python SDK[/reference/sdk/python-sdk]
Deprecation Policy[/reference/sdk/deprecation-policy]

Expand Down
12 changes: 8 additions & 4 deletions config/redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@
/runtime/data-api /reference/api/overview/
/tools/cli/ /reference/balena-cli/latest/
/tools/cli /reference/balena-cli/latest/
/tools/sdk/ /reference/sdk/node-sdk/
/tools/sdk /reference/sdk/node-sdk/
/tools/python-sdk/ /reference/sdk/python-sdk/
/tools/python-sdk /reference/sdk/python-sdk/
/tools/sdk/ /reference/sdk/node-sdk/latest/
/tools/sdk /reference/sdk/node-sdk/latest/
/tools/python-sdk/ /reference/sdk/python-sdk/latest/
/tools/python-sdk /reference/sdk/python-sdk/latest/
/runtime/resin-base-images/ /reference/base-images/balena-base-images/
/runtime/resin-base-images /reference/base-images/balena-base-images/
/configuration/custom-docker-base-images/ /reference/base-images/customer-docker-base-images/
Expand Down Expand Up @@ -270,6 +270,10 @@
/reference/balena-cli/ /reference/balena-cli/latest/
/reference/balena-cli /reference/balena-cli/latest/

# Versioned Node.js SDK docs
/reference/sdk/node-sdk/ /reference/sdk/node-sdk/latest/
/reference/sdk/node-sdk /reference/sdk/node-sdk/latest/

# Important: keep dynamic redirect below the static redirects
# https://developers.cloudflare.com/pages/platform/redirects/

Expand Down
14 changes: 14 additions & 0 deletions pages/reference/sdk/node-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: balena Node.js SDK Documentation

layout: balena-sdk.html

dynamic:
variables: [ $balenasdk ]
ref: $original_ref/$balenasdk
$switch_text: balena SDK version $balenasdk
---

# Balena Node.js SDK {{ $balenasdk.version }} Documentation

{{import "balena-sdk-versions"}}
8 changes: 8 additions & 0 deletions templates/balena-sdk.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "default.html" %}

{% block dynamicSwitchCustom %}
<p class="dynamic-switch__append">
</p>
{% endblock %}

<div id="output"></div>
3 changes: 3 additions & 0 deletions tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ node ./tools/generate-docs-contracts.js
# Generate versioned balena-cli docs
node ./tools/versioning.js https://github.com/balena-io/balena-cli/blob/master/docs/balena-cli.md

# Generate versioned balena-sdk docs
node ./tools/versioning.js https://github.com/balena-io/balena-sdk/blob/master/DOCUMENTATION.md

# Generate Masterclasses Dynamically
./tools/build-masterclass.sh

Expand Down
14 changes: 7 additions & 7 deletions tools/fetch-external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ cd shared/projects/ && {
} &

# get latest node SDK docs
cd pages/reference/sdk/ && {
curl --fail --show-error -O -L https://github.com/balena-io/balena-sdk/raw/master/DOCUMENTATION.md
echo "# Balena Node.js SDK" >node-sdk.md
tail -n +2 DOCUMENTATION.md >>node-sdk.md
rm DOCUMENTATION.md
cd -
} &
# cd pages/reference/sdk/ && {
# curl --fail --show-error -O -L https://github.com/balena-io/balena-sdk/raw/master/DOCUMENTATION.md
# echo "# Balena Node.js SDK" >node-sdk.md
# tail -n +2 DOCUMENTATION.md >>node-sdk.md
# rm DOCUMENTATION.md
# cd -
# } &

# get SDK README
cd shared/sdk/ && {
Expand Down

0 comments on commit 775eaab

Please sign in to comment.