Skip to content

Commit

Permalink
feat: support deploy file
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Jul 1, 2021
1 parent 17899de commit 99b4a81
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions src/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { EventEmitter } from 'events';
import { Dictionary, Nullable } from '@salesforce/ts-types';
import { JsonMap, Nullable } from '@salesforce/ts-types';
import cli from 'cli-ux';
import { QuestionCollection } from 'inquirer';
import { Prompter } from './prompter';
Expand All @@ -15,7 +15,21 @@ export interface Preferences {
interactive: boolean;
}

export type Options = Dictionary<string>;
export type DeployerOptions = JsonMap;

/**
* This interface represents the aggregation of all deployer options, e.g.
* {
* 'Salesforce Apps': {
* testLevel: 'RunLocalTests',
* apps: ['force-app'],
* },
* 'Salesforce Functions': { username: 'user@salesforce.com' },
* }
*/
export interface ProjectDeployOptions<T extends DeployerOptions = DeployerOptions> {
[key: string]: T;
}

export abstract class Deployable {
abstract getAppName(): string;
Expand Down Expand Up @@ -65,6 +79,11 @@ export abstract class Deployer extends EventEmitter {
this.deployables = Object.assign([], deployables);
}

/**
* The human readable name of the deployer
*/
public abstract getName(): string;

/**
* Perform any initialization or setup. This is the time to prompt the
* user for any needed information. It should do so by respecting the user's
Expand All @@ -74,7 +93,7 @@ export abstract class Deployer extends EventEmitter {
*
* Uses the returned dictionary as the information to store in the project-deploy-options.json file.
*/
public abstract setup(preferences: Preferences, options?: Dictionary<string>): Promise<Dictionary<string>>;
public abstract setup(preferences: Preferences, options: DeployerOptions): Promise<DeployerOptions>;

/**
* Deploy the app.
Expand Down
2 changes: 1 addition & 1 deletion src/exported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
*/

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

0 comments on commit 99b4a81

Please sign in to comment.