@@ -5,6 +5,8 @@ import {groupBy, partition} from '@shopify/cli-kit/common/collection'
55import { uniqBy , difference } from '@shopify/cli-kit/common/array'
66import { pickBy } from '@shopify/cli-kit/common/object'
77import { slugify } from '@shopify/cli-kit/common/string'
8+ import { outputInfo } from '@shopify/cli-kit/node/output'
9+ import colors from '@shopify/cli-kit/node/colors'
810
911export interface LocalRemoteSource {
1012 local : LocalSource
@@ -79,32 +81,53 @@ function matchByUIDandUUID(
7981 toConfirm : { local : LocalSource ; remote : RemoteSource } [ ]
8082 toManualMatch : { local : LocalSource [ ] ; remote : RemoteSource [ ] }
8183} {
82- const matched : IdentifiersExtensions = { }
84+ const matchedByUID : IdentifiersExtensions = { }
8385 const pendingLocal : LocalSource [ ] = [ ]
86+ const matchedByUUID : IdentifiersExtensions = { }
8487
8588 // First, try to match by UID, then by UUID.
8689 local . forEach ( ( localSource ) => {
8790 const matchByUID = remote . find ( ( remoteSource ) => remoteSource . id === localSource . uid )
8891 const matchByUUID = remote . find ( ( remoteSource ) => remoteSource . uuid === ids [ localSource . localIdentifier ] )
8992
9093 if ( matchByUID ) {
91- matched [ localSource . localIdentifier ] = matchByUID . id
94+ matchedByUID [ localSource . localIdentifier ] = matchByUID . id
9295 } else if ( matchByUUID ) {
93- matched [ localSource . localIdentifier ] = matchByUUID . uuid
96+ matchedByUUID [ localSource . localIdentifier ] = matchByUUID . uuid
9497 } else {
9598 pendingLocal . push ( localSource )
9699 }
97100 } )
98101
99102 const pendingRemote = remote . filter (
100103 ( remoteSource ) =>
101- ! Object . values ( matched ) . includes ( remoteSource . uuid ) && ! Object . values ( matched ) . includes ( remoteSource . id ) ,
104+ ! Object . values ( matchedByUUID ) . includes ( remoteSource . uuid ) &&
105+ ! Object . values ( matchedByUID ) . includes ( remoteSource . id ) ,
102106 )
103107
104108 // Then, try to match by name and type as a last resort.
105109 const { matched : matchedByName , toCreate, toConfirm, toManualMatch} = matchByNameAndType ( pendingLocal , pendingRemote )
106110
107- return { matched : { ...matched , ...matchedByName } , toCreate, toConfirm, toManualMatch}
111+ // List of modules that were matched using anything other than the UID, meaning that they are being migrated to dev dash
112+ const totalMatchedWithoutUID = { ...matchedByUUID , ...matchedByName }
113+ const localMatchedWithoutUID = local . filter ( ( localSource ) => totalMatchedWithoutUID [ localSource . localIdentifier ] )
114+
115+ outputAddedIDs ( localMatchedWithoutUID )
116+
117+ return { matched : { ...matchedByUID , ...totalMatchedWithoutUID } , toCreate, toConfirm, toManualMatch}
118+ }
119+
120+ function outputAddedIDs ( localMatchedWithoutUID : LocalSource [ ] ) {
121+ if ( localMatchedWithoutUID . length === 0 ) return
122+ const colorList = [ colors . cyan , colors . magenta , colors . blue , colors . green , colors . yellow , colors . red ]
123+
124+ const maxHandleLength = localMatchedWithoutUID . reduce ( ( max , local ) => Math . max ( max , local . handle . length ) , 0 )
125+ outputInfo ( 'Generating extension IDs\n' )
126+ localMatchedWithoutUID . forEach ( ( local , index ) => {
127+ const color = colorList [ index % colorList . length ] ?? colors . white
128+ outputInfo ( `${ color ( local . handle . padStart ( maxHandleLength ) ) } | Added ID: ${ local . uid } ` )
129+ } )
130+ outputInfo ( '\n' )
108131}
109132
110133/**
0 commit comments