custom-scapi-manager
v1.0.2
Published
Local utility for scaffolding custom Salesforce Commerce API (SCAPI) endpoints
Maintainers
Readme
custom-scapi-manager
Local utility for scaffolding custom Salesforce Commerce API (SCAPI) endpoints. Generates boilerplate schema.yaml, api.json, and script.js files for new endpoints via an interactive CLI menu.
Installation
Install as a local dependency in your project:
npm install custom-scapi-managerSetup
Scaffold a .env configuration file in your project directory:
npx custom-scapi-manager initThen open the generated .env and set your configuration:
Configuration parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| cartridgePath | Yes | Relative or absolute path to your cartridge's rest-apis directory |
| projectName | No | Project name used in generated script headers |
Example for the PWA project
cartridgePath=../repo/pwa/cartridge/rest-apis
projectName=TestPWAUsage
Run the interactive menu:
npx custom-scapi-managerThe menu will guide you through:
- Select an existing API section or create a new one
- Enter the endpoint name
- Choose the HTTP method (GET or POST)
The tool will then generate/update three files in your cartridge:
- schema.yaml - OpenAPI 3.0.0 specification with the endpoint definition
- api.json - Endpoint registration configuration
- script.js - Handler implementation scaffold
Requirements
- Node.js >= 18.0.0
