* Get the template path for a specific platform * Checks for local override via environment variable first
(
platform: 'iOS' | 'macOS',
commandExecutor: CommandExecutor,
fileSystemExecutor: FileSystemExecutor,
)
| 20 | * Checks for local override via environment variable first |
| 21 | */ |
| 22 | static async getTemplatePath( |
| 23 | platform: 'iOS' | 'macOS', |
| 24 | commandExecutor: CommandExecutor, |
| 25 | fileSystemExecutor: FileSystemExecutor, |
| 26 | ): Promise<string> { |
| 27 | const config = getConfig(); |
| 28 | const localPath = platform === 'iOS' ? config.iosTemplatePath : config.macosTemplatePath; |
| 29 | log( |
| 30 | 'debug', |
| 31 | `[TemplateManager] Checking config override for ${platform} template. Value: '${localPath}'`, |
| 32 | ); |
| 33 | |
| 34 | if (localPath) { |
| 35 | const pathExists = fileSystemExecutor.existsSync(localPath); |
| 36 | log( |
| 37 | 'debug', |
| 38 | `[TemplateManager] Config override set. Path '${localPath}' exists? ${pathExists}`, |
| 39 | ); |
| 40 | if (pathExists) { |
| 41 | const templateSubdir = join(localPath, 'template'); |
| 42 | const subdirExists = fileSystemExecutor.existsSync(templateSubdir); |
| 43 | log( |
| 44 | 'debug', |
| 45 | `[TemplateManager] Checking for subdir '${templateSubdir}'. Exists? ${subdirExists}`, |
| 46 | ); |
| 47 | if (subdirExists) { |
| 48 | log('info', `Using local ${platform} template from: ${templateSubdir}`); |
| 49 | return templateSubdir; |
| 50 | } else { |
| 51 | log('info', `Template directory not found in ${localPath}, using GitHub release`); |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | log('debug', '[TemplateManager] No valid config override, proceeding to download.'); |
| 57 | // Download from GitHub release |
| 58 | return await this.downloadTemplate(platform, commandExecutor, fileSystemExecutor); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Download template from GitHub release |
no test coverage detected