/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/cli/src/commands/mcp/tools/run-target/build-target-strategy.ts
63 строки
2 KB
herdiyanitdev
fix(@angular/cli): serialize configuration as a single argv token in run_target strategies (#33657)
07 авг 2026, 17:55
Не верифицирован
07 авг 2026, 17:55
ecf8c08
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { getCommandErrorLogs } from '../../utils'; import type { McpToolContext } from '../tool-registry'; import { serializeOptions } from './options-serializer'; import type { TargetStrategy } from './strategy'; import type { RunTargetOutput, StrategyExecutionContext } from './types'; export class BuildTargetStrategy implements TargetStrategy { canHandle(targetName: string, builder?: string): boolean { return ( targetName === 'build' && (builder === '@angular-devkit/build-angular:application' || builder === '@angular-devkit/build-angular:browser' || builder === '@angular/build:application' || builder === '@angular-devkit/build-angular:ng-packagr') ); } async execute( input: StrategyExecutionContext, context: McpToolContext, ): Promise<RunTargetOutput> { const args = ['build', input.projectName]; if (input.configuration) { args.push(`--configuration=${input.configuration}`); } args.push(...serializeOptions(input.options)); let status: 'success' | 'failure' = 'success'; let logs: string[]; try { const result = await context.host.executeNgCommand(args, { cwd: input.workspacePath }); logs = result.logs; } catch (e) { status = 'failure'; logs = getCommandErrorLogs(e); } let outputPath: string | undefined; for (const line of logs) { const match = line.match(/Output location: (.*)/); if (match) { outputPath = match[1].trim(); break; } } return { status, logs, extensions: outputPath ? { outputPath } : undefined, }; } }