Developer Preview — This project is in active development. APIs may change. Provide feedback
Skip to content

@salesforce/b2c-tooling-sdk / scaffold / detectSourceFromPath

Function: detectSourceFromPath()

detectSourceFromPath(param, contextPath, projectRoot): SourceDetectionResult | undefined

Defined in: packages/b2c-tooling-sdk/src/scaffold/sources.ts:245

Detect a parameter's source value from a filesystem context path.

For cartridges source: walks up from contextPath looking for a .project file (cartridge marker), stopping at projectRoot. On match returns the cartridge name and companion path variable.

Parameters

param

ScaffoldParameter

The scaffold parameter with a source field

contextPath

string

Filesystem path providing context (e.g., right-clicked folder)

projectRoot

string

Project root directory

Returns

SourceDetectionResult | undefined

Detection result, or undefined if the source could not be detected

Released under the Apache-2.0 License.