2020-09-14 14:24:15 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
2021-06-03 09:59:20 -04:00
|
|
|
|
2020-09-14 14:24:15 -04:00
|
|
|
import {NgDevConfig} from '../../utils/config';
|
2021-06-03 09:59:20 -04:00
|
|
|
import {AuthenticatedGitClient} from '../../utils/git/authenticated-git-client';
|
2020-09-14 14:24:15 -04:00
|
|
|
import {CaretakerConfig} from '../config';
|
|
|
|
|
|
|
|
/** The BaseModule to extend modules for caretaker checks from. */
|
|
|
|
export abstract class BaseModule<Data> {
|
2021-06-03 09:59:20 -04:00
|
|
|
/** The singleton instance of the authenticated git client. */
|
|
|
|
protected git = AuthenticatedGitClient.get();
|
2020-09-14 14:24:15 -04:00
|
|
|
/** The data for the module. */
|
|
|
|
readonly data = this.retrieveData();
|
|
|
|
|
2021-04-08 15:34:55 -04:00
|
|
|
constructor(protected config: NgDevConfig<{caretaker: CaretakerConfig}>) {}
|
2020-09-14 14:24:15 -04:00
|
|
|
|
|
|
|
/** Asyncronously retrieve data for the module. */
|
2020-11-04 19:58:29 -05:00
|
|
|
protected abstract retrieveData(): Promise<Data>;
|
2020-09-14 14:24:15 -04:00
|
|
|
|
|
|
|
/** Print the information discovered for the module to the terminal. */
|
2020-11-04 19:58:29 -05:00
|
|
|
abstract printToTerminal(): Promise<void>;
|
2020-09-14 14:24:15 -04:00
|
|
|
}
|