Skip to content

Commit

Permalink
fix: reflect outdir in generated panda config
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed May 29, 2024
1 parent d790711 commit 48ff2b8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/late-dodos-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@pandacss/node': patch
'@pandacss/dev': patch
---

Improve `panda init --outdir=<x>` command to reflect `outdir` in generated panda config file.
11 changes: 10 additions & 1 deletion packages/cli/src/cli-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,16 @@ export async function main() {
await setupPostcss(cwd)
}

await setupConfig(cwd, { force, outExtension, jsxFramework, syntax })
await setupConfig(
cwd,
compact({
force,
outExtension,
jsxFramework,
syntax,
outdir: flags.outdir,
}),
)

const ctx = await loadConfigAndCreateContext({
cwd,
Expand Down
5 changes: 3 additions & 2 deletions packages/node/src/setup-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ type SetupOptions = Partial<Config> & {
}

export async function setupConfig(cwd: string, opts: SetupOptions = {}) {
const { force, outExtension, jsxFramework, syntax } = opts
const { force, outExtension, jsxFramework, syntax, outdir = 'styled-system' } = opts

let configFile: string | undefined

try {
configFile = findConfig({ cwd })
} catch (err) {
Expand Down Expand Up @@ -58,7 +59,7 @@ export default defineConfig({
},
// The output directory for your css system
outdir: "styled-system",
outdir: ${JSON.stringify(outdir)},
${jsxFramework ? `\n // The JSX framework to use\njsxFramework: '${jsxFramework}',` : ''}
${syntax ? `\n // The CSS Syntax to use to use\nsyntax: '${syntax}'` : ''}
})
Expand Down

0 comments on commit 48ff2b8

Please sign in to comment.