Files
metabuilder/packages/package_validator/scripts/functions.json
johndoe6345789 42446ef255 feat: Update package schemas and scripts to support JSON-based lifecycle hooks
- Added `jsonScript` property to metadata schema for JSON script entry points.
- Refactored `generate-package.ts` to replace Lua scripts with JSON scripts for lifecycle hooks.
- Updated test generation to use JSON format for metadata validation.
- Modified documentation and comments to reflect the transition from Lua to JSON scripting.
- Adjusted Storybook configuration and mock data to align with new JSON script structure.
- Renamed relevant files and references from Lua to JSON for consistency across the project.
2026-01-07 15:25:45 +00:00

232 lines
6.2 KiB
JSON

{
"$schema": "https://metabuilder.dev/schemas/json-script.schema.json",
"schemaVersion": "2.2.0",
"package": "package_validator",
"description": "Package validation functions for validating JSON-based packages",
"functions": [
{
"id": "validate_package",
"name": "validatePackage",
"exported": true,
"description": "Validates a complete package including metadata, components, scripts, and structure",
"category": "validation",
"parameters": [
{
"name": "packagePath",
"type": "string",
"required": true,
"description": "Path to the package directory"
},
{
"name": "options",
"type": "object",
"required": false,
"description": "Validation options (skipStructure, skipScripts, skipStyles)"
}
],
"returns": {
"type": "ValidationResult",
"description": "Validation results with errors and warnings"
}
},
{
"id": "validate_metadata",
"name": "validateMetadata",
"exported": true,
"description": "Validates package metadata.json structure and required fields",
"category": "validation",
"parameters": [
{
"name": "metadata",
"type": "object",
"required": true,
"description": "Parsed metadata object to validate"
}
],
"returns": {
"type": "array",
"description": "Tuple of [valid: boolean, errors: string[]]"
}
},
{
"id": "validate_scripts",
"name": "validateScripts",
"exported": true,
"description": "Validates script structure and exports",
"category": "validation",
"parameters": [
{
"name": "packagePath",
"type": "string",
"required": true,
"description": "Path to the package directory"
},
{
"name": "metadata",
"type": "object",
"required": true,
"description": "Package metadata with exports"
}
],
"returns": {
"type": "array",
"description": "Tuple of [errors: string[], warnings: string[]]"
}
},
{
"id": "validate_types",
"name": "validateTypes",
"exported": true,
"description": "Validates type definitions in types.json",
"category": "validation",
"parameters": [
{
"name": "types",
"type": "array",
"required": true,
"description": "Array of type definitions to validate"
}
],
"returns": {
"type": "array",
"description": "Tuple of [valid: boolean, errors: string[]]"
}
},
{
"id": "validate_components",
"name": "validateComponents",
"exported": true,
"description": "Validates component definitions in components.json",
"category": "validation",
"parameters": [
{
"name": "components",
"type": "array",
"required": true,
"description": "Array of component definitions to validate"
}
],
"returns": {
"type": "array",
"description": "Tuple of [valid: boolean, errors: string[]]"
}
},
{
"id": "validate_tests",
"name": "validateTests",
"exported": true,
"description": "Validates test file structure and coverage",
"category": "validation",
"parameters": [
{
"name": "packagePath",
"type": "string",
"required": true,
"description": "Path to the package directory"
}
],
"returns": {
"type": "object",
"description": "Test validation results"
}
},
{
"id": "validate_storybook",
"name": "validateStorybook",
"exported": true,
"description": "Validates storybook configuration and stories",
"category": "validation",
"parameters": [
{
"name": "packagePath",
"type": "string",
"required": true,
"description": "Path to the package directory"
}
],
"returns": {
"type": "object",
"description": "Storybook validation results"
}
},
{
"id": "validate_styles",
"name": "validateStyles",
"exported": true,
"description": "Validates styles.json structure",
"category": "validation",
"parameters": [
{
"name": "packagePath",
"type": "string",
"required": true,
"description": "Path to the package directory"
}
],
"returns": {
"type": "object",
"description": "Style validation results with success status and messages"
}
},
{
"id": "format_results",
"name": "formatResults",
"exported": true,
"description": "Formats validation results for display",
"category": "output",
"parameters": [
{
"name": "results",
"type": "ValidationResult",
"required": true,
"description": "Validation results to format"
},
{
"name": "format",
"type": "string",
"required": false,
"default": "human",
"description": "Output format: 'human' or 'json'"
}
],
"returns": {
"type": "string",
"description": "Formatted output string"
}
},
{
"id": "check_script_quality",
"name": "checkScriptQuality",
"exported": true,
"description": "Checks script code quality and best practices",
"category": "validation",
"parameters": [
{
"name": "scriptCode",
"type": "string",
"required": true,
"description": "Script source code to check"
}
],
"returns": {
"type": "object",
"description": "Quality check results with suggestions"
}
}
],
"exports": {
"functions": [
"validatePackage",
"validateMetadata",
"validateScripts",
"validateTypes",
"validateComponents",
"validateTests",
"validateStorybook",
"validateStyles",
"formatResults",
"checkScriptQuality"
]
}
}