diff --git a/.cspell/balena-words.txt b/.cspell/balena-words.txt index 60654e1cf0..f45656de86 100644 --- a/.cspell/balena-words.txt +++ b/.cspell/balena-words.txt @@ -7,6 +7,7 @@ balena-builder balenacli balenahup balenalib +balenasdk balenista balenistas Barys diff --git a/.gitignore b/.gitignore index 87461c4d2d..ca4ea799ca 100644 --- a/.gitignore +++ b/.gitignore @@ -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 @@ -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 diff --git a/config/navigation.txt b/config/navigation.txt index 670aff8aed..2a3ee45989 100644 --- a/config/navigation.txt +++ b/config/navigation.txt @@ -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] diff --git a/config/redirects.txt b/config/redirects.txt index 6b65ca975e..3b76b9946b 100644 --- a/config/redirects.txt +++ b/config/redirects.txt @@ -194,8 +194,8 @@ /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/sdk/ /reference/sdk/node-sdk/latest/ +/tools/sdk /reference/sdk/node-sdk/latest/ /tools/python-sdk/ /reference/sdk/python-sdk/ /tools/python-sdk /reference/sdk/python-sdk/ /runtime/resin-base-images/ /reference/base-images/balena-base-images/ @@ -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/ diff --git a/pages/reference/sdk/node-sdk.md b/pages/reference/sdk/node-sdk.md new file mode 100644 index 0000000000..f7e779a5fb --- /dev/null +++ b/pages/reference/sdk/node-sdk.md @@ -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"}} diff --git a/templates/balena-sdk.html b/templates/balena-sdk.html new file mode 100644 index 0000000000..a05b70b2b0 --- /dev/null +++ b/templates/balena-sdk.html @@ -0,0 +1,8 @@ +{% extends "default.html" %} + +{% block dynamicSwitchCustom %} +
+
+{% endblock %} + + diff --git a/tools/build.sh b/tools/build.sh index eb1a348df1..df254a4bab 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -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 diff --git a/tools/fetch-external.sh b/tools/fetch-external.sh index 621f8bc35e..6e0d126ce1 100755 --- a/tools/fetch-external.sh +++ b/tools/fetch-external.sh @@ -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/ && {