@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
29 lines • 969 B
JavaScript
export function buildTheme(themeJson) {
if (!themeJson)
return;
themeJson.processing ?? (themeJson.processing = false);
themeJson.createdAtRuntime ?? (themeJson.createdAtRuntime = false);
const { id, name, role, processing, createdAtRuntime } = themeJson;
return {
id,
name,
processing,
createdAtRuntime,
role: role === 'main' ? 'live' : role,
};
}
export function buildChecksum(asset) {
if (!asset)
return;
const { key, checksum } = asset;
return { key, checksum };
}
export function buildThemeAsset(asset) {
if (!asset)
return;
const { key, checksum, attachment, value } = asset;
// Note: for attachments, this is the size of the base64 string, not the real length of the file
const stats = { size: (value || attachment || '').length, mtime: Date.now() };
return { key, checksum, attachment, value, stats };
}
//# sourceMappingURL=factories.js.map