Skip to content

Conversation

@joshblack
Copy link
Member

Reverts #7257

@joshblack joshblack requested a review from a team as a code owner December 2, 2025 21:21
@changeset-bot
Copy link

changeset-bot bot commented Dec 2, 2025

⚠️ No Changeset found

Latest commit: 2c62584

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@joshblack joshblack added the skip changeset This change does not need a changelog label Dec 2, 2025
@joshblack joshblack enabled auto-merge December 2, 2025 21:22
@github-actions github-actions bot added the staff Author is a staff member label Dec 2, 2025
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Dec 2, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

Copilot finished reviewing on behalf of joshblack December 2, 2025 21:23
Copy link
Contributor

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 reverts PR #7257, which had removed the code property from generated components.json. The revert restores the code property to story objects and changes the build script execution method from node to tsx to handle JSON imports without import assertions.

Key Changes

  • Re-adds the code property to story objects in the generated components.json output
  • Removes JSON import assertions (with {type: 'json'}) from build scripts
  • Updates npm scripts to use tsx instead of node for executing TypeScript build scripts

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/react/script/hooks-json/build.ts Removes JSON import assertions to use tsx-compatible imports
packages/react/script/components-json/build.ts Removes JSON import assertions and restores code property to story objects at lines 163, 175, and 187
packages/react/package.json Changes build scripts from node to tsx for TypeScript execution

// Add default story to the beginning of the array
if (defaultStoryCode) {
const hasDefaultStory = docs.stories.find(story => story.id === defaultStoryId)
const hasDefaultStory = docs.stories.find(story => story.code === defaultStoryCode)
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

This logic for checking if a default story already exists is incorrect. It's comparing story.code === defaultStoryCode (checking if the code content matches), but it should be comparing story.id === defaultStoryId (checking if the story ID matches).

This could lead to duplicate stories with the same ID if the code content doesn't match exactly, or it could incorrectly skip adding the default story if a different story happens to have identical code.

Suggested fix:

const hasDefaultStory = docs.stories.find(story => story.id === defaultStoryId)
Suggested change
const hasDefaultStory = docs.stories.find(story => story.code === defaultStoryCode)
const hasDefaultStory = docs.stories.find(story => story.id === defaultStoryId)

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@llastflowers llastflowers left a comment

Choose a reason for hiding this comment

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

ty! ✨

@joshblack joshblack added this pull request to the merge queue Dec 2, 2025
Merged via the queue into main with commit 25f4d2b Dec 2, 2025
62 of 63 checks passed
@joshblack joshblack deleted the revert-7257-5431-remove-code-from-generated-json branch December 2, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants