Skip to content

Conversation

vipulgupta2048
Copy link
Member

@vipulgupta2048 vipulgupta2048 commented Sep 15, 2025

Create atleast a fallback for the lastest docs and bunch of refactoring fixed to make it more readable.

Signed-off-by: Vipul Gupta (@vipulgupta2048) [email protected]


Please make sure to read the CONTRIBUTING document before opening the PR for relevant information on contributing to the documentation. Thanks!

@Copilot Copilot AI review requested due to automatic review settings September 15, 2025 11:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the versioning.js tool that fetches GitHub repository releases and creates versioned documentation. The changes improve code organization, error handling, and add comprehensive documentation while maintaining the same core functionality.

  • Adds comprehensive JSDoc documentation for all functions
  • Refactors large functions into smaller, more focused utility functions
  • Improves configuration management with centralized constants
  • Enhances error handling and fallback mechanisms

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

REQUEST_TIMEOUT: 10000,
MIN_SEMANTIC_VERSIONS: 10,
MIN_COMPATIBLE_TAGS: 5,
ONE_YEAR_IN_MS: 365 * 24 * 60 * 60 * 1000
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ONE_YEAR_IN_MS constant is defined but never used in the code. Consider removing it or using it in the getOneYearAgo function to replace the setFullYear approach for consistency.

Copilot uses AI. Check for mistakes.

return createVersionEntry("latest", `${tag.name} latest`, tag.name, tagDate);
}

if (tagDate.getTime() < oneYearAgo.getTime()) {
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling getTime() on dates that are already compared multiple times is inefficient. Consider converting dates to timestamps once at the beginning of the function.

Copilot uses AI. Check for mistakes.

* @returns {Object} Configuration paths and names
*/
function generateConfigPaths(repoName) {
const versionsFileName = repoName.replaceAll(/-/g, "");
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using replaceAll with a global regex is redundant. Use replace(/-/g, '') instead, or keep replaceAll but remove the 'g' flag: replaceAll('-', '').

Suggested change
const versionsFileName = repoName.replaceAll(/-/g, "");
const versionsFileName = repoName.replaceAll("-", "");

Copilot uses AI. Check for mistakes.

@flowzone-app
Copy link
Contributor

flowzone-app bot commented Sep 15, 2025

Website deployed to CF Pages, 👀 preview link https://ff22ddab.balenacloud-docs.pages.dev

@flowzone-app flowzone-app bot enabled auto-merge September 15, 2025 11:46
@vipulgupta2048 vipulgupta2048 marked this pull request as draft September 15, 2025 14:57
auto-merge was automatically disabled September 15, 2025 14:57

Pull request was converted to draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant