Skip to content

Commit

Permalink
Differentiate same name config files
Browse files Browse the repository at this point in the history
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
  • Loading branch information
vipulgupta2048 committed Nov 21, 2024
1 parent 16a29b0 commit d5939a1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .cspell/balena-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ balena-builder
balenacli
balenahup
balenalib
balenasdk
balenasdkpython
balenista
balenistas
Barys
Expand All @@ -30,8 +28,10 @@ metalsmith
model
multicontainer
Nicky
nodesdk
openbalena
private-contracts
pythonsdk
resinio
Rulemotion
SBVR
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ config/dictionaries/balenacli.json
shared/balena-cli-versions/

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

# Ignore dynamic Python SDK version docs
config/dictionaries/balenasdkpython.json
config/dictionaries/pythonsdk.json
shared/balena-sdk-python-versions/

# Ignore dynamic assets generated for Getting Started
Expand Down
4 changes: 2 additions & 2 deletions config/navigation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ Reference

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

Diagnostics
Expand Down
8 changes: 4 additions & 4 deletions pages/reference/sdk/node-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: balena Node.js SDK Documentation
layout: balena-sdk.html

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

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

{{import "balena-sdk-versions"}}
8 changes: 4 additions & 4 deletions pages/reference/sdk/python-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: balena Python SDK Documentation
layout: balena-sdk-python.html

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

# Balena Python SDK {{ $balenasdkpython.version }} Documentation
# Balena Python SDK {{ $pythonsdk.version }} Documentation

{{import "balena-sdk-python-versions"}}
15 changes: 13 additions & 2 deletions tools/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,20 @@ async function main() {
process.exit(1);
}

const versionsConfigFileTemplate = {
"balenasdk": "nodesdk",
"balenasdkpython": "pythonsdk",
}

// Parse repository details
const { owner, name: repoName, filepath } = parseGithubUrl(repoUrl);
const versionsConfigFile = `./config/dictionaries/${repoName.replaceAll(/-/g, "")}.json`

// Create versioned config file - Doxx doesn't allow dashes in the config file name
const versionsFileName = repoName.replaceAll(/-/g, "")
// Doxx treats config files with common names as same, so balenasdk and balenasdkpython config files needs to be named differently
const versionsConfigFile = versionsConfigFileTemplate[versionsFileName] ? versionsConfigFileTemplate[versionsFileName] : versionsFileName
const versionsConfigFilePath = `./config/dictionaries/${versionsConfigFile}.json`

const versionedDocsFolder = path.join(__dirname, `../shared/${repoName}-versions`)

console.log(`Started versioning ${repoName} docs`)
Expand All @@ -263,7 +274,7 @@ async function main() {
const tagVersions = await fetchGitHubTags(owner, repoName);

// Write versions configuration
await fsPromises.writeFile(versionsConfigFile, JSON.stringify(tagVersions, null, 2));
await fsPromises.writeFile(versionsConfigFilePath, JSON.stringify(tagVersions, null, 2));
if (fs.existsSync(versionedDocsFolder)) {
await fsPromises.rm(versionedDocsFolder, { recursive: true });
}
Expand Down

0 comments on commit d5939a1

Please sign in to comment.