Skip to content

Commit

Permalink
feat: config validation (#2088)
Browse files Browse the repository at this point in the history
* feat: config validation

* refactor: split config validation + add config.validation level

* chore: cleanup

* refactor: error handling and config validations

* refactor: test file

* refactor: validate breakpoint

* refactor: types

* refactor: some stuff

---------

Co-authored-by: Segun Adebayo <[email protected]>
  • Loading branch information
astahmer and segunadebayo authored Jan 28, 2024
1 parent f778d3e commit ea3f554
Show file tree
Hide file tree
Showing 41 changed files with 870 additions and 385 deletions.
16 changes: 16 additions & 0 deletions .changeset/mean-worms-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@pandacss/config': patch
---

Add config validation:

- Check for duplicate between token & semanticTokens names
- Check for duplicate between recipes/patterns/slots names
- Check for token / semanticTokens paths (must end/contain 'value')
- Check for self/circular token references
- Check for missing tokens references
- Check for conditions selectors (must contain '&')
- Check for breakpoints units (must be the same)

> You can set `validate: 'warn'` in your config to only warn about errors or set it to `none` to disable validation
> entirely.
1 change: 0 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"dependencies": {
"@clack/prompts": "^0.6.3",
"@pandacss/config": "workspace:*",
"@pandacss/error": "workspace:*",
"@pandacss/logger": "workspace:*",
"@pandacss/node": "workspace:*",
"@pandacss/postcss": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/cli-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
writeAnalyzeJSON,
type CssGenOptions,
} from '@pandacss/node'
import { compact } from '@pandacss/shared'
import { PandaError, compact } from '@pandacss/shared'
import type { CssArtifactType } from '@pandacss/types'
import { cac } from 'cac'
import { join, resolve } from 'path'
Expand Down Expand Up @@ -294,7 +294,7 @@ export async function main() {
studio = require(studioPath)
} catch (error) {
logger.error('studio', error)
throw new Error("You need to install '@pandacss/studio' to use this command")
throw new PandaError('MISSING_STUDIO', "You need to install '@pandacss/studio' to use this command")
}

if (preview) {
Expand Down
Loading

3 comments on commit ea3f554

@vercel
Copy link

@vercel vercel bot commented on ea3f554 Jan 28, 2024

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on ea3f554 Jan 28, 2024

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

panda-docs – ./website

panda-docs.vercel.app
panda-css.com
panda-docs-chakra-ui.vercel.app
panda-docs-git-main-chakra-ui.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ea3f554 Jan 28, 2024

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

panda-studio – ./

panda-studio-chakra-ui.vercel.app
panda-app.vercel.app
panda-studio-git-main-chakra-ui.vercel.app

Please sign in to comment.