Skip to content

refactor(swc): target 2nd-gen swc components instead of 1st-gen#46

Merged
marissahuysentruyt merged 13 commits into
mainfrom
swc-s2
May 27, 2026
Merged

refactor(swc): target 2nd-gen swc components instead of 1st-gen#46
marissahuysentruyt merged 13 commits into
mainfrom
swc-s2

Conversation

@marissahuysentruyt
Copy link
Copy Markdown
Collaborator

@marissahuysentruyt marissahuysentruyt commented May 21, 2026

Description

Migrates the SWC component property extraction pipeline from 1st-gen (@spectrum-web-components/sp-*) to 2nd-gen (@adobe/spectrum-wc + swc-* tags), adds extraction tests, and wires up a split test command so browser and Node tests don't step on each other.

What changed and why

Extractor rewrite (deps/swc/extract-cem-components.js, extract-cem-mixins.js): 1st-gen fetched a separate CEM per component package and manually walked inheritance chains + merged mixin data from sp-mixins.json. 2nd-gen ships one shared CEM for all components, and inherited attributes are already flattened onto each component declaration. The extractor now reads a single manifest (local path currently, while the CEM is not published for a CDN), finds a declaration by tagName, and formats its attributes array directly. The mixin-merging and chain-walking logic is removed.

components.json: Switched from a { "sp-tag": "pkg-name" } map to a flat array of swc-* tag names, matching 2nd-gen's single-manifest model.

Data files: Removed 1st-gen sp-action-button.json, sp-button.json, and sp-mixins.json. Generated 11 new 2nd-gen swc-*.json files covering internal and pre-release components.

Table block (blocks/table/table.js): Added EXCLUDED_COLUMNS to strip status and since from the rendered API table. These fields are kept in the JSON for future use but aren't meaningful to component consumers today.

CI (extract-swc-properties.yml): Disabled the daily schedule with a comment to re-enable it once @adobe/spectrum-wc publishes custom-elements.json. Manual dispatch is still available. This prevents daily CI failures while the CEM is unpublished.

Test split (package.json, web-test-runner.config.mjs): Extraction tests use Node built-ins (fs, process.argv) that aren't available in WTR's browser sandbox. npm test now runs test:unit (WTR) and test:extractions (Node test runner) separately. The WTR config explicitly excludes test/extractions/**.

Docs (deps/swc/README.md): Updated to reflect the 2nd-gen workflow, CEM location, manual vs. future automated extraction, and known limitations.

Screenshots (if applicable)

Type of change

  • Bug fix
  • New feature / block
  • Refactor
  • Docs / content
  • Chore (deps, config, tooling)

Related issue(s)

  • fixes spdocs-121

Validation steps

  • This PR has visual elements, so it was reviewed by a designer.
  • This PR has code changes, and our linters still pass.
  • This PR affects production code, so it was browser tested (see below).
  • This PR affects existing pages, so automated E2E tests were run (see below).
  • This PR has new code, so new tests were added or updated, and they pass.
  • This PR has copy changes, so copy was proofread and approved.
  • The content of this PR requires documentation, so a detailed description of the component's purpose, requirements, quirks, and instructions for use by designers and developers was added, along with accessibility information if pertinent.

To Validate

URL for testing:
https://swc-s2--spectrum-hub--adobe.aem.page/platforms/swc/components/button

  • Make sure all PR Checks have passed
  • Pull down the branch locally or visit the branch preview
  • Run npm test and confirm all tests pass
  • Run npm run lint and confirm no linting errors
  • Verified in browser with aem up
  • Navigate to a component page that uses the API data table (for example a swc-button page).
  • Confirm the table renders the new 2nd-gen properties and does not show status or since columns
  • Confirm 1st-gen sp-* data no longer appears in any rendered table
  • Verify extract-swc-properties.yml has the daily schedule commented out and the manual dispatch trigger still works in the Actions tab
  • Pull down a fresh clone of the SWC repo. cd into 2nd-gen/packages/swc/.storybook/. Run yarn install and yarn analyze to generate the new, local CEM.
  • Run the extractor locally against a manually generated CEM to confirm output matches data/swc-*.json. Something like this worked for me when I had both this repo and SWC in the same workspace: node deps/swc/extract-cem-components.js ../spectrum-web-components/2nd-gen/packages/swc/.storybook/custom-elements.json . You should not see any changes.
Screenshot 2026-05-27 at 9 48 22 AM

Accessibility testing checklist

The only user-facing change is that status and since columns are excluded from the API data table. The table is static/non-interactive.

  • Keyboard
  1. Navigate to a component page with an API data table (for example the button page on the branch preview)
  2. Tab into the table
  3. Expect: focus reaches the table; arrow keys continue to scroll the page; no status or since column headers appear; no focus traps or unexpected tab stops
  • Screen reader
  1. With VoiceOver (macOS) or NVDA (Windows) enabled, navigate to a component page with the API data table
  2. Use table navigation (Control+Option+Shift+Down arrow to enter the table, then Control+Option+Arrow keys) to move through the table
  3. Expect: table role is announced; column headers (attribute, property, type, default, description) are announced correctly; status and since are not announced as column headers; row data aligns with headers
Screen.Recording.2026-05-27.at.9.51.14.AM.mov

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

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.

@marissahuysentruyt marissahuysentruyt self-assigned this May 21, 2026
@marissahuysentruyt marissahuysentruyt added 📄 Documentation Improvements or additions to documentation ✨ Feature New feature, enhancement, or request 🚧 WIP Work in progress, don't judge labels May 21, 2026
@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented May 21, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented May 22, 2026

Page Scores Audits Google
📱 /platforms/swc/components/button PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /platforms/swc/components/button PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@marissahuysentruyt marissahuysentruyt marked this pull request as ready for review May 26, 2026 15:55
@marissahuysentruyt marissahuysentruyt added 👀 Ready for review PR is ready for review and removed 🚧 WIP Work in progress, don't judge labels May 26, 2026
@marissahuysentruyt marissahuysentruyt merged commit 1e84cf7 into main May 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📄 Documentation Improvements or additions to documentation ✨ Feature New feature, enhancement, or request 👀 Ready for review PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants