MCPcopy Index your code
hub / github.com/code-pushup/cli / addPresetExport

Function addPresetExport

packages/create-cli/src/lib/setup/codegen.ts:169–197  ·  view source on GitHub ↗
(
  builder: CodeBuilder,
  plugins: PluginCodegenResult[],
  format: ConfigFileFormat,
)

Source from the content-addressed store, hash-verified

167}
168
169function 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}

Callers 1

generatePresetSourceFunction · 0.85

Calls 4

addPluginsFunction · 0.85
addCategoriesFunction · 0.85
addLinesMethod · 0.80
addLineMethod · 0.80

Tested by

no test coverage detected