UNPKG

barrelize

Version:

Automatically generating index (barrel) files

165 lines 6.32 kB
{ "$schema": "http://json-schema.org/draft-07/schema#", "$ref": "#/definitions/Config", "definitions": { "Config": { "type": "object", "properties": { "$schema": { "type": "string", "description": "Path to the JSON schema file that will be used for configuration validation", "markdownDescription": "Path to the JSON schema file that will be used for configuration validation", "default": "undefined" }, "bracketSpacing": { "type": "boolean", "description": "Whether to add spaces between brackets in export statements", "markdownDescription": "Whether to add spaces between brackets in export statements", "default": true }, "singleQuote": { "type": "boolean", "description": "Whether to use single quotes instead of double quotes for exports", "markdownDescription": "Whether to use single quotes instead of double quotes for exports", "default": true }, "semi": { "type": "boolean", "description": "Whether to append semicolons to export statements", "markdownDescription": "Whether to append semicolons to export statements", "default": true }, "insertFinalNewline": { "type": "boolean", "description": "Whether to append a newline character at the end of generated files", "markdownDescription": "Whether to append a newline character at the end of generated files", "default": true }, "barrels": { "type": "array", "items": { "$ref": "#/definitions/BarrelConfig" }, "description": "List of barrel configurations", "markdownDescription": "List of barrel configurations", "default": [ { "root": "src", "name": "index.ts", "include": [ "**/*.ts" ], "exclude": [ "**/*.test.ts" ] } ] } }, "required": [ "barrels" ], "additionalProperties": false }, "BarrelConfig": { "type": "object", "properties": { "root": { "type": "string", "description": "Root directory to start from (support glob pattern)", "markdownDescription": "Root directory to start from (support glob pattern)", "default": "" }, "name": { "type": "string", "description": "Name of the index file (e.g. index.ts or some/path/index.ts)", "markdownDescription": "Name of the index file (e.g. index.ts or some/path/index.ts)", "default": "index.ts" }, "include": { "type": "array", "items": { "type": "string" }, "description": "Files to include in the barrel (supports glob patterns)", "markdownDescription": "Files to include in the barrel (supports glob patterns)", "default": [ "**/*.ts" ] }, "exclude": { "type": "array", "items": { "type": "string" }, "description": "Files to exclude from the barrel (supports glob patterns)", "markdownDescription": "Files to exclude from the barrel (supports glob patterns)", "default": [] }, "order": { "type": "array", "items": { "type": "string" }, "description": "Ordering of exports", "markdownDescription": "Ordering of exports", "default": [] }, "replace": { "type": "object", "additionalProperties": { "type": "string", "description": "String or regular expression pattern to find in export paths (e.g. \"\\\\.ts$\", \"my-custom-export-path.ts\")", "markdownDescription": "String or regular expression pattern to find in export paths (e.g. \"\\\\.ts$\", \"my-custom-export-path.ts\")" }, "description": "String or regular expression patterns to find and replace in export paths (e.g. {\"\\\\.ts$\": \"\", \"my-custom-export-path.ts\": \"my-path.ts\"})", "markdownDescription": "String or regular expression patterns to find and replace in export paths (e.g. {\"\\\\.ts$\": \"\", \"my-custom-export-path.ts\": \"my-path.ts\"})", "default": { "/\\.ts$/": "" } }, "exports": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" }, "description": "Glob pattern exports file with string or regular expression patterns (e.g. \"**\\/*service.ts\": [\"* as lib\", \"/(.+)Config$/ as $1LibConfig\", \"util\"])", "markdownDescription": "Glob pattern exports file with string or regular expression patterns\n(e.g. \"**\\/*service.ts\": [\"* as lib\", \"/(.+)Config$/ as $1LibConfig\", \"util\"])" }, "description": "Configuration for exports in barrel files", "markdownDescription": "Configuration for exports in barrel files", "default": { "**/*.ts": {} } }, "bracketSpacing": { "type": "boolean", "description": "Use spaces between brackets in exports", "markdownDescription": "Use spaces between brackets in exports", "default": true }, "singleQuote": { "type": "boolean", "description": "Use single quotes for exports", "markdownDescription": "Use single quotes for exports", "default": true }, "semi": { "type": "boolean", "description": "Add semicolons after exports", "markdownDescription": "Add semicolons after exports", "default": true }, "insertFinalNewline": { "type": "boolean", "description": "Add newline at end of file", "markdownDescription": "Add newline at end of file", "default": true } }, "additionalProperties": false } } }