-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add script to change patch of doc
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const path = require('path'); | ||
const { execSync } = require('child_process'); | ||
|
||
const versions = require(path.resolve(__dirname, '../..', 'documentation/versions.json')); | ||
|
||
const getLatestDocVersion = () => { | ||
return versions[0] || '1.0.0'; | ||
}; | ||
|
||
const updateDocVersion = async () => { | ||
try { | ||
const currentVersion = getLatestDocVersion(); | ||
console.log('Current doc version:', currentVersion); | ||
|
||
// Parse version components | ||
const [major, minor, patch] = currentVersion.split('.').map(Number); | ||
|
||
// Create new version with incremented patch | ||
const newVersion = `${major}.${minor}.${patch + 1}`; | ||
console.log(`Updating documentation to version ${newVersion}...`); | ||
|
||
try { | ||
// Create new version using docusaurus command | ||
execSync(`cd documentation && npm run docusaurus docs:version ${newVersion}`, { | ||
stdio: 'inherit', | ||
}); | ||
|
||
console.log('Documentation version updated successfully!'); | ||
} catch (error) { | ||
console.error('Error updating documentation version:', error); | ||
process.exit(1); | ||
} | ||
} catch (error) { | ||
console.error('Error in update process:', error); | ||
process.exit(1); | ||
} | ||
}; | ||
|
||
// Execute the update | ||
updateDocVersion(); |