@reuvenorg/react-native-boilerplate-ultimate
Version:
A powerful CLI tool for creating React Native projects with modular architecture. Generate, manage, and scaffold React Native applications with pre-built modules and best practices.
48 lines • 2.17 kB
JavaScript
import { FileProcessor } from './base-processor.js';
export class XcodeProcessor extends FileProcessor {
canProcess(filePath) {
const xcodeExtensions = ['.pbxproj', '.xcscheme', '.xcworkspacedata'];
return xcodeExtensions.some(ext => filePath.endsWith(ext)) && !this.shouldSkipFile(filePath);
}
async process(filePath, context) {
let content = await this.readFile(filePath);
// Handle .pbxproj specific replacements
if (filePath.endsWith('.pbxproj')) {
content = this.transformPbxProj(content, context);
}
// Handle .xcscheme specific replacements
if (filePath.endsWith('.xcscheme')) {
content = this.transformXcScheme(content, context);
}
// Handle .xcworkspacedata
if (filePath.endsWith('.xcworkspacedata')) {
content = this.transformWorkspaceData(content, context);
}
await this.writeFile(filePath, content);
}
transformPbxProj(content, context) {
return content
// Replace app target name
.replace(/ExApp\.app/g, `${context.projectName}.app`)
// Replace library references
.replace(/libPods-ExApp\.a/g, `libPods-${context.projectName}.a`)
// Replace Pods target references
.replace(/Pods-ExApp/g, `Pods-${context.projectName}`)
// Replace file paths and references
.replace(/ExApp\//g, `${context.projectName}/`)
.replace(/ExApp-Bridging-Header\.h/g, `${context.projectName}-Bridging-Header.h`)
// Replace bundle identifiers
.replace(/com\.anonymous\.exapp/g, context.bundleId)
// Replace general ExApp references
.replace(/ExApp/g, context.projectName);
}
transformXcScheme(content, context) {
return content
.replace(/ExApp\.app/g, `${context.projectName}.app`)
.replace(/ExApp/g, context.projectName);
}
transformWorkspaceData(content, context) {
return content.replace(/ExApp\.xcodeproj/g, `${context.projectName}.xcodeproj`);
}
}
//# sourceMappingURL=xcode-processor.js.map