Merge pull request #20371 from drodil/custom_preparer_cleanup

feat: allow prepared directory clean up for custom preparers
This commit is contained in:
John Philip
2023-10-05 19:22:14 -04:00
committed by GitHub
6 changed files with 31 additions and 3 deletions
@@ -60,6 +60,11 @@ export class DirectoryPreparer implements PreparerBase {
this.scmIntegrations = ScmIntegrations.fromConfig(config);
}
/** {@inheritDoc PreparerBase.shouldCleanPreparedDirectory} */
shouldCleanPreparedDirectory() {
return false;
}
/** {@inheritDoc PreparerBase.prepare} */
async prepare(
entity: Entity,
@@ -78,6 +78,11 @@ export type PreparerBase = {
* @throws `NotModifiedError` when the prepared directory has not been changed since the last build.
*/
prepare(entity: Entity, options?: PreparerOptions): Promise<PreparerResponse>;
/**
* Indicates whether the prepared directory should be cleaned after generation.
*/
shouldCleanPreparedDirectory(): boolean;
};
/**
@@ -47,6 +47,11 @@ export class UrlPreparer implements PreparerBase {
this.reader = reader;
}
/** {@inheritDoc PreparerBase.shouldCleanPreparedDirectory} */
shouldCleanPreparedDirectory() {
return true;
}
/** {@inheritDoc PreparerBase.prepare} */
async prepare(
entity: Entity,