@@ -181,34 +181,20 @@ for (const [componentName, [node]] of source.getExportedDeclarations()) {
181181 }
182182}
183183
184- /**
185- * Generate the JSON string of the PrimitiveCatalog
186- * this is being exported under the /primitives.json subpath and can be used as
187- * import PrimitiveCatalog from '@aws-amplify/ui-react/primitives.json'
188- */
189- const jsonString = JSON . stringify ( catalog , null , 2 ) ;
190-
191184/**
192185 * Generate the es module of the PrimitiveCatalog
193186 * this is being exported under the /internal/primitives-catalog subpath and can be used as
194187 * import { PrimitiveCatalog } from '@aws-amplify/ui-react/internal/primitives-catalog'
195188 */
189+ const primitiveCatalog = JSON . stringify ( catalog , null , 2 ) ;
196190const exportString = `import { PrimitiveCatalogType } from './types/catalog';
197- export const PrimitiveCatalog: PrimitiveCatalogType = ${ jsonString } ;` ;
191+ export const PrimitiveCatalog: PrimitiveCatalogType = ${ primitiveCatalog } ;` ;
198192
199- // Generates dist folder file since it's deleted in `prebuild`
200- // NOTE: This line can be removed when we remove primitives.json output
201- const distFolderPath = `${ path . resolve ( __dirname , '..' ) } /dist` ;
202- if ( ! fs . existsSync ( distFolderPath ) ) {
203- fs . mkdirSync ( distFolderPath ) ;
204- }
205-
206- const JSONoutputPath = `${ path . resolve ( __dirname , '..' ) } /dist/primitives.json` ;
207193const internalOutputPath = path . resolve (
208194 __dirname ,
209195 '..' ,
210196 'src' ,
211197 'PrimitiveCatalog.ts'
212198) ;
213- fs . writeFileSync ( JSONoutputPath , jsonString , { flag : 'w' } ) ;
199+
214200fs . writeFileSync ( internalOutputPath , exportString , { flag : 'w' } ) ;
0 commit comments