@rushstack/heft
Version:
Build all your JavaScript projects the same way: A way that works.
33 lines • 1.52 kB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { CommandLineAction } from '@rushstack/ts-command-line';
import { HeftActionRunner } from '../HeftActionRunner';
import { Selection } from '../../utilities/Selection';
export class PhaseAction extends CommandLineAction {
constructor(options) {
const { phase, watch = false } = options;
const { phaseName, phaseDescription } = phase;
super({
actionName: `${phaseName}${watch ? '-watch' : ''}`,
documentation: `Runs to the ${phaseName} phase, including all transitive dependencies` +
(watch ? ', in watch mode.' : '.') +
(phaseDescription ? ` ${phaseDescription}` : ''),
summary: `Runs to the ${phaseName} phase, including all transitive dependencies` +
(watch ? ', in watch mode.' : '.')
});
this.watch = watch;
this._phase = phase;
this._actionRunner = new HeftActionRunner({ action: this, ...options });
this._actionRunner.defineParameters();
}
get selectedPhases() {
if (!this._selectedPhases) {
this._selectedPhases = Selection.recursiveExpand([this._phase], (phase) => phase.dependencyPhases);
}
return this._selectedPhases;
}
async onExecuteAsync() {
await this._actionRunner.executeAsync();
}
}
//# sourceMappingURL=PhaseAction.js.map