Skip to content

Commit fce73a5

Browse files
committed
Respect user .theme-check.yml in theme app extension builds
`runThemeCheck` hardcoded `theme-check:theme-app-extension`, which bypassed theme-check-node's user-config discovery. Users who wanted to `ignore:` source directories had to fork the CLI or rely on the dot-prefix trick (hidden dirs are skipped by theme-check's glob). When `.theme-check.yml` exists in the extension root, pass `undefined` so theme-check-node auto-discovers the user config. When absent, keep the existing bundled `theme-app-extension` defaults.
1 parent 243750a commit fce73a5

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/app': patch
3+
---
4+
5+
`runThemeCheck` now respects a user's `.theme-check.yml` in the theme app extension root. When present, theme-check-node auto-discovery is used; otherwise the bundled `theme-check:theme-app-extension` config is applied as before. This lets extensions ignore source directories (e.g. a `src/` folder containing uncompiled Liquid templates) without forking the CLI.

packages/app/src/cli/services/build/theme-check.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {readFileSync} from '@shopify/cli-kit/node/fs'
1+
import {fileExists, readFileSync} from '@shopify/cli-kit/node/fs'
2+
import {joinPath} from '@shopify/cli-kit/node/path'
23
import {itemToString} from '@shopify/cli-kit/node/output'
34
import {TokenItem} from '@shopify/cli-kit/node/ui'
45
import {Severity, type Offense, check, path as pathUtils} from '@shopify/theme-check-node'
@@ -60,7 +61,11 @@ function formatOffenses(offenses: Offense[]): TokenItem {
6061
}
6162

6263
export async function runThemeCheck(directory: string): Promise<string> {
63-
const configPath = 'theme-check:theme-app-extension'
64+
// Respect a user's `.theme-check.yml` in the extension root when present.
65+
// Falling through to `undefined` lets theme-check-node auto-discover the
66+
// user config; otherwise use the bundled theme-app-extension defaults.
67+
const hasUserConfig = await fileExists(joinPath(directory, '.theme-check.yml'))
68+
const configPath = hasUserConfig ? undefined : 'theme-check:theme-app-extension'
6469
const offenses = await check(directory, configPath)
6570
const formattedOffenses = formatOffenses(offenses)
6671
return itemToString(formattedOffenses)

0 commit comments

Comments
 (0)