"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const architect_1 = require("@angular-devkit/architect");
const path_1 = require("path");
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const regenerate_1 = require("../../cli/commands/regenerate");
function run(options, context) {
    return rxjs_1.from(regenerate_1.regenerateApp({
        dryRun: options.dryRun,
        projectDir: path_1.resolve(context.workspaceRoot, options.projectDir || '.'),
        tapConfig: options.tapConfig
    }))
        .pipe(operators_1.map(result => {
        return {
            success: true
        };
    }), operators_1.catchError((err) => {
        context.logger.error(err.message);
        context.reportStatus(err.message);
        return rxjs_1.of({
            success: false
        });
    }));
}
exports.run = run;
exports.default = architect_1.createBuilder(run);
//# sourceMappingURL=impl.js.map