UNPKG

@salesforce/source-tracking

Version:

API for tracking local and remote Salesforce metadata changes

90 lines (89 loc) 2.84 kB
import { NamedPackageDir } from '@salesforce/core'; import { RegistryAccess } from '@salesforce/source-deploy-retrieve'; import { StatusRow } from './types'; type ShadowRepoOptions = { orgId: string; projectPath: string; packageDirs: NamedPackageDir[]; registry: RegistryAccess; }; type CommitRequest = { deployedFiles?: string[]; deletedFiles?: string[]; message?: string; needsUpdatedStatus?: boolean; }; export declare class ShadowRepo { private static instanceMap; gitDir: string; projectPath: string; /** * packageDirs converted to project-relative posix style paths * iso-git uses relative, posix paths * but packageDirs has already resolved / normalized them * so we need to make them project-relative again and convert if windows */ private packageDirs; private status; private logger; private readonly registry; private constructor(); static getInstance(options: ShadowRepoOptions): Promise<ShadowRepo>; init(): Promise<void>; /** * Initialize a new source tracking shadow repo. Think of git init * */ gitInit(): Promise<void>; /** * Delete the local tracking files * * @returns the deleted directory */ delete(): Promise<string>; /** * If the status already exists, return it. Otherwise, set the status before returning. * It's kinda like a cache * * @params noCache: if true, force a redo of the status using FS even if it exists * * @returns StatusRow[] (paths are os-specific) */ getStatus(noCache?: boolean): Promise<StatusRow[]>; /** * returns any change (add, modify, delete) */ getChangedRows(): Promise<StatusRow[]>; /** * returns any change (add, modify, delete) */ getChangedFilenames(): Promise<string[]>; getDeletes(): Promise<StatusRow[]>; getDeleteFilenames(): Promise<string[]>; /** * returns adds and modifies but not deletes */ getNonDeletes(): Promise<StatusRow[]>; /** * returns adds and modifies but not deletes */ getNonDeleteFilenames(): Promise<string[]>; getAdds(): Promise<StatusRow[]>; getAddFilenames(): Promise<string[]>; /** * returns files that were not added or deleted, but changed locally */ getModifies(): Promise<StatusRow[]>; getModifyFilenames(): Promise<string[]>; /** * Look through status and stage all changes, then commit * * @param fileList list of files to commit (full paths) * @param message: commit message (include org username and id) * * @returns sha (string) */ commitChanges({ deployedFiles, deletedFiles, message, needsUpdatedStatus, }?: CommitRequest): Promise<string | undefined>; private detectMovedFiles; } export {};