From 7c417caeed4adc2e6c6fd5da6c280218120596ea Mon Sep 17 00:00:00 2001 From: Trish Ta Date: Thu, 9 Oct 2025 18:01:11 -0400 Subject: [PATCH] Remove deprecated print action target uniqueness validator --- .changeset/beige-masks-joke.md | 5 +++ .../app/src/cli/models/app/loader.test.ts | 45 ------------------- packages/app/src/cli/models/app/loader.ts | 37 --------------- .../extensions/specifications/ui_extension.ts | 2 - 4 files changed, 5 insertions(+), 84 deletions(-) create mode 100644 .changeset/beige-masks-joke.md diff --git a/.changeset/beige-masks-joke.md b/.changeset/beige-masks-joke.md new file mode 100644 index 00000000000..bbe86bd77c5 --- /dev/null +++ b/.changeset/beige-masks-joke.md @@ -0,0 +1,5 @@ +--- +'@shopify/app': patch +--- + +Remove redundant Admin print action extension uniqueness validator diff --git a/packages/app/src/cli/models/app/loader.test.ts b/packages/app/src/cli/models/app/loader.test.ts index 3d6f80ee4e7..69621f08dc3 100644 --- a/packages/app/src/cli/models/app/loader.test.ts +++ b/packages/app/src/cli/models/app/loader.test.ts @@ -509,51 +509,6 @@ wrong = "property" await expect(loadTestingApp()).rejects.toThrow(/Duplicated handle/) }) - test('throws an error if the app has more than one print action with the same target', async () => { - // Given - await writeConfig(appConfiguration) - - const blockConfiguration = ` - api_version = "2022-07" - - [[extensions]] - type = "ui_extension" - name = "my_extension_1" - handle = "handle-1" - description = "custom description" - - [[extensions.targeting]] - module = "./src/ActionExtension.js" - target = "admin.product-details.print-action.render" - - [[extensions]] - type = "ui_extension" - handle = "handle-2" - name = "my_extension_2" - description = "custom description" - - [[extensions.targeting]] - module = "./src/ActionExtension.js" - target = "admin.product-details.print-action.render" - ` - await writeBlockConfig({ - blockConfiguration, - name: 'my_extension_1', - }) - - // Create a temporary ActionExtension.js file - const extensionDirectory = joinPath(tmpDir, 'extensions', 'my_extension_1', 'src') - await mkdir(extensionDirectory) - - const tempFilePath = joinPath(extensionDirectory, 'ActionExtension.js') - await writeFile(tempFilePath, '/* ActionExtension.js content */') - - // When - await expect(loadTestingApp()).rejects.toThrow( - `A single target can't support two print action extensions from the same app. Point your extensions at different targets, or remove an extension.\n\nThe following extensions both target admin.product-details.print-action.render:\n · handle-1\n · handle-2`, - ) - }) - test('throws an error if the extension configuration is unified and doesnt include a handle', async () => { // Given await writeConfig(appConfiguration, { diff --git a/packages/app/src/cli/models/app/loader.ts b/packages/app/src/cli/models/app/loader.ts index 2c7e1e0db52..bd30534507d 100644 --- a/packages/app/src/cli/models/app/loader.ts +++ b/packages/app/src/cli/models/app/loader.ts @@ -32,7 +32,6 @@ import {findConfigFiles} from '../../prompts/config.js' import {WebhookSubscriptionSpecIdentifier} from '../extensions/specifications/app_config_webhook_subscription.js' import {WebhooksSchema} from '../extensions/specifications/app_config_webhook_schemas/webhooks_schema.js' import {loadLocalExtensionsSpecifications} from '../extensions/load-specifications.js' -import {UIExtensionSchemaType} from '../extensions/specifications/ui_extension.js' import {patchAppHiddenConfigFile} from '../../services/app/patch-app-configuration-file.js' import {getOrCreateAppConfigHiddenPath} from '../../utilities/app/config/hidden-app-config.js' import {ApplicationURLs, generateApplicationURLs} from '../../services/dev/urls.js' @@ -545,10 +544,6 @@ class AppLoader ext.type === 'ui_extension') - .forEach((extension) => { - const points = extension.configuration.extension_points as UIExtensionSchemaType['extension_points'] - const targets = points.flatMap((point) => point.target).filter((target) => printTargets.includes(target)) - targets.forEach((target) => { - const targetExtensions = duplicates[target] ?? [] - targetExtensions.push(extension) - duplicates[target] = targetExtensions - - if (targetExtensions.length > 1) { - const extensionHandles = ['', ...targetExtensions.map((ext) => ext.configuration.handle)].join('\n · ') - this.abortOrReport( - outputContent`A single target can't support two print action extensions from the same app. Point your extensions at different targets, or remove an extension.\n\nThe following extensions both target ${target}:${extensionHandles}`, - undefined, - extension.configurationPath, - ) - } - }) - }) - } - private getDevApplicationURLs(currentConfiguration: TConfig, webs: Web[]): ApplicationURLs | undefined { const previousDevUrls = this.previousApp?.devApplicationURLs if (!previousDevUrls || !isCurrentAppSchema(currentConfiguration)) return previousDevUrls @@ -1320,10 +1290,3 @@ export function isValidFormatAppConfigurationFileName(configName: string): confi } return false } - -const printTargets = [ - 'admin.order-details.print-action.render', - 'admin.order-index.selection-print-action.render', - 'admin.product-details.print-action.render', - 'admin.product-index.selection-print-action.render', -] diff --git a/packages/app/src/cli/models/extensions/specifications/ui_extension.ts b/packages/app/src/cli/models/extensions/specifications/ui_extension.ts index 5fa481100c7..fce09451958 100644 --- a/packages/app/src/cli/models/extensions/specifications/ui_extension.ts +++ b/packages/app/src/cli/models/extensions/specifications/ui_extension.ts @@ -33,8 +33,6 @@ export interface BuildManifest { const missingExtensionPointsMessage = 'No extension targets defined, add a `targeting` field to your configuration' -export type UIExtensionSchemaType = zod.infer - export const UIExtensionSchema = BaseSchema.extend({ name: zod.string(), type: zod.literal('ui_extension'),