barrelize
Version:
Automatically generating index (barrel) files
138 lines (137 loc) • 4.27 kB
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$schema": {
"description": "Path to the JSON schema file that will be used for configuration validation",
"default": "node_modules/barrelize/schema.json",
"type": "string"
},
"bracketSpacing": {
"description": "Whether to add spaces between brackets in export statements",
"default": true,
"type": "boolean"
},
"singleQuote": {
"description": "Whether to use single quotes instead of double quotes for exports",
"default": true,
"type": "boolean"
},
"semi": {
"description": "Whether to append semicolons to export statements",
"default": true,
"type": "boolean"
},
"insertFinalNewline": {
"description": "Whether to append a newline character at the end of generated files",
"default": true,
"type": "boolean"
},
"barrels": {
"description": "List of barrel configurations",
"default": [
{
"root": "src",
"name": "index.ts",
"include": [
"**/*.ts"
],
"exclude": [
"**/*.test.ts"
]
}
],
"type": "array",
"items": {
"type": "object",
"properties": {
"root": {
"description": "Root directory to start from (support glob pattern)",
"default": "src",
"type": "string"
},
"name": {
"description": "Name of the index file (e.g. index.ts or some/path/index.ts)",
"default": "index.ts",
"type": "string"
},
"include": {
"description": "Files to include in the barrel (supports glob patterns)",
"default": [
"**/*.ts"
],
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"description": "Files to exclude from the barrel (supports glob patterns)",
"default": [
"**/*.test.ts"
],
"type": "array",
"items": {
"type": "string"
}
},
"order": {
"description": "Ordering of exports",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"replace": {
"description": "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$/": ""
},
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"description": "String or regular expression pattern to find in export paths (e.g. \"\\.ts$\", \"my-custom-export-path.ts\")",
"type": "string"
}
},
"exports": {
"description": "Configuration for exports in barrel files",
"default": {
"**/*.ts": []
},
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"description": "Glob pattern exports file with string or regular expression patterns (e.g. \"**/*service.ts\": [\"* as lib\", \"/(.+)Config$/ as $1LibConfig\", \"util\"])",
"type": "array",
"items": {
"type": "string"
}
}
},
"bracketSpacing": {
"description": "Use spaces between brackets in exports",
"type": "boolean"
},
"singleQuote": {
"description": "Use single quotes for exports",
"type": "boolean"
},
"semi": {
"description": "Add semicolons after exports",
"type": "boolean"
},
"insertFinalNewline": {
"description": "Add newline at end of file",
"type": "boolean"
}
}
}
}
}
}