@salesforce/b2c-tooling-sdk / discovery / WorkspaceTypeDetector
Class: WorkspaceTypeDetector ​
Defined in: packages/b2c-tooling-sdk/src/discovery/detector.ts:40
Detects the type of B2C Commerce project in a workspace.
WorkspaceTypeDetector analyzes a directory to determine what kind of Commerce project it contains. Returns ALL matched project types to enable union toolset selection for hybrid projects.
Examples ​
import { WorkspaceTypeDetector } from '@salesforce/b2c-tooling-sdk/discovery';
const detector = new WorkspaceTypeDetector('/path/to/project');
const result = await detector.detect();
console.log(`Project types: ${result.projectTypes.join(', ')}`);
console.log(`Matched patterns: ${result.matchedPatterns.join(', ')}`);const detector = new WorkspaceTypeDetector('/path/to/project', {
additionalPatterns: [myCustomPattern],
excludePatterns: ['sfra-cartridge'],
});Constructors ​
Constructor ​
new WorkspaceTypeDetector(
workspacePath,options):WorkspaceTypeDetector
Defined in: packages/b2c-tooling-sdk/src/discovery/detector.ts:50
Creates a new WorkspaceTypeDetector.
Parameters ​
workspacePath ​
string
Path to the workspace directory to analyze
options ​
DetectOptions = {}
Detection options for customizing behavior
Returns ​
WorkspaceTypeDetector
Methods ​
detect() ​
detect():
Promise<DetectionResult>
Defined in: packages/b2c-tooling-sdk/src/discovery/detector.ts:63
Performs workspace detection.
Runs all configured patterns against the workspace and returns a consolidated result with all detected project types.
Returns ​
Promise<DetectionResult>
Detection result with all project types and matched patterns