Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/theme-check-respect-user-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/app': patch
---

`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.
9 changes: 7 additions & 2 deletions packages/app/src/cli/services/build/theme-check.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {readFileSync} from '@shopify/cli-kit/node/fs'
import {fileExists, readFileSync} from '@shopify/cli-kit/node/fs'
import {joinPath} from '@shopify/cli-kit/node/path'
import {itemToString} from '@shopify/cli-kit/node/output'
import {TokenItem} from '@shopify/cli-kit/node/ui'
import {Severity, type Offense, check, path as pathUtils} from '@shopify/theme-check-node'
Expand Down Expand Up @@ -60,7 +61,11 @@ function formatOffenses(offenses: Offense[]): TokenItem {
}

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