Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

example

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

Hierarchy

  • SfdxProject

Index

Methods

getPath

  • getPath(): string
  • Returns the project path.

    Returns 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 {@link Project.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.

    throws

    InvalidProjectWorkspace If the current folder is not located in a workspace.

    Parameters

    • Optional path: undefined | string

      The path of the project.

    Returns Promise<SfdxProject>

    The resolved project.

Static resolveProjectPath

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

    throws

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

    see

    fs.traverseForFile

    see

    process.cwd()

    Parameters

    • Optional dir: undefined | string

    Returns Promise<string>

    The absolute path to the project.