barrelize 1.2.0 → 1.2.1

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.
Files changed (3) hide show
  1. package/README.md +27 -10
  2. package/lib/index.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -7,6 +7,8 @@ Barrelize simplifies module exports by creating clean, centralized `index.js` or
7
7
  [![NPM Version](https://img.shields.io/npm/v/barrelize)](https://www.npmjs.com/package/barrelize)
8
8
  [![GitHub License](https://img.shields.io/github/license/nizami/barrelize)](https://opensource.org/licenses/MIT)
9
9
 
10
+ ![Barrelize in action](image.png)
11
+
10
12
  ## Features
11
13
 
12
14
  - **Automatic Barrel Generation**: Scans directories and creates index files with exports for all modules.
@@ -54,11 +56,17 @@ npx barrelize init barrelize.json # Creates config at specified path
54
56
 
55
57
  ### `barrelize [config path]`
56
58
 
57
- Generates barrel (index) files based on your configuration.
59
+ Generates barrel (index) files based on your configuration. The tool will:
60
+
61
+ - Create or update index files in specified directories
62
+ - Export all matching files based on include/exclude patterns
63
+ - Order exports according to your configuration
64
+ - Apply path replacements
65
+ - Format exports according to your style preferences
58
66
 
59
67
  ```bash
60
- npx barrelize # Uses default .barrelize config
61
- npx barrelize -c barrelize.json # Uses custom config file
68
+ npx barrelize # Uses default .barrelize config
69
+ npx barrelize custom.json # Uses specified config file
62
70
  ```
63
71
 
64
72
  ## Configuration
@@ -67,26 +75,35 @@ Create a `.barrelize` file in your project root. The configuration file uses JSO
67
75
 
68
76
  ```jsonc
69
77
  {
78
+ "$schema": "node_modules/barrelize/schema.json",
79
+ // Global settings (can be overridden per directory)
80
+ "singleQuote": true, // Use single quotes for exports (default: true)
81
+ "semi": true, // Add semicolons after exports (default: true)
82
+ "insertFinalNewline": true, // Add newline at end of file (default: true)
70
83
  // Configure multiple directories to generate barrels for
71
84
  "directories": [
72
85
  {
73
- // Root directory to start from
86
+ // Root directory to start from (default: "")
74
87
  "path": "src",
75
- // Files to include in the barrel
88
+ // Files to include in the barrel (default: ["**/*.ts"])
76
89
  "include": ["**/*.ts", "**/*.tsx"],
77
- // Files to exclude from the barrel
90
+ // Files to exclude from the barrel (default: [])
78
91
  "exclude": ["**/*.test.ts", "**/*.spec.ts"],
79
- // Optional ordering of exports
92
+ // Optional ordering of exports (default: [])
80
93
  "order": ["types", "constants", "utils"],
81
- // Whether to keep file extensions in exports
82
- "keepFileExtension": true,
94
+ // Name of the index file (default: "index.ts")
95
+ "indexFilePath": "index.ts",
83
96
  // Optional string replacements in export paths
84
97
  "replace": [
85
98
  {
86
99
  "find": ".ts$",
87
100
  "replacement": ""
88
101
  }
89
- ]
102
+ ],
103
+ // Override global settings per directory if needed
104
+ "singleQuote": true,
105
+ "semi": true,
106
+ "insertFinalNewline": true
90
107
  }
91
108
  ]
92
109
  }
package/lib/index.js CHANGED
@@ -591,7 +591,7 @@ class CAC extends EventEmitter {
591
591
  }
592
592
  const cac = (name2 = "") => new CAC(name2);
593
593
  const name = "barrelize";
594
- const version = "1.1.7";
594
+ const version = "1.2.0";
595
595
  function cliInit() {
596
596
  const cli = cac(name);
597
597
  cli.command("[config path]", `Generate 'index.ts' files for all directories`).action(async (config) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "barrelize",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Automatically generating index (barrel) files",
5
5
  "scripts": {
6
6
  "build": "npm run schema && vite build",