@shopify/theme-check-docs-updater
Advanced tools
Comparing version 1.20.1 to 1.21.0
# @shopify/theme-check-docs-updater | ||
## 1.21.0 | ||
### Minor Changes | ||
- 772a1ce: Update `translation-key-exists` check and intelligent code completion to always stay up-to-date with Shopify translation keys | ||
### Patch Changes | ||
- Updated dependencies [772a1ce] | ||
- Updated dependencies [b05a6a8] | ||
- @shopify/theme-check-common@1.21.0 | ||
## 1.20.1 | ||
@@ -4,0 +16,0 @@ |
export type Resource = (typeof Resources)[number]; | ||
export declare const Resources: readonly ["filters", "objects", "tags", "section_schema"]; | ||
export declare const Resources: readonly ["filters", "objects", "tags", "section_schema", "shopify_system_translations"]; | ||
export declare function downloadFile(file: Resource | 'latest', destination: string): Promise<void>; | ||
export declare function exists(path: string): Promise<boolean>; | ||
export declare function downloadThemeLiquidDocs(outputDir: string): Promise<void>; |
@@ -10,3 +10,9 @@ "use strict"; | ||
const node_path_1 = __importDefault(require("node:path")); | ||
exports.Resources = ['filters', 'objects', 'tags', 'section_schema']; | ||
exports.Resources = [ | ||
'filters', | ||
'objects', | ||
'tags', | ||
'section_schema', | ||
'shopify_system_translations', | ||
]; | ||
const THEME_LIQUID_DOCS = { | ||
@@ -18,2 +24,3 @@ filters: 'data/filters.json', | ||
section_schema: 'schemas/theme/section_schema.json', | ||
shopify_system_translations: 'data/shopify_system_translations.json', | ||
}; | ||
@@ -20,0 +27,0 @@ async function downloadFile(file, destination) { |
@@ -1,2 +0,2 @@ | ||
import { FilterEntry, ObjectEntry, TagEntry, ThemeDocset, JsonSchemaValidators } from '@shopify/theme-check-common'; | ||
import { FilterEntry, ObjectEntry, TagEntry, ThemeDocset, JsonSchemaValidators, Translations } from '@shopify/theme-check-common'; | ||
import { ValidateFunction } from 'ajv'; | ||
@@ -10,2 +10,3 @@ type Logger = (message: string) => void; | ||
tags: () => Promise<TagEntry[]>; | ||
systemTranslations: () => Promise<Translations>; | ||
validateSectionSchema: () => Promise<ValidateFunction<unknown>>; | ||
@@ -12,0 +13,0 @@ /** |
@@ -25,2 +25,5 @@ "use strict"; | ||
}); | ||
this.systemTranslations = (0, utils_1.memo)(async () => { | ||
return this.loadResource('shopify_system_translations', {}); | ||
}); | ||
this.validateSectionSchema = (0, utils_1.memo)(async () => { | ||
@@ -27,0 +30,0 @@ const sectionSchema = await this.loadResource('section_schema', {}); |
{ | ||
"name": "@shopify/theme-check-docs-updater", | ||
"version": "1.20.1", | ||
"version": "1.21.0", | ||
"description": "Scripts to initialize theme-check data with assets from the theme-liquid-docs repo.", | ||
@@ -23,3 +23,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@shopify/theme-check-common": "^1.20.1", | ||
"@shopify/theme-check-common": "^1.21.0", | ||
"ajv": "^8.12.0", | ||
@@ -26,0 +26,0 @@ "env-paths": "^2.2.1", |
@@ -6,3 +6,9 @@ import fs from 'node:fs/promises'; | ||
export type Resource = (typeof Resources)[number]; | ||
export const Resources = ['filters', 'objects', 'tags', 'section_schema'] as const; | ||
export const Resources = [ | ||
'filters', | ||
'objects', | ||
'tags', | ||
'section_schema', | ||
'shopify_system_translations', | ||
] as const; | ||
@@ -15,2 +21,3 @@ const THEME_LIQUID_DOCS: Record<Resource | 'latest', string> = { | ||
section_schema: 'schemas/theme/section_schema.json', | ||
shopify_system_translations: 'data/shopify_system_translations.json', | ||
}; | ||
@@ -17,0 +24,0 @@ |
@@ -37,2 +37,4 @@ import { expect, describe, it, beforeEach, afterEach, vi } from 'vitest'; | ||
'{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"number"}},"required":["name","age"]}', | ||
'MOCKED_CACHE/theme-liquid-docs/shopify_system_translations.json': | ||
'{"shopify.checkout.general.cart": "Cart"}', | ||
}; | ||
@@ -100,2 +102,11 @@ | ||
describe('Unit: systemTranslations', () => { | ||
it('should return the parsed JSON content of the system translations', async () => { | ||
const systemTranslations = await manager.systemTranslations(); | ||
expect(systemTranslations).to.eql({ | ||
'shopify.checkout.general.cart': 'Cart', | ||
}); | ||
}); | ||
}); | ||
describe('Unit: validateSectionSchema', () => { | ||
@@ -102,0 +113,0 @@ it('should return a validator for the given json schema', async () => { |
@@ -7,2 +7,3 @@ import { | ||
JsonSchemaValidators, | ||
Translations, | ||
} from '@shopify/theme-check-common'; | ||
@@ -34,2 +35,6 @@ import { ValidateFunction } from 'ajv'; | ||
systemTranslations = memo(async (): Promise<Translations> => { | ||
return this.loadResource('shopify_system_translations', {}); | ||
}); | ||
validateSectionSchema = memo(async (): Promise<ValidateFunction> => { | ||
@@ -36,0 +41,0 @@ const sectionSchema = await this.loadResource('section_schema', {}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87743
709