( inputPaths: ReadonlyArray<ReturnType<typeof compileInputPath>>, jobIndex: number, logLevel?: LogLevel, )
| 98 | } |
| 99 | |
| 100 | export function logInputPaths( |
| 101 | inputPaths: ReadonlyArray<ReturnType<typeof compileInputPath>>, |
| 102 | jobIndex: number, |
| 103 | logLevel?: LogLevel, |
| 104 | ): void { |
| 105 | if (logLevel === 'silent') return; |
| 106 | |
| 107 | const lines: Array<string> = []; |
| 108 | |
| 109 | const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `); |
| 110 | const baseString = colors.cyan(`Generating...`); |
| 111 | lines.push(`${jobPrefix}${colors.gray('~')} ${baseString}`); |
| 112 | |
| 113 | inputPaths.forEach((inputPath, index) => { |
| 114 | const itemPrefixStr = ` [${index + 1}] `; |
| 115 | const itemPrefix = colors.cyan(itemPrefixStr); |
| 116 | const detailIndent = ' '.repeat(itemPrefixStr.length); |
| 117 | |
| 118 | if (typeof inputPath.path !== 'string') { |
| 119 | lines.push(`${jobPrefix}${itemPrefix}raw OpenAPI specification`); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | switch (inputPath.registry) { |
| 124 | case 'hey-api': { |
| 125 | const baseInput = [inputPath.organization, inputPath.project].filter(Boolean).join('/'); |
| 126 | lines.push(`${jobPrefix}${itemPrefix}${baseInput}`); |
| 127 | if (inputPath.branch) { |
| 128 | lines.push( |
| 129 | `${jobPrefix}${detailIndent}${colors.gray('branch:')} ${colors.green( |
| 130 | inputPath.branch, |
| 131 | )}`, |
| 132 | ); |
| 133 | } |
| 134 | if (inputPath.commit_sha) { |
| 135 | lines.push( |
| 136 | `${jobPrefix}${detailIndent}${colors.gray('commit:')} ${colors.green( |
| 137 | inputPath.commit_sha, |
| 138 | )}`, |
| 139 | ); |
| 140 | } |
| 141 | if (inputPath.tags?.length) { |
| 142 | lines.push( |
| 143 | `${jobPrefix}${detailIndent}${colors.gray('tags:')} ${colors.green( |
| 144 | inputPath.tags.join(', '), |
| 145 | )}`, |
| 146 | ); |
| 147 | } |
| 148 | if (inputPath.version) { |
| 149 | lines.push( |
| 150 | `${jobPrefix}${detailIndent}${colors.gray('version:')} ${colors.green( |
| 151 | inputPath.version, |
| 152 | )}`, |
| 153 | ); |
| 154 | } |
| 155 | if (logLevel === 'debug') { |
| 156 | lines.push( |
| 157 | `${jobPrefix}${detailIndent}${colors.gray('url:')} ${colors.green(inputPath.path)}`, |
no test coverage detected