UNPKG

salesforce-alm

Version:

This package contains tools, and APIs, for an improved salesforce.com developer experience.

89 lines (88 loc) 3.1 kB
/** * Returns the given filePath without '-meta.xml' * * @param {string} filePath * @returns {string} */ export declare const removeMetadataFileExtFrom: (filePath: string) => string; /** * Returns the fileName stripped of any file extensions * * @param {string} filePath * @param {TypeDefObj} typeDef * @returns {string} */ export declare const getFileName: (filePath: string) => string; /** * Returns the parent directory name * Example: /parentDir/fileName.ext returns 'parentDir' * * @param {string} filePath * @returns {string} */ export declare const getParentDirectoryName: (filePath: string) => string; /** * Returns the grandparent directory name * Example: grandparentDir/parentDir/fileName.ext returns 'grandparentDir' * * @param {string} filePath * @returns {string} */ export declare const getGrandparentDirectoryName: (filePath: string) => string; /** * Returns the truncated path to the given directory * Example: filePath='path/to/specialDir/containing/stuff' dirName='specialDir' returns 'path/to/specialDir' * * @param {string} filePath * @param {string} dirName * @returns {string} */ export declare const getPathToDir: (filePath: string, dirName: string) => string; export declare const getContentPathWithNonStdExtFromMetadataPath: (metadataFilePath: string) => string; export declare const fileNamesWithoutExtensionsMatch: (filename1: string, filename2: string) => boolean; export declare const removeParentDirFromPath: (filePath: string) => string; /** * Replace forward slashes with path separators * * @param {string} str * @returns {string} */ export declare const replaceForwardSlashes: (str: string) => string; /** * Encode a string similarly to how Metadata API encodes (spaces not encoded) * * @param {string} str * @returns {string} */ export declare const encodeMetadataString: (str: string) => string; /** * gets a list of sub-directories from a parent directory. * * @param {string} filePath The path to look for nested directories * @returns {string[]} An array of all sub directories */ export declare const getNestedDirectoryPaths: (filePath: string) => string[]; /** * Removes all the empty sub-directories * * @param {string} filePath The parent path to look for empty directories. This directory will also be removed if it * ends up being empty. */ export declare function cleanEmptyDirs(filePath: string): void; /** * Comparator function to sort an array of strings by parent child relationship. * * @param left {string} The left path string * @param right {string} The right path string * @returns * if the right path starts with the left path return 1 * if the left path starts with the right path return -1 * Everything else returns the result of left.localeCompare(right) */ export declare function deleteOrderComparator(left: string, right: string): number; /** * A better file exists function that ensures a file can be read from the filesystem. * * @param path The absolute files path or relative path to a file from the CWD. */ export declare function canRead(path: string): boolean;