import { Environment, Git, Github, IO } from '../services'; import { IReleaseInfo } from '../types'; /** * ### AbstractBuilder * * An `AbstractBuilder` needs to be derived so that we may define the abstract methods required * for the flow. */ declare abstract class AbstractBuilder { step: string; readonly io: IO; readonly env: Environment; readonly git: Git; readonly github: Github; constructor(env?: Environment, io?: IO, git?: Git, github?: Github); /** * This is the main method to execute. There is no need to run any of the other defined methods * since this method will call them depending on the environment variables. */ run(): Promise; /** * Gets called whenever we want to create a release. The implementation should define the * operations that need to be done to help the user create a release of the library. */ abstract releaseSetup(param: IReleaseInfo): Promise; /** * Gets called right before the `publish` method. This is the place where we * can rearrange the files in the appropriate directories. */ abstract beforePublish(): Promise; /** * Should define how the library gets published. It should return a promise which resolves * to the version that was published. */ abstract publish(): Promise; /** * Gets called after the `publish` method. Failure in this method will not affect the end * result of the process since the package has already been published. We can use this * method to send notifications or to create github releases. */ abstract afterPublish(): Promise; /** * Specify how to run the unit tests. */ abstract test(): Promise; /** * This gets run before `verifyRelease` or `verifyNonRelease` gets run. This will run on any * PR. */ abstract beforeVerifyPullRequest(): Promise; /** * This method gets called when a branch named `release` is in a pull request. Here we can make * sure that the version number is greater than the currently published one. We can also check * that the CHANGELOG has been updated. */ abstract verifyRelease(): Promise; /** * Similarly to `verifyRelease` this method gets called on any other pull request. Here we can * make sure that the package version has not been modified. */ abstract verifyNonRelease(): Promise; /** * This gets run after `verifyRelease` or `verifyNonRelease` gets run. This will run on any * PR. */ abstract afterVerifyPullRequest(): Promise; /** * Create a standard pre-release of the current state of the project. This command * will work on any machine that has the valid credentials. A successful preRelease will * do the following: * * - Switch to the '__build' branch * - Run `beforePublish` * - Run `publish` * - Switch back to you working branch * - Delete the '__build' branch. * * Note that `afterPublish` does not get called since pre-releases are meant to be kept in the * down low. */ protected createPreRelease(): Promise; /** * Setup the release process. It calls the `releaseSetup` method specified in the derived * builders. An `IReleaseInfo` object will be passed into the method so that we may be able * to modify files related to the release. For NPM builds for instance we care about modifying: * * - package.json changes the version * - README.md needs to be replaced all occurrences of the old version for the new one. * - CHANGELOG.md needs to set up the links * * After this is done we will be in the `release` branch. It is our responsibility to make * sure that the setup was done correctly and finish writing any remaining information to * continue with the release process. */ protected runReleaseSetup(): Promise; private runBuilder; protected handleMasterBranch(): Promise; protected handlePullRequest(): Promise; private runStep; } interface IBuilder { new (env?: Environment, io?: IO, git?: Git, github?: Github): AbstractBuilder; } export { AbstractBuilder, IBuilder, };