From 488480bffad537fb078432cf4614146e8162f01e Mon Sep 17 00:00:00 2001 From: Josh Black Date: Mon, 1 Dec 2025 15:20:26 -0600 Subject: [PATCH 1/2] chore(build): remove code property from generated components.json --- packages/react/script/components-json/build.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/react/script/components-json/build.ts b/packages/react/script/components-json/build.ts index b9046ded7a1..6a1da6cb210 100644 --- a/packages/react/script/components-json/build.ts +++ b/packages/react/script/components-json/build.ts @@ -160,7 +160,6 @@ const components = docsFiles.map(docsFilepath => { if (id.endsWith('--default')) { return { id, - code: defaultStoryCode, } } const storyName = getStoryName(id) @@ -172,7 +171,7 @@ const components = docsFiles.map(docsFilepath => { ) } - return {id, code} + return {id} }) // Replace the stories array with the new array that includes source code @@ -180,11 +179,10 @@ const components = docsFiles.map(docsFilepath => { // Add default story to the beginning of the array if (defaultStoryCode) { - const hasDefaultStory = docs.stories.find(story => story.code === defaultStoryCode) + const hasDefaultStory = docs.stories.find(story => story.id === defaultStoryId) if (!hasDefaultStory) { docs.stories.unshift({ id: defaultStoryId, - code: defaultStoryCode, }) } } From c69574c37853b346317027c443806dce38ec1e18 Mon Sep 17 00:00:00 2001 From: Josh Black Date: Tue, 2 Dec 2025 14:02:46 -0600 Subject: [PATCH 2/2] refactor: update scripts to no longer need tsx --- packages/react/package.json | 4 ++-- packages/react/script/components-json/build.ts | 4 ++-- packages/react/script/hooks-json/build.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react/package.json b/packages/react/package.json index 8a978a543da..a851a7ce8cb 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -43,8 +43,8 @@ "build:storybook": "storybook build", "build:docs": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs", "build:docs:preview": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs preview", - "build:components.json": "tsx script/components-json/build.ts", - "build:hooks.json": "tsx script/hooks-json/build.ts", + "build:components.json": "node script/components-json/build.ts", + "build:hooks.json": "node script/hooks-json/build.ts", "build:precompile-color-schemes": "tsx script/precompile-color-schemes.ts", "lint:npm": "publint --types", "storybook": "storybook", diff --git a/packages/react/script/components-json/build.ts b/packages/react/script/components-json/build.ts index 6a1da6cb210..8943a9fc6c3 100644 --- a/packages/react/script/components-json/build.ts +++ b/packages/react/script/components-json/build.ts @@ -15,8 +15,8 @@ import prettier from '@prettier/sync' import chalk from 'chalk' import type {LintError} from 'markdownlint' import {lint as mdLint} from 'markdownlint/sync' -import componentSchema from './component.schema.json' -import outputSchema from './output.schema.json' +import componentSchema from './component.schema.json' with {type: 'json'} +import outputSchema from './output.schema.json' with {type: 'json'} const args = parseArgs({ options: { diff --git a/packages/react/script/hooks-json/build.ts b/packages/react/script/hooks-json/build.ts index 4c20cc200ec..9ba7bddb214 100644 --- a/packages/react/script/hooks-json/build.ts +++ b/packages/react/script/hooks-json/build.ts @@ -1,8 +1,8 @@ import glob from 'fast-glob' import fs from 'fs' import keyBy from 'lodash.keyby' -import hookSchema from '../hooks-json/hook.schema.json' -import outputSchema from './output.schema.json' +import hookSchema from '../hooks-json/hook.schema.json' with {type: 'json'} +import outputSchema from './output.schema.json' with {type: 'json'} import Ajv from 'ajv' // Only includes fields we use in this script