Skip to content

fix(docs): resolve.mjs crash and duplicate work in s2-tokens-viewer - #1350

Merged
GarthDB merged 2 commits into
mainfrom
fix/resolve-mjs-cascade-dedupe
Aug 20, 2026
Merged

fix(docs): resolve.mjs crash and duplicate work in s2-tokens-viewer#1350
GarthDB merged 2 commits into
mainfrom
fix/resolve-mjs-cascade-dedupe

Conversation

@GarthDB

@GarthDB GarthDB commented Aug 19, 2026

Copy link
Copy Markdown
Member

Description

Fixes two issues in docs/s2-tokens-viewer/scripts/resolve.mjs found during
review of #1341:

  • scripts/resolve.mjs: loadCascadeTokens() now throws a clear error naming
    moon run viewer:convert when cascade/ is missing, instead of an uncaught ENOENT.
  • scripts/resolve.mjs: merged buildColorComponentFile() and buildLayoutComponentFile()
    into a single buildComponentFiles() pass over tokensDir so each component token file is
    read, parsed, and checked for color-domain only once instead of twice.

Related Issue

Found during review of #1341.

Motivation and Context

The missing-cascade/ case failed with a raw ENOENT stack trace instead of telling the
developer how to fix it, and the two build functions duplicated the same file-read/parse/
color-check work for no benefit.

How Has This Been Tested?

  • Ran moon run s2-tokens-viewer:convert then node scripts/resolve.mjs — output matches
    the prior known-good aggregate counts (83 color-component tokens, 1267 layout-component
    tokens, 4194 cascade tokens, 0 missing in wasm resolution).
  • Renamed cascade/ away and reran — got the new clear error instead of an uncaught ENOENT.
  • node tools/changeset-linter/src/cli.js check --fail-on-warnings passes.

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.



loadCascadeTokens() threw an uncaught ENOENT when cascade/ was missing instead
of pointing at the fix, and the component-file build read every per-component
token file twice (once for color, once for layout).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 84f9334

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
s2-tokens-viewer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

🧩 Component Schema Changes Report

No component schema changes detected.

This comment was automatically generated by the component schema diff tool. 🤖

@github-actions

Copy link
Copy Markdown
Contributor

🎨 Token Changes Report

Tokens Changed (0)

Original Branch: main


This comment was automatically generated by the token diff tool. 🤖

@GarthDB
GarthDB merged commit 432ec03 into main Aug 20, 2026
9 checks passed
@GarthDB
GarthDB deleted the fix/resolve-mjs-cascade-dedupe branch August 20, 2026 16:01
@GarthDB GarthDB mentioned this pull request Aug 20, 2026
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