Skip to content

Commit

Permalink
fix: add missing types folder in config dependencies (#2239)
Browse files Browse the repository at this point in the history
* fix: add missing types folder in config dependencies

* chore: add changeset
  • Loading branch information
astahmer authored Feb 22, 2024
1 parent f419993 commit 89ffb6b
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 40 deletions.
7 changes: 7 additions & 0 deletions .changeset/thick-laws-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@pandacss/config': patch
'@pandacss/types': patch
'@pandacss/node': patch
---

Add missing config dependencies for some `styled-system/types` files
72 changes: 36 additions & 36 deletions packages/config/__tests__/merge-hooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,36 +114,36 @@ describe('mergeConfigs / theme', () => {

expect(args.original).toBe(original)
expect(args.original).toMatchInlineSnapshot(`
[
{
"files": [
{
"code": "aaa aaa aaa",
"file": "aaa.js",
},
],
"id": "1",
},
{
"files": [
{
"code": "bbb bbb bbb",
"file": "bbb.js",
},
],
"id": "2",
},
{
"files": [
{
"code": "ccc ccc ccc",
"file": "ccc.js",
},
],
"id": "3",
},
]
`)
[
{
"files": [
{
"code": "aaa aaa aaa",
"file": "aaa.js",
},
],
"id": "recipes.1",
},
{
"files": [
{
"code": "bbb bbb bbb",
"file": "bbb.js",
},
],
"id": "recipes.2",
},
{
"files": [
{
"code": "ccc ccc ccc",
"file": "ccc.js",
},
],
"id": "recipes.3",
},
]
`)
return args.artifacts.map((art) => {
return { ...art, files: art.files.map((f) => ({ ...f, code: (f.code || '').replace('bbb', 'zzz') })) }
})
Expand All @@ -155,9 +155,9 @@ describe('mergeConfigs / theme', () => {
const result = hooks['codegen:prepare']?.({
changed: [],
artifacts: [
{ id: '1', files: [{ code: 'aaa aaa aaa', file: 'aaa.js' }] },
{ id: '2', files: [{ code: 'bbb bbb bbb', file: 'bbb.js' }] },
{ id: '3', files: [{ code: 'ccc ccc ccc', file: 'ccc.js' }] },
{ id: 'recipes.1', files: [{ code: 'aaa aaa aaa', file: 'aaa.js' }] },
{ id: 'recipes.2', files: [{ code: 'bbb bbb bbb', file: 'bbb.js' }] },
{ id: 'recipes.3', files: [{ code: 'ccc ccc ccc', file: 'ccc.js' }] },
],
})

Expand All @@ -176,7 +176,7 @@ describe('mergeConfigs / theme', () => {
"file": "aaa.js",
},
],
"id": "1",
"id": "recipes.1",
},
{
"files": [
Expand All @@ -185,7 +185,7 @@ describe('mergeConfigs / theme', () => {
"file": "bbb.js",
},
],
"id": "2",
"id": "recipes.2",
},
{
"files": [
Expand All @@ -194,7 +194,7 @@ describe('mergeConfigs / theme', () => {
"file": "ccc.js",
},
],
"id": "3",
"id": "recipes.3",
},
]
`)
Expand Down
6 changes: 6 additions & 0 deletions packages/config/src/config-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ const artifactConfigDeps: Record<ArtifactId, ConfigPath[]> = {
'jsx-patterns-index': jsx.concat('patterns'),
'css-index': ['syntax'],
'package.json': ['emitPackage', 'forceConsistentTypeExtension', 'outExtension'],
'types-styles': ['shorthands'],
'types-conditions': ['conditions'],
'types-jsx': jsx,
'types-entry': [],
'types-gen': [],
'types-gen-system': [],
}

// Prepare a list of regex that resolves to an artifact id from a list of config paths
Expand Down
4 changes: 2 additions & 2 deletions packages/config/src/diff-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export function diffConfigs(config: ConfigOrFn, prevConfig: Config | undefined):
// same for recipes, use dashCase since those will be used as filenames
if (id === 'recipes') {
// ['theme', 'recipes', 'xxx'] => recipes.xxx
const name = dashCase(change.path.slice(1, 3).join('.') as ArtifactId)
const name = dashCase(change.path.slice(1, 3).join('.')) as ArtifactId
affected.artifacts.add(name)
}

if (id === 'patterns') {
// ['patterns', 'xxx'] => patterns.xxx
const name = dashCase(change.path.slice(0, 2).join('.') as ArtifactId)
const name = dashCase(change.path.slice(0, 2).join('.')) as ArtifactId
affected.artifacts.add(name)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/create-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class PandaContext extends Generator {
writeCss = (sheet?: Stylesheet) => {
logger.info('css', this.runtime.path.join(...this.paths.root, 'styles.css'))
return this.output.write({
id: 'styles.css',
id: 'styles.css' as any,
dir: this.paths.root,
files: [{ file: 'styles.css', code: this.getCss(sheet) }],
})
Expand Down
9 changes: 8 additions & 1 deletion packages/types/src/artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ export type ArtifactId =
| 'jsx-patterns-index'
| 'css-index'
| 'package.json'
| (string & {})
| 'types-jsx'
| 'types-entry'
| 'types-styles'
| 'types-conditions'
| 'types-gen'
| 'types-gen-system'
| `recipes.${string}`
| `patterns.${string}`

export type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes'

Expand Down

0 comments on commit 89ffb6b

Please sign in to comment.