Skip to content

Commit

Permalink
fixup! [feature] Generate typed chakra ui theme config file in Typesc…
Browse files Browse the repository at this point in the history
…ript projects
  • Loading branch information
Philzen committed Dec 29, 2024
1 parent e513aed commit f70c86d
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions packages/cli/src/commands/setup/ui/libraries/chakra-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Listr } from 'listr2'

import { recordTelemetryAttributes } from '@redwoodjs/cli-helpers'

import { getPaths, writeFile } from '../../../../lib'
import { getPaths, transformTSToJS, writeFile } from '../../../../lib'
import c from '../../../../lib/colors'
import extendStorybookConfiguration from '../../../../lib/configureStorybook.js'
import { extendJSXFile, fileIncludes } from '../../../../lib/extendFile'
Expand Down Expand Up @@ -93,21 +93,18 @@ export async function handler({ force, install }) {
{
title: `Creating Theme File...`,
task: async () => {
const ts = isTypeScriptProject()
const isTs = isTypeScriptProject()
const themeFilePath = path.join(
rwPaths.web.config,
`chakra.config.${ts ? 'ts' : 'js'}`,
`chakra.config.${isTs ? 'ts' : 'js'}`,
)
writeFile(
themeFilePath,
isTs
? CHAKRA_THEME_AND_COMMENTS
: await transformTSToJS(themeFilePath, CHAKRA_THEME_AND_COMMENTS),
{ overwriteExisting: force },
)
writeFile(themeFilePath, CHAKRA_THEME_AND_COMMENTS, {
overwriteExisting: force,
})
if (ts === false) {
writeFile(
themeFilePath,
await transformTSToJS(themeFilePath, templateContent),
{ overwriteExisting: force },
)
}
},
},
{
Expand Down

0 comments on commit f70c86d

Please sign in to comment.