Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SfdxProject

Represents an SFDX project directory. This directory contains a SfdxProjectJson config file as well as a hidden .sfdx folder that contains all the other local project config files.

const project = await SfdxProject.resolve();
const projectJson = await project.resolveProjectConfig();
console.log(projectJson.sfdcLoginUrl);

Hierarchy

  • SfdxProject

Index

Methods

getPath

  • getPath(): string

resolveProjectConfig

  • resolveProjectConfig(): Promise<JsonMap>
  • The project config is resolved from local and global SfdxProjectJson, ConfigAggregator, and a set of defaults. It is recommended to use this when reading values from SfdxProjectJson.

    Returns Promise<JsonMap>

    A resolved config object that contains a bunch of different properties, including some 3rd party custom properties.

retrieveSfdxProjectJson

  • Get the sfdx-project.json config. The global sfdx-project.json is used for user defaults that are not checked in to the project specific file.

    Note: When reading values from SfdxProjectJson, it is recommended to use SfdxProject.resolveProjectConfig instead.

    Parameters

    • Default value isGlobal: boolean = false

      True to get the global project file, otherwise the local project config.

    Returns Promise<SfdxProjectJson>

Static resolve

  • resolve(path?: undefined | string): Promise<SfdxProject>
  • Get a Project from a given path or from the working directory.

    Parameters

    • Optional path: undefined | string

      The path of the project.

      Throws SfdxError{ name: 'InvalidProjectWorkspace' } If the current folder is not located in a workspace.

    Returns Promise<SfdxProject>

Static resolveProjectPath

  • resolveProjectPath(dir?: undefined | string): Promise<string>
  • Performs an upward directory search for an sfdx project file. Returns the absolute path to the project.

    Parameters

    • Optional dir: undefined | string

      The directory path to start traversing from.

      Throws SfdxError{ name: 'InvalidProjectWorkspace' } If the current folder is not located in a workspace.

      See traverseForFile

      See process.cwd()

    Returns Promise<string>