barrelize 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -6
- package/lib/index.js +8308 -83
- package/lib/index.js.map +1 -0
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
Barrelize simplifies module exports by creating clean, centralized `index.js` or `index.ts` files, reducing boilerplate and improving project organization.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/barrelize)
|
|
8
|
-
[
|
|
9
|
-
](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
9
|
|
|
11
10
|
## Features
|
|
11
|
+
|
|
12
12
|
- **Automatic Barrel Generation**: Scans directories and creates index files with exports for all modules.
|
|
13
13
|
- **TypeScript Support**: Seamlessly works with TypeScript projects, preserving type safety.
|
|
14
14
|
- **Customizable**: Configure file patterns, ignore specific files, or customize export styles (named, default, or both).
|
|
@@ -16,15 +16,15 @@ Barrelize simplifies module exports by creating clean, centralized `index.js` or
|
|
|
16
16
|
- **CLI & API**: Use via command line for quick setups or integrate programmatically in your build scripts.
|
|
17
17
|
|
|
18
18
|
### Why Use Barrelize?
|
|
19
|
+
|
|
19
20
|
- **Save Time**: Eliminate manual creation and maintenance of barrel files.
|
|
20
21
|
- **Cleaner Imports**: Simplify import statements with a single entry point for each directory.
|
|
21
22
|
- **Scalable**: Ideal for large projects with complex folder structures.
|
|
22
23
|
|
|
23
|
-
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
npm install -
|
|
27
|
+
npm install --save-dev barrelize
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Quick Start
|
|
@@ -63,17 +63,24 @@ npx barrelize -c barrelize.json # Uses custom config file
|
|
|
63
63
|
|
|
64
64
|
## Configuration
|
|
65
65
|
|
|
66
|
-
Create a `.barrelize` file in your project root:
|
|
66
|
+
Create a `.barrelize` file in your project root. The configuration file uses JSON5 format, which supports comments and is more flexible than standard JSON:
|
|
67
67
|
|
|
68
|
-
```
|
|
68
|
+
```jsonc
|
|
69
69
|
{
|
|
70
|
+
// Configure multiple directories to generate barrels for
|
|
70
71
|
"directories": [
|
|
71
72
|
{
|
|
73
|
+
// Root directory to start from
|
|
72
74
|
"path": "src",
|
|
75
|
+
// Files to include in the barrel
|
|
73
76
|
"include": ["**/*.ts", "**/*.tsx"],
|
|
77
|
+
// Files to exclude from the barrel
|
|
74
78
|
"exclude": ["**/*.test.ts", "**/*.spec.ts"],
|
|
79
|
+
// Optional ordering of exports
|
|
75
80
|
"order": ["types", "constants", "utils"],
|
|
81
|
+
// Whether to keep file extensions in exports
|
|
76
82
|
"keepFileExtension": true,
|
|
83
|
+
// Optional string replacements in export paths
|
|
77
84
|
"replace": [
|
|
78
85
|
{
|
|
79
86
|
"find": ".ts$",
|