Skip to content

fix(docs): resolve Astro 6 build errors and modernize Starlight dependencies#197

Open
Pega88 wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
Pega88:fix/docs-deps
Open

fix(docs): resolve Astro 6 build errors and modernize Starlight dependencies#197
Pega88 wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
Pega88:fix/docs-deps

Conversation

@Pega88
Copy link
Copy Markdown
Contributor

@Pega88 Pega88 commented Apr 27, 2026

This PR addresses several build-breaking issues in the docs-site introduced by the migration to Astro 6. It resolves Zod-related configuration errors and streamlines the diagram generation process.

Root Causes
The primary failure was a z.function(...).args is not a function error during the Astro configuration phase. This was caused by an incompatibility between the older versions of Starlight plugins and the version of Zod bundled with Astro 6. Additionally, the astro-d2 integration encountered issues parsing configuration defaults in the new environment.

Changes

  • Dependency Updates:
    • Upgraded starlight-links-validator from ^0.19.2 to ^0.23.0 to restore compatibility with Astro 6's schema validation.
    • Upgraded astro-d2 from ^0.8.1 to ^0.10.0.
  • Portability Improvement:
    • Enabled the experimental useD2js mode in astro.config.mjs. This switches diagram generation to a WASM-based engine (D2.js), removing the requirement for a local d2 binary to be installed on the host system or CI runner.
  • Build Stability:
    • Synchronized package-lock.json to ensure clean, reproducible builds across environments.

Verification Results

  • Build Success: npm run build completes without errors.
  • Link Validation: starlight-links-validator correctly validates all internal links.
  • Diagram Generation: Confirmed that .svg diagrams are successfully generated in public/d2/ using the new WASM engine without a local d2 installation.

Checklist

  • npm run build passes locally.
  • No system-level binaries (like d2) are required for the build.
  • package-lock.json is synchronized with package.json.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the astro-d2 and starlight-links-validator dependencies and enables the experimental useD2js feature in the Astro configuration to reduce reliance on local binaries. Feedback suggests increasing the minimum Node.js version requirement to 22.12.0 to satisfy new dependency constraints and addressing the check-d2.sh script which still mandates a local binary despite the configuration changes.

"astro-d2": "^0.10.0"
},
"engines": {
"node": ">=22"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Node.js engine requirement is set to >=22, but Astro 6 and the updated plugins (astro-d2, starlight-links-validator) specifically require Node.js version 22.12.0 or higher. This discrepancy can lead to installation warnings or runtime errors on older Node 22 releases. Please update the engines field in package.json to >=22.12.0 and regenerate the lockfile.

Suggested change
"node": ">=22"
"node": ">=22.12.0"

base: '/scion',
integrations: [
d2(),
d2({ experimental: { useD2js: true } }),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While enabling useD2js removes the requirement for a local d2 binary during the Astro build process, the project still includes a check-d2.sh script (referenced in package.json) that explicitly checks for and requires the d2 CLI. To fully achieve the PR's goal of removing system-level binary requirements for all developer workflows, consider updating or removing that validation script.

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