From 0053593cdf1ffd328460707e5751397c0a733498 Mon Sep 17 00:00:00 2001 From: Ryan Bahan Date: Fri, 27 Feb 2026 17:51:18 -0700 Subject: [PATCH] Migrate branding spec to deployConfig + transformRemoteToLocal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove transformConfig, set deployConfig (configWithoutFirstClassFields pass-through) and transformRemoteToLocal directly (app_handle → handle). transformLocalToRemote is now undefined. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../app_config_branding.test.ts | 28 +++++++++---------- .../specifications/app_config_branding.ts | 20 ++++++++----- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/packages/app/src/cli/models/extensions/specifications/app_config_branding.test.ts b/packages/app/src/cli/models/extensions/specifications/app_config_branding.test.ts index 5609510f1d4..95a4a30c547 100644 --- a/packages/app/src/cli/models/extensions/specifications/app_config_branding.test.ts +++ b/packages/app/src/cli/models/extensions/specifications/app_config_branding.test.ts @@ -1,25 +1,25 @@ import spec from './app_config_branding.js' -import {placeholderAppConfiguration} from '../../app/app.test-data.js' import {describe, expect, test} from 'vitest' describe('branding', () => { describe('transform', () => { - test('should return the transformed object', () => { - // Given - const object = { + test('transformLocalToRemote should be undefined', () => { + expect(spec.transformLocalToRemote).toBeUndefined() + }) + }) + + describe('deployConfig', () => { + test('should preserve both name and handle in deploy payload', async () => { + const config = { + type: 'branding', + uid: 'branding', + path: '/test', + extensions: {}, name: 'my-app', handle: 'my-app-handle', } - const appConfigSpec = spec - - // When - const result = appConfigSpec.transformLocalToRemote!(object, placeholderAppConfiguration) - - // Then - expect(result).toMatchObject({ - name: 'my-app', - app_handle: 'my-app-handle', - }) + const result = await spec.deployConfig!(config as any, '', '', undefined) + expect(result).toEqual({name: 'my-app', handle: 'my-app-handle'}) }) }) diff --git a/packages/app/src/cli/models/extensions/specifications/app_config_branding.ts b/packages/app/src/cli/models/extensions/specifications/app_config_branding.ts index 6b71822dd29..b09eaa38da6 100644 --- a/packages/app/src/cli/models/extensions/specifications/app_config_branding.ts +++ b/packages/app/src/cli/models/extensions/specifications/app_config_branding.ts @@ -1,4 +1,4 @@ -import {TransformationConfig, createConfigExtensionSpecification} from '../specification.js' +import {configWithoutFirstClassFields, createConfigExtensionSpecification} from '../specification.js' import {BaseSchemaWithoutHandle} from '../schemas.js' import {zod} from '@shopify/cli-kit/node/schema' @@ -13,17 +13,23 @@ const BrandingSchema = BaseSchemaWithoutHandle.extend({ .optional(), }) -const BrandingTransformConfig: TransformationConfig = { - name: 'name', - app_handle: 'handle', -} - export const BrandingSpecIdentifier = 'branding' const appBrandingSpec = createConfigExtensionSpecification({ identifier: BrandingSpecIdentifier, schema: BrandingSchema, - transformConfig: BrandingTransformConfig, + deployConfig: async (config) => { + // Use configWithoutFirstClassFields to strip type/handle/uid/path/extensions, + // then re-add handle since it's real branding data (not just a base field) + const stripped = configWithoutFirstClassFields(config) + const handle = (config as {handle?: string}).handle + if (handle === undefined) return stripped + return {...stripped, handle} + }, + transformRemoteToLocal: (content: object) => ({ + name: (content as {name?: string}).name, + handle: (content as {app_handle?: string}).app_handle, + }), }) export default appBrandingSpec