Skip to content

feat: add @algorandfoundation/devportal-docs package#572

Open
larkiny wants to merge 19 commits intoalgorandfoundation:refactor/library-enablementfrom
larkiny:feat/devportal-docs-package
Open

feat: add @algorandfoundation/devportal-docs package#572
larkiny wants to merge 19 commits intoalgorandfoundation:refactor/library-enablementfrom
larkiny:feat/devportal-docs-package

Conversation

@larkiny
Copy link
Copy Markdown
Contributor

@larkiny larkiny commented Feb 26, 2026

Summary

  • Extracts library-facing build scripts and theme assets from the devportal monorepo into a publishable npm package (@algorandfoundation/devportal-docs)
  • Provides a CLI (devportal-docs) with commands: init, build, normalize-links, build-sidebar, build-manifest
  • Exports Starlight sidebar types (./types) and theme CSS/fonts (./theme) for library docs sites
  • Removes legacy scripts/library-templates/ directory in favor of the package

What's included

  • CLI package at packages/devportal-docs/ with ESM TypeScript source
  • 5 commands: init (scaffold/validate), build (orchestrator), normalize-links, build-sidebar, build-manifest
  • Theme assets: CSS variables and font files served from the installed package
  • 106 tests covering utils, commands, and integration paths
  • Audit fixes: shared walkMdDir utility, --base validation, error handling, .gitignore

Test plan

  • pnpm run build compiles cleanly
  • 106 package tests pass (pnpm test)
  • 211 root tests pass
  • Tested locally against algokit-utils-ts and algokit-utils-py via pnpm pack + tarball install
  • devportal-docs init and devportal-docs build work correctly on both repos
  • Publish to npm and verify install from registry

- Add pnpm workspace config and @algorandfoundation/devportal-docs package
- Shared utilities: resolve-base (astro.config.mjs parsing), fs helpers
  (slug-exists, walk, file-index, fallback matching)
- Type exports: DevportalSidebarConfig, SidebarItem (from Starlight)
- 29 tests passing
…ar, build-manifest, build

- normalize-links: path lowercasing, link normalization, readme rewriting,
  dead-link stripping (extracted from scripts/library-templates/)
- build-sidebar: filter non-serializable entries, merge devportalFallbacks,
  write sidebar.json (uses tsx for .ts config import)
- build-manifest: write manifest.json with site base and timestamp
- build: orchestrator that runs all three in sequence
- 38 new tests (67 total)
…sets

- init: scaffold docs:devportal script, validate workflow composite
  action + permissions, check theme CSS reference (idempotent)
- CLI: arg parsing, command dispatch for init/build/normalize-links/
  build-sidebar/build-manifest
- Theme: trimmed brand tokens + Starlight overrides (theme.css),
  font declarations (fonts.css), 14 font files (woff/woff2)
- 28 new tests (95 total across 10 files)
- Add vitest.config.ts with test discovery and mock settings
- Switch tsconfig to ESNext/Bundler resolution to avoid Starlight
  source file type-checking issues
- Inline SidebarItem types to remove @astrojs/starlight dependency
- Add @types/node as devDependency for Node.js built-in types
…package

Delete scripts/library-templates/ (normalize-links.ts, build-sidebar-json.ts,
build-manifest.ts, publish-devportal-docs.yml, README.md) now that all
functionality lives in the @algorandfoundation/devportal-docs CLI package.

Update root tsconfig.json to exclude packages/ instead of the removed directory.
Covers quick start, CLI commands, theme setup, type exports,
build pipeline overview, and directory conventions.
…g.mjs

Replace the read-only checkThemeReference with ensureThemeInConfig that
inserts the theme import after the last existing import and prepends
css, fonts to the customCss array. Supports --dry-run and is idempotent.

Tested locally against algokit-utils-ts and algokit-utils-py.
- Add checkTailwind() that verifies tailwindcss is installed and is v4+
- Error if missing or < v4, warn if version range is unparseable
- Add repository and publishConfig fields to package.json for npm publish
- Add .gitignore (dist/, node_modules/, *.tgz)
- Extract shared walkMdDir() utility, eliminate duplicate walk implementations
- Add --base flag validation in resolve-base.ts
- Preserve original tsx error in build-sidebar.ts import fallback
- Add try-catch to JSON.parse calls in init.ts and processFile() in normalize-links.ts
- Fix TypeScript strict typing for pkg.scripts and dependency spreads
- Add integration tests for init run() and normalize-links run()
- Trim redundant tests via equivalence partitioning (113 → 106)
- Remove accidentally committed .tgz build artifact
- Add Array.isArray guard for sidebar export in build-sidebar.ts
- Include themeResult.status in init failure condition
- Warn when customCss pattern not found in ensureThemeInConfig
- Remove undocumented --verbose flag from CLI help and README
- Add Tailwind v4 check to README init description
Add packages/* to root eslint ignores so compiled output isn't linted.
Suppress no-control-regex for intentional \x00 placeholder pattern.
The loader now handles clearing import folders via its "clear" property,
making this manual utility redundant. Also adds live site link to README.
@larkiny larkiny marked this pull request as ready for review February 26, 2026 09:29
larkiny and others added 4 commits February 28, 2026 15:14
Documents the approach for fixing PascalCase-to-lowercase renames
that git doesn't track on macOS due to core.ignorecase=true.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three-task plan: caseRename helper in normalize-links.ts,
fixGitCaseMismatches in import-release-docs.ts, and verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e-links

On macOS (core.ignorecase=true), renameSync('FooBar.md', 'foobar.md')
doesn't update git's index. Use a two-step rename via temp name and
best-effort git mv -f to ensure git tracks the case change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On macOS (core.ignorecase=true), after rmSync + cp -R with lowercase
content from a tarball, git's index may still track old PascalCase names.
After extraction, compare git ls-files against the filesystem and use
git mv -f to fix any case-only mismatches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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