sidekick-library-generator
v0.1.0
Published
Sidekick library generator for AEM Edge Delivery Services projects
Readme
Sidekick Library Generator
A CLI tool for generating Sidekick libraries for AEM Edge Delivery Services projects.
Installation
npm installPrerequisites
Before using the tool, you need to set up your AEM API key:
export AEM_API_KEY=your-api-keyFor security reasons, the API key must be provided via environment variable. Never commit your API key to version control or share it in logs or error messages.
Usage
node cli.js generate [--org <organization>] [--project <project>] --site <site> [--force]Required:
--site: Site URL (e.g., https://www.aem.live)
Optional:
--org: Organization name (e.g., adobe). If not provided, will be automatically detected from git remote.--project: Project name (e.g., helix-website). If not provided, will be automatically detected from git remote.--force: Force generation even if blocks directory exists. Without this option, the command will fail if blocks have already been generated.
Required environment variable:
AEM_API_KEY: Your AEM API key for authentication
Examples:
# Using explicit organization and project names
export AEM_API_KEY=your-api-key
node cli.js generate --org adobe --project helix-website --site https://www.aem.live/
# Using automatic git remote detection (requires git remote to be configured)
export AEM_API_KEY=your-api-key
node cli.js generate --site https://www.aem.live/
# Force overwrite existing blocks
export AEM_API_KEY=your-api-key
node cli.js generate --site https://www.aem.live/ --forceThe tool automatically detects the organization and project names from your git remote URL if not provided. This works with both SSH ([email protected]:organization/project.git) and HTTPS (https://github.com/organization/project.git) remote URLs.
Security Best Practices
API Key Management
The tool requires an AEM API key for authentication, which must be provided via the AEM_API_KEY environment variable. This is a security requirement to prevent accidental exposure of sensitive information.
Best practices for API key management:
- Never commit API keys to version control
- Use environment variables in production environments
- Consider using a secrets management service for production deployments
- Rotate API keys regularly
- Use the minimum required permissions for the API key
- Never share API keys in logs, error messages, or documentation
Environment Variables
For production use, it's recommended to set up environment variables in your deployment environment. This helps prevent accidental exposure of sensitive information in shell history or logs.
Development
Project Structure
cli.js: Main CLI entry pointsetup.js: Setup functionality for generating library structuregenerate_library.js: Library generation implementationblock_helpers.js: Helper functions for block processingtemplate/: Directory containing template files
Adding New Features
- Add new commands in
cli.js - Create corresponding implementation files
- Update tests if applicable
- Update documentation
License
UNLICENSED
