UNPKG

@burgan-tech/vnext-core-reference

Version:

vNext Core Domain - Reference Package for cross-domain usage

250 lines (193 loc) • 6.69 kB
# @burgan-tech/vnext-core A structured template package for vNext workflow components with domain-based architecture. This package provides a foundation for building scalable workflow systems with schemas, tasks, views, functions, and extensions. ## šŸš€ Features - **Domain-Driven Architecture**: Organized by business domains with clear separation of concerns - **Component-Based Structure**: Modular design with schemas, workflows, tasks, views, functions, and extensions - **Template System**: Ready-to-use template structure for new vNext projects - **Type Safety**: Structured exports with clear APIs for accessing components ## šŸ“¦ Installation ### Install as dependency ```bash npm install @burgan-tech/vnext-core ``` ### Install as dev dependency ```bash npm install --save-dev @burgan-tech/vnext-core ``` ## šŸ—ļø Project Structure ``` vnext-core/ ā”œā”€ā”€ core/ # Domain-specific components │ ā”œā”€ā”€ Extensions/ # Extension definitions │ ā”œā”€ā”€ Functions/ # Function definitions │ ā”œā”€ā”€ Schemas/ # JSON schema definitions │ ā”œā”€ā”€ Tasks/ # Task definitions │ ā”œā”€ā”€ Views/ # View components │ └── Workflows/ # Workflow definitions ā”œā”€ā”€ index.js # Main entry point ā”œā”€ā”€ vnext.config.json # Domain configuration └── package.json # Package metadata ``` ## šŸ›ļø Architecture Principles ### Component Types 1. **Schemas**: JSON Schema definitions for data validation 2. **Workflows**: Business process definitions and state machines 3. **Tasks**: Individual task definitions and configurations 4. **Views**: User interface and presentation components 5. **Functions**: Reusable business logic functions 6. **Extensions**: Plugin and extension definitions ## šŸ› ļø Development ### Running Tests ```bash npm test ``` ## āš™ļø Configuration The `vnext.config.json` file allows you to customize paths and exports: ```json { "domain": "my-domain", "paths": { "componentsRoot": "my-domain", "schemas": "Schemas", "workflows": "Workflows", "tasks": "Tasks", "views": "Views", "functions": "Functions", "extensions": "Extensions" }, "exports": { "schemas": ["schema1.json", "schema2.json"], "workflows": ["workflow1.json"], "tasks": [], "views": [], "functions": [], "extensions": [] } } ``` ### Path Configuration You can customize component directory names: ```json { "paths": { "componentsRoot": "src", "workflows": "Flows", "schemas": "Models" } } ``` ## āœ… Validation Validate your project structure and schemas: ```bash npm run validate ``` This will check: - Package.json structure and content - Main entry point functionality - vnext.config.json validation - Domain directory structure - JSON file syntax validation - Schema validation using @burgan-tech/vnext-schema - Module functionality - Semantic versioning compliance ### Validation Output The validation provides detailed output with: - āœ… Passed validations - āŒ Failed validations with file paths and line numbers - šŸ“Š Summary statistics - šŸ“‹ Failed files summary for easy navigation ## šŸ—ļø Build Build your domain package for deployment or cross-domain usage: ```bash # Runtime build (default) - Complete domain structure npm run build # Reference build - Only exported components npm run build:reference # Runtime build explicitly npm run build:runtime ``` ### Build Options ```bash npm run build -- [options] Options: -o, --output <dir> Output directory (default: dist) -t, --type <type> Build type: reference or runtime (default: runtime) --skip-validation Skip validation during build -h, --help Show help message ``` ### Build Types | Type | Description | Use Case | |------|-------------|----------| | `runtime` | Complete domain structure with all files | Engine deployment | | `reference` | Only exported components from vnext.config.json | Cross-domain usage | ### Examples ```bash # Build to custom directory npm run build -- -o my-build # Reference build to custom directory npm run build -- -t reference -o packages/ref # Skip validation for faster builds npm run build -- --skip-validation ``` ### Build Output Structure **Runtime Build:** ``` dist/ ā”œā”€ā”€ <domain>/ │ ā”œā”€ā”€ Extensions/ │ ā”œā”€ā”€ Functions/ │ ā”œā”€ā”€ Schemas/ │ ā”œā”€ā”€ Tasks/ │ ā”œā”€ā”€ Views/ │ └── Workflows/ ā”œā”€ā”€ vnext.config.json ā”œā”€ā”€ package.json ā”œā”€ā”€ README.md └── LICENSE ``` **Reference Build:** ``` dist/ ā”œā”€ā”€ <domain>/ │ ā”œā”€ā”€ Extensions/ # Only exported files │ ā”œā”€ā”€ Functions/ # Only exported files │ ā”œā”€ā”€ Schemas/ # Only exported files │ ā”œā”€ā”€ Tasks/ # Only exported files │ ā”œā”€ā”€ Views/ # Only exported files │ └── Workflows/ # Only exported files ā”œā”€ā”€ vnext.config.json ā”œā”€ā”€ package.json ā”œā”€ā”€ README.md └── LICENSE ``` ## šŸ“œ Available Scripts | Script | Description | |--------|-------------| | `npm run validate` | Validate project structure and schemas | | `npm run build` | Build runtime package to dist/ | | `npm run build:runtime` | Build runtime package explicitly | | `npm run build:reference` | Build reference package with exports only | | `npm run setup <name>` | Setup domain with given name | | `npm run sync-schema` | Sync schema version from dependencies | | `npm test` | Run tests | ## šŸ¤ Contributing 1. Fork the repository 2. Create your feature branch (`git checkout -b feature/amazing-feature`) 3. Commit your changes (`git commit -m 'Add some amazing feature'`) 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Open a Pull Request ## šŸ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## šŸ¢ About Burgan Tech This package is maintained by the Burgan Tech team as part of our commitment to building scalable, domain-driven workflow solutions. ## šŸ”— Links - [NPM Package](https://www.npmjs.com/package/@burgan-tech/vnext-sys-flow) - [GitHub Repository](https://github.com/burgan-tech/vnext-sys-flow) - [Issues](https://github.com/burgan-tech/vnext-sys-flow/issues) - [Documentation](https://github.com/burgan-tech/vnext-sys-flow#readme) ## šŸ“ž Support For support and questions: - Create an issue on [GitHub](https://github.com/burgan-tech/vnext-sys-flow/issues) - Contact the development team at dev@burgan-tech.com --- Made with ā¤ļø by the Burgan Tech team