@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
59 lines (58 loc) • 2.29 kB
TypeScript
import { Optional } from '@salesforce/ts-types';
/**
* The name of the project config file.
*
* @ignore
*/
export declare const SFDX_PROJECT_JSON = "sfdx-project.json";
/**
* Performs an upward directory search for an sfdx project file. Returns the absolute path to the project.
*
* **See** {@link SFDX_PROJECT_JSON}
*
* **See** {@link traverseForFile}
*
* **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
*
* @param dir The directory path to start traversing from.
* @ignore
*/
export declare function resolveProjectPath(dir?: string): Promise<string>;
/**
* Performs a synchronous upward directory search for an sfdx project file. Returns the absolute path to the project.
*
* **See** {@link SFDX_PROJECT_JSON}
*
* **See** {@link traverseForFile}
*
* **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
*
* @param dir The directory path to start traversing from.
* @ignore
*/
export declare function resolveProjectPathSync(dir?: string): string;
/**
* These methods were moved from the deprecated 'fs' module in v2 and are only used in sfdx-core above
*
* They were migrated into the 'traverse' constant in order to stub them in unit tests
*/
export declare const traverse: {
/**
* Searches a file path in an ascending manner (until reaching the filesystem root) for the first occurrence a
* specific file name. Resolves with the directory path containing the located file, or `null` if the file was
* not found.
*
* @param dir The directory path in which to start the upward search.
* @param file The file name to look for.
*/
forFile: (dir: string, file: string) => Promise<Optional<string>>;
/**
* Searches a file path synchronously in an ascending manner (until reaching the filesystem root) for the first occurrence a
* specific file name. Resolves with the directory path containing the located file, or `null` if the file was
* not found.
*
* @param dir The directory path in which to start the upward search.
* @param file The file name to look for.
*/
forFileSync: (dir: string, file: string) => Optional<string>;
};