@@ -6,30 +6,6 @@ import {joinPath} from '@shopify/cli-kit/node/path'
66import { fileExists , readFile , writeFile } from '@shopify/cli-kit/node/fs'
77import type { AppInterface } from './app.js'
88
9- export interface IdentifiersExtensions {
10- [ localIdentifier : string ] : string
11- }
12-
13- interface Identifiers {
14- /** Application's API Key */
15- app : string
16-
17- /**
18- * The extensions' unique identifiers.
19- */
20- extensions : IdentifiersExtensions
21-
22- /**
23- * The extensions' numeric identifiers (expressed as a string).
24- */
25- extensionIds : IdentifiersExtensions
26-
27- /**
28- * The extensions' unique identifiers which uuid is not managed.
29- */
30- extensionsNonUuidManaged : IdentifiersExtensions
31- }
32-
339export interface ExtensionUuidsByLocalIdentifier {
3410 [ localIdentifier : string ] : string
3511}
@@ -39,11 +15,11 @@ export interface DeployIdentifiers {
3915 appModuleRegistrationIds : ExtensionUuidsByLocalIdentifier
4016}
4117
42- type UuidOnlyIdentifiers = Omit < Identifiers , 'extensionIds' | 'extensionsNonUuidManaged' >
4318type UpdateAppIdentifiersCommand = 'dev' | 'deploy' | 'release' | 'import-extensions'
4419interface UpdateAppIdentifiersOptions {
4520 app : AppInterface
46- identifiers : UuidOnlyIdentifiers
21+ appApiKey : string
22+ extensionUuids : ExtensionUuidsByLocalIdentifier
4723 command : UpdateAppIdentifiersCommand
4824}
4925
@@ -53,7 +29,7 @@ interface UpdateAppIdentifiersOptions {
5329 * @returns An copy of the app with the environment updated to reflect the updated identifiers.
5430 */
5531export async function updateAppIdentifiers (
56- { app, identifiers , command} : UpdateAppIdentifiersOptions ,
32+ { app, appApiKey , extensionUuids , command} : UpdateAppIdentifiersOptions ,
5733 systemEnvironment = process . env ,
5834) : Promise < AppInterface > {
5935 let dotenvFile = app . dotenv
@@ -64,12 +40,12 @@ export async function updateAppIdentifiers(
6440 }
6541 const updatedVariables : { [ key : string ] : string } = { ...( app . dotenv ?. variables ?? { } ) }
6642 if ( ! systemEnvironment [ app . idEnvironmentVariableName ] ) {
67- updatedVariables [ app . idEnvironmentVariableName ] = identifiers . app
43+ updatedVariables [ app . idEnvironmentVariableName ] = appApiKey
6844 }
69- Object . keys ( identifiers . extensions ) . forEach ( ( identifier ) => {
45+ Object . keys ( extensionUuids ) . forEach ( ( identifier ) => {
7046 const envVariable = `SHOPIFY_${ constantize ( identifier ) } _ID`
7147 if ( ! systemEnvironment [ envVariable ] ) {
72- updatedVariables [ envVariable ] = identifiers . extensions [ identifier ] !
48+ updatedVariables [ envVariable ] = extensionUuids [ identifier ] !
7349 }
7450 } )
7551
0 commit comments