@@ -2127,6 +2127,15 @@ function hasUpdaterInText(content: string | undefined): boolean {
21272127 return / @ c a p g o \/ c a p a c i t o r - u p d a t e r | C a p g o C a p a c i t o r U p d a t e r | C a p a c i t o r U p d a t e r P l u g i n / . test ( content )
21282128}
21292129
2130+ function hasUpdaterInCapacitorConfigJson ( filePath : string ) : boolean {
2131+ const config = readJsonFileSafely ( filePath )
2132+ if ( ! config )
2133+ return false
2134+
2135+ const packageClassList = config . packageClassList
2136+ return Array . isArray ( packageClassList ) && packageClassList . includes ( 'CapacitorUpdaterPlugin' )
2137+ }
2138+
21302139function resolvePackageJsonLocation ( rootDir : string , packageJsonPath ?: string ) : string {
21312140 if ( ! packageJsonPath )
21322141 return join ( rootDir , PACKNAME )
@@ -2140,7 +2149,8 @@ function resolvePackageJsonLocation(rootDir: string, packageJsonPath?: string):
21402149 * (no dependency declaration, installed package, or native references). `shouldCheck` is `true`
21412150 * as soon as any signal indicates updater should be wired, then both dependency definitions
21422151 * (`Podfile` or SPM `Package.swift`) and generated native outputs (`Podfile.lock`,
2143- * `Package.resolved`, or `capacitor.plugins.json`) must include updater markers for `valid` to be `true`.
2152+ * `capacitor.plugins.json`, or `ios/App/App/capacitor.config.json`) must include
2153+ * updater markers for `valid` to be `true`.
21442154 */
21452155export function validateIosUpdaterSync (
21462156 rootDir : string = cwd ( ) ,
@@ -2176,14 +2186,13 @@ export function validateIosUpdaterSync(
21762186 const hasDependencyEntry = hasUpdaterInText ( podfileContent ) || hasUpdaterInText ( spmPackageContent )
21772187
21782188 const podfileLockPath = join ( iosAppPath , 'Podfile.lock' )
2179- const packageResolvedPath = join ( iosAppPath , 'App.xcworkspace' , 'xcshareddata' , 'swiftpm' , 'Package.resolved' )
21802189 const capacitorPluginsPath = join ( iosAppPath , 'App' , 'capacitor.plugins.json' )
2190+ const capacitorConfigJsonPath = join ( iosAppPath , 'App' , 'capacitor.config.json' )
21812191 const podfileLockContent = existsSync ( podfileLockPath ) ? readFileSync ( podfileLockPath , 'utf-8' ) : undefined
2182- const packageResolvedContent = existsSync ( packageResolvedPath ) ? readFileSync ( packageResolvedPath , 'utf-8' ) : undefined
21832192 const capacitorPluginsContent = existsSync ( capacitorPluginsPath ) ? readFileSync ( capacitorPluginsPath , 'utf-8' ) : undefined
21842193 const hasNativeProjectEntry = hasUpdaterInText ( podfileLockContent )
2185- || hasUpdaterInText ( packageResolvedContent )
21862194 || hasUpdaterInText ( capacitorPluginsContent )
2195+ || hasUpdaterInCapacitorConfigJson ( capacitorConfigJsonPath )
21872196
21882197 const shouldCheck = updaterDeclaredInPackageJson
21892198 || updaterPresentInNodeModules
@@ -2203,7 +2212,7 @@ export function validateIosUpdaterSync(
22032212 details . push ( `Missing @capgo/capacitor-updater in iOS dependency files (${ podfilePath } or ${ spmPackagePath } )` )
22042213 }
22052214 if ( ! hasNativeProjectEntry ) {
2206- details . push ( `Missing @capgo/capacitor-updater in iOS native project outputs (${ podfileLockPath } , ${ packageResolvedPath } , or ${ capacitorPluginsPath } )` )
2215+ details . push ( `Missing @capgo/capacitor-updater in iOS native project outputs (${ podfileLockPath } , ${ capacitorPluginsPath } , or ${ capacitorConfigJsonPath } )` )
22072216 }
22082217
22092218 return {
0 commit comments