Skip to content

Commit c772d26

Browse files
amcaplanclaude
andcommitted
Remove yaml from theme; use js-yaml for stringify
Co-Authored-By: Claude <noreply@anthropic.com> 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent aadc0c1 commit c772d26

3 files changed

Lines changed: 253 additions & 293 deletions

File tree

packages/theme/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@
4646
"@shopify/theme-language-server-node": "2.21.0",
4747
"chokidar": "3.6.0",
4848
"h3": "1.15.9",
49-
"yaml": "2.8.3"
49+
"js-yaml": "4.1.1"
5050
},
5151
"devDependencies": {
5252
"@shopify/theme-hot-reload": "^0.0.22",
53+
"@types/js-yaml": "^4.0.9",
5354
"@vitest/coverage-istanbul": "^3.1.4",
5455
"node-stream-zip": "^1.15.0"
5556
},

packages/theme/src/cli/services/check.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
type Theme,
1414
path as pathUtils,
1515
} from '@shopify/theme-check-node'
16-
import YAML from 'yaml'
16+
import {dump as yamlDump} from 'js-yaml'
1717

1818
type OffenseMap = Record<string, Offense[]>
1919

@@ -265,9 +265,9 @@ export async function initConfig(root: string) {
265265
// The initialized config will extend the recommended settings and
266266
// will simply show the commented checks for the user to customize.
267267
const {settings} = await loadConfig(undefined, root)
268-
const checksYml = commentString(YAML.stringify(settings))
268+
const checksYml = commentString(yamlDump(settings))
269269

270-
const initConfigYml = YAML.stringify({extends: 'theme-check:recommended', ignore: ['node_modules/**']})
270+
const initConfigYml = yamlDump({extends: 'theme-check:recommended', ignore: ['node_modules/**']})
271271

272272
await writeFile(filePath, `${initConfigYml}${checksYml}`)
273273

@@ -301,7 +301,7 @@ export async function outputActiveConfig(themeRoot: string, configPath?: string,
301301
...settings,
302302
}
303303
const output = environment ? {[environment]: config} : config
304-
outputResult(YAML.stringify(output))
304+
outputResult(yamlDump(output))
305305
}
306306

307307
export async function outputActiveChecks(root: string, configPath?: string, environment?: string) {
@@ -341,7 +341,7 @@ export async function outputActiveChecks(root: string, configPath?: string, envi
341341
}, {})
342342

343343
const output = environment ? {[environment]: checksList} : checksList
344-
outputResult(YAML.stringify(output))
344+
outputResult(yamlDump(output))
345345
}
346346

347347
interface ExtendedWriteStream extends NodeJS.WriteStream {

0 commit comments

Comments
 (0)