-
Notifications
You must be signed in to change notification settings - Fork 228
Migrate app_home spec to deployConfig + transformRemoteToLocal #6911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rcb/contract-branding
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import {validateUrl} from '../../app/validation/common.js' | ||
| import {BaseSchemaWithoutHandle} from '../schemas.js' | ||
| import {TransformationConfig, createConfigExtensionSpecification} from '../specification.js' | ||
| import {configWithoutFirstClassFields, createConfigExtensionSpecification} from '../specification.js' | ||
| import {getPathValue, setPathValue} from '@shopify/cli-kit/common/object' | ||
| import {zod} from '@shopify/cli-kit/node/schema' | ||
|
|
||
| const AppHomeSchema = BaseSchemaWithoutHandle.extend({ | ||
|
|
@@ -13,18 +14,25 @@ const AppHomeSchema = BaseSchemaWithoutHandle.extend({ | |
| .optional(), | ||
| }) | ||
|
|
||
| const AppHomeTransformConfig: TransformationConfig = { | ||
| app_url: 'application_url', | ||
| embedded: 'embedded', | ||
| preferences_url: 'app_preferences.url', | ||
| } | ||
|
|
||
| export const AppHomeSpecIdentifier = 'app_home' | ||
|
|
||
| const appHomeSpec = createConfigExtensionSpecification({ | ||
| identifier: AppHomeSpecIdentifier, | ||
| schema: AppHomeSchema, | ||
| transformConfig: AppHomeTransformConfig, | ||
| deployConfig: async (config) => { | ||
| const {name, ...rest} = configWithoutFirstClassFields(config) | ||
| return rest | ||
| }, | ||
| transformRemoteToLocal: (remoteContent: object) => { | ||
| const result: {[key: string]: unknown} = {} | ||
| const appUrl = getPathValue(remoteContent, 'app_url') | ||
| if (appUrl !== undefined) result.application_url = appUrl | ||
| const embedded = getPathValue(remoteContent, 'embedded') | ||
| if (embedded !== undefined) result.embedded = embedded | ||
| const preferencesUrl = getPathValue(remoteContent, 'preferences_url') | ||
| if (preferencesUrl !== undefined) setPathValue(result, 'app_preferences.url', preferencesUrl) | ||
| return result | ||
| }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Evidence: const appUrl = getPathValue(remoteContent, 'app_url')
if (appUrl !== undefined) result.application_url = appUrl
...
const preferencesUrl = getPathValue(remoteContent, 'preferences_url')
if (preferencesUrl !== undefined) setPathValue(result, 'app_preferences.url', preferencesUrl)
Impact:
|
||
| patchWithAppDevURLs: (config, urls) => { | ||
| config.application_url = urls.applicationUrl | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing forward mapping in deployConfig after removing transformLocalToRemote
The PR removes transformConfig (which previously generated transformLocalToRemote) and tests that transformLocalToRemote is now undefined. However, deployConfig currently strips first-class fields and returns the remaining config as-is.
Local schema uses: application_url, embedded, app_preferences.url. Platform expects: app_url, embedded, preferences_url. With the current deployConfig implementation returning the rest object, the deploy payload will likely include application_url and app_preferences rather than app_url and preferences_url.
Evidence: createConfigExtensionSpecification only builds transformLocalToRemote from transformConfig; this PR removes transformConfig so no forward transform exists. Nothing in deployConfig performs required key translation. Impact: app home config may not apply, server-side validation may fail, deploys can be blocked, or production routing can break for all users deploying/updating app_home via this CLI path.