@amplitude/ampli
Version:
Amplitude CLI
35 lines (34 loc) • 2.17 kB
TypeScript
/// <reference types="node" />
import { ExecSyncOptions } from 'child_process';
import { ItlyReference } from './itly-reference';
import { VerifierError } from './VerifierError';
import { IFileService } from '../../services/FileService';
export declare type FileFilter = (filePath: string) => boolean;
export declare type AddReferenceFunctionType = (ref: ItlyReference) => void;
export declare type AddReferenceFunctionNoFilePathType = (name: string, row: number, column: number) => void;
export declare type AddVerifierErrorFunction = (error: VerifierError) => void;
export declare type VerifierResults = {
references: ItlyReference[];
errors: VerifierError[];
};
declare type VerifySingleFileFunction = (filePath: string, fileContents: string, addReference: AddReferenceFunctionType, addError: AddVerifierErrorFunction) => void;
declare type VerifyFileBatchFunction = (filePaths: string[], addReference: AddReferenceFunctionType, addError: AddVerifierErrorFunction) => void;
export default abstract class Verifier {
private fileExtensionPattern;
private ampliContentFilters;
private fileFilter;
private ignoreDirs;
private fileService;
constructor(fileExtensionPattern: string, ampliContentFilters?: string[], fileFilter?: FileFilter | null, ignoreDirs?: string[], fileService?: IFileService);
protected abstract doVerify(eventNames: string[], workingDirs: string[]): Promise<VerifierResults>;
verify(eventNames: string[], workingDirs: string[]): Promise<VerifierResults>;
getReferenceName: (eventName: string) => string;
checkDependencies(): void;
protected verifyEach(verifyFile: VerifySingleFileFunction, workingDirs: string[]): Promise<VerifierResults>;
protected verifyBatch(verifyFiles: VerifyFileBatchFunction, workingDirs: string[]): Promise<VerifierResults>;
protected execSyncToString: (command: string, options?: ExecSyncOptions | undefined) => string;
protected execSyncToJson: (command: string, options?: ExecSyncOptions | undefined) => any;
protected getFilePaths(workingDirs: string[]): Promise<string[]>;
protected debug: (formatter: any, ...args: any[]) => void;
}
export {};