Skip to content

Commit

Permalink
feat: add Deployables class
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Jun 25, 2021
1 parent cfdbbbe commit 0405a6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions src/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@ export interface Preferences {
}

export interface Options {
deployers: Set<Deployer>;
username: string;
}

export abstract class Deployable {
abstract getAppName(): string;
abstract getAppType(): string;
abstract getAppPath(): string;
abstract getEnvType(): Nullable<string>;
abstract getParent(): Deployer;
}

/**
* Deploy a piece of a project.
*/
export abstract class Deployer extends EventEmitter {
public deployables: Deployable[] = [];

// Standard methods implemented in the base class methods
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
public progress(current: number, total: number, message: string): void {}
Expand All @@ -30,12 +39,9 @@ export abstract class Deployer extends EventEmitter {
cli.log(msg, ...args);
}

abstract getAppName(): string;
abstract getAppType(): string;
abstract getAppPath(): string;
abstract getEnvType(): Nullable<string>;

// These methods are only called if the CLI user decides to deploy that piece of the project.
public selectDeployables(deployables: Deployable[]): void {
this.deployables = Object.assign([], deployables);
}

/**
* Perform any initialization or setup. This is the time to prompt the
Expand Down
2 changes: 1 addition & 1 deletion src/exported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
*/

export { generateTableChoices } from './util';
export { Deployer, Options, Preferences } from './deployer';
export { Deployable, Deployer, Options, Preferences } from './deployer';

0 comments on commit 0405a6b

Please sign in to comment.