From d7e76876e7ff762be5906333600b3bb66a236d52 Mon Sep 17 00:00:00 2001 From: Ariel Caplan Date: Fri, 5 Jun 2026 06:39:47 +0300 Subject: [PATCH] Remove yaml from theme; use js-yaml for stringify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- packages/theme/package.json | 3 ++- packages/theme/src/cli/services/check.ts | 10 +++++----- pnpm-lock.yaml | 14 +++++++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/theme/package.json b/packages/theme/package.json index 2bd8f868595..d43a11e30f0 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -46,10 +46,11 @@ "@shopify/theme-language-server-node": "2.21.2", "chokidar": "3.6.0", "h3": "1.15.11", - "yaml": "2.9.0" + "js-yaml": "4.1.1" }, "devDependencies": { "@shopify/theme-hot-reload": "^0.0.22", + "@types/js-yaml": "^4.0.9", "@vitest/coverage-istanbul": "^3.1.4", "node-stream-zip": "^1.15.0" }, diff --git a/packages/theme/src/cli/services/check.ts b/packages/theme/src/cli/services/check.ts index c7f74076327..fc6f85af549 100644 --- a/packages/theme/src/cli/services/check.ts +++ b/packages/theme/src/cli/services/check.ts @@ -13,7 +13,7 @@ import { type Theme, path as pathUtils, } from '@shopify/theme-check-node' -import YAML from 'yaml' +import {dump as yamlDump} from 'js-yaml' type OffenseMap = Record @@ -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(yamlDump(settings)) - const initConfigYml = YAML.stringify({extends: 'theme-check:recommended', ignore: ['node_modules/**']}) + const initConfigYml = yamlDump({extends: 'theme-check:recommended', ignore: ['node_modules/**']}) await writeFile(filePath, `${initConfigYml}${checksYml}`) @@ -301,7 +301,7 @@ export async function outputActiveConfig(themeRoot: string, configPath?: string, ...settings, } const output = environment ? {[environment]: config} : config - outputResult(YAML.stringify(output)) + outputResult(yamlDump(output)) } export async function outputActiveChecks(root: string, configPath?: string, environment?: string) { @@ -341,7 +341,7 @@ export async function outputActiveChecks(root: string, configPath?: string, envi }, {}) const output = environment ? {[environment]: checksList} : checksList - outputResult(YAML.stringify(output)) + outputResult(yamlDump(output)) } interface ExtendedWriteStream extends NodeJS.WriteStream { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 14f692d8199..e3c74c0910c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -676,13 +676,16 @@ importers: h3: specifier: 1.15.11 version: 1.15.11 - yaml: - specifier: 2.9.0 - version: 2.9.0 + js-yaml: + specifier: 4.1.1 + version: 4.1.1 devDependencies: '@shopify/theme-hot-reload': specifier: ^0.0.22 version: 0.0.22 + '@types/js-yaml': + specifier: ^4.0.9 + version: 4.0.9 '@vitest/coverage-istanbul': specifier: ^3.1.4 version: 3.2.4(vitest@4.1.8) @@ -4187,6 +4190,9 @@ packages: '@types/http-cache-semantics@4.2.0': resolution: {integrity: sha512-L3LgimLHXtGkWikKnsPg0/VFx9OGZaC+eN1u4r+OB1XRqH3meBIAVC2zr1WdMH+RHmnRkqliQAOHNJ/E0j/e0Q==} + '@types/js-yaml@4.0.9': + resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} + '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} @@ -13658,6 +13664,8 @@ snapshots: '@types/http-cache-semantics@4.2.0': {} + '@types/js-yaml@4.0.9': {} + '@types/json-schema@7.0.15': {} '@types/lodash@4.17.19': {}