( builder: CodeBuilder, plugins: PluginCodegenResult[], format: ConfigFileFormat, )
| 167 | } |
| 168 | |
| 169 | function addPresetExport( |
| 170 | builder: CodeBuilder, |
| 171 | plugins: PluginCodegenResult[], |
| 172 | format: ConfigFileFormat, |
| 173 | ): void { |
| 174 | if (format === 'ts') { |
| 175 | builder.addLines([ |
| 176 | '/**', |
| 177 | ' * Creates a Code PushUp config for a project.', |
| 178 | ' * @param project Project name', |
| 179 | ' */', |
| 180 | 'export async function createConfig(project: string): Promise<CoreConfig> {', |
| 181 | ]); |
| 182 | } else { |
| 183 | builder.addLines([ |
| 184 | '/**', |
| 185 | ' * Creates a Code PushUp config for a project.', |
| 186 | ' * @param {string} project Project name', |
| 187 | " * @returns {Promise<import('@code-pushup/models').CoreConfig>}", |
| 188 | ' */', |
| 189 | 'export async function createConfig(project) {', |
| 190 | ]); |
| 191 | } |
| 192 | builder.addLine('return {', 1); |
| 193 | addPlugins(builder, plugins, 2); |
| 194 | addCategories(builder, plugins, 2); |
| 195 | builder.addLine('};', 1); |
| 196 | builder.addLine('}'); |
| 197 | } |
no test coverage detected