Skip to content

@salesforce/b2c-tooling-sdk / discovery / sfraPattern

Variable: sfraPattern ​

const sfraPattern: DetectionPattern

Defined in: packages/b2c-tooling-sdk/src/discovery/patterns/sfra.ts:42

Detection pattern for SFRA projects.

Detects SFRA workspaces by checking for:

  1. A cartridge named app_storefront_base - the core SFRA cartridge that serves as the foundation for SFRA-based storefronts. Per Salesforce documentation, this cartridge is essential and should not be renamed. (Primary detection method)
  2. A package.json with paths.base containing app_storefront_base - used in multi-repo setups with sgmf-scripts where the SFRA base cartridge is external to the project. (Secondary heuristic, less common)

See ​

https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-customizing-sfra.html

Example ​

// Use in custom detection
import { sfraPattern } from '@salesforce/b2c-tooling-sdk/discovery';

const customPatterns = [sfraPattern, ...otherPatterns];
const result = await detectWorkspaceType(workspacePath, { patterns: customPatterns });

Released under the Apache-2.0 License.