@capgo/cli
Version:
A CLI to upload to capgo servers
49 lines (48 loc) • 2.09 kB
TypeScript
export interface PbxTarget {
name: string;
bundleId: string;
productType: string;
}
/**
* Parse a pbxproj file's content and return all signable native targets
* with their resolved bundle identifiers.
*/
export declare function findSignableTargets(pbxprojContent: string): PbxTarget[];
/**
* Search for an Xcode project.pbxproj file in standard locations:
* <searchDir>/ios/*.xcodeproj/project.pbxproj
* <searchDir>/*.xcodeproj/project.pbxproj
* Returns the first found path, or null.
*/
export declare function findXcodeProject(searchDir: string): string | null;
/**
* Convenience: find the Xcode project in projectDir and read its pbxproj content.
* Returns null if no project is found.
*/
export declare function readPbxproj(projectDir: string): string | null;
/**
* Replace every `PRODUCT_BUNDLE_IDENTIFIER = <fromId>;` assignment in pbxproj
* content with `<toId>` (tolerates optional quotes and surrounding whitespace).
* Pure — returns the new content and the number of replacements made.
*
* Matching by exact value (rather than by config block) is deliberate: callers
* pass the resolved Release build id as `fromId`, and real Capacitor/RN projects
* give extensions a SUFFIXED id (com.app.ext), so only the main target's
* assignment(s) match. A Debug config that shares the exact same value is
* updated too (keeping Debug == Release); a Debug config with a different value
* is left untouched.
*/
export declare function replaceBundleIdInPbxproj(content: string, fromId: string, toId: string): {
content: string;
changed: number;
};
/**
* Locate the project's pbxproj (same search order as detectIosBundleIds) and
* rewrite its `PRODUCT_BUNDLE_IDENTIFIER = <fromId>;` assignments to `<toId>`,
* writing the file back only when something changed. Returns the number of
* replacements (0 when no project or no matching assignment was found). Throws
* only on a filesystem read/write error.
*/
export declare function writeReleaseBundleId(cwd: string, iosDir: string, fromId: string, toId: string): {
changed: number;
};