Skip to content
Draft
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/replace-yaml-with-js-yaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/theme': patch
---

Replace `yaml` dependency with `js-yaml` and replace `YAML.stringify` with `js-yaml`'s `dump`
3 changes: 2 additions & 1 deletion packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
"@shopify/cli-kit": "4.1.0",
"@shopify/theme-check-node": "3.25.0",
"@shopify/theme-language-server-node": "2.21.0",
"@types/js-yaml": "^4.0.9",
"chokidar": "3.6.0",
"h3": "1.15.9",
"yaml": "2.8.3"
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@shopify/theme-hot-reload": "^0.0.22",
Expand Down
10 changes: 5 additions & 5 deletions packages/theme/src/cli/services/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
type Theme,
path as pathUtils,
} from '@shopify/theme-check-node'
import YAML from 'yaml'
import {dump} from 'js-yaml'

type OffenseMap = Record<string, Offense[]>

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

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

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

Expand Down Expand Up @@ -301,7 +301,7 @@ export async function outputActiveConfig(themeRoot: string, configPath?: string,
...settings,
}
const output = environment ? {[environment]: config} : config
outputResult(YAML.stringify(output))
outputResult(dump(output))
}

export async function outputActiveChecks(root: string, configPath?: string, environment?: string) {
Expand Down Expand Up @@ -341,7 +341,7 @@ export async function outputActiveChecks(root: string, configPath?: string, envi
}, {})

const output = environment ? {[environment]: checksList} : checksList
outputResult(YAML.stringify(output))
outputResult(dump(output))
}

interface ExtendedWriteStream extends NodeJS.WriteStream {
Expand Down
Loading
Loading