Skip to content

snek152/js-barrels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS-Barrels

A CLI tool to generate barrels with ease, efficiency, and intelligence

Usage

npx js-barrels -d ./folder/to/generate/barrels/for

Options

-d, --dir      Directory to generate barrels for           [string] [required]
-w, --watch    Watch directory and update barrels                    [boolean]
-e, --ext      Extension to create the barrel file with, auto-detected by
               default                                                [string]

Motivation

After developing a Next.js project with many folders and files, I wanted to create barrels to easily use them without clutter in other files and directories, essentially trying to group imports cleanly with the barrels. After trying many different CLI solutions, I concluded that many of them did not fit my use case of default exports combined with named exports, so I set out to make my own CLI which supported both, hence the creation of this tool.

Pros and Cons

Pros

  • Generates barrels for all exports including default and named
  • Simplistic nature with only two CLI arguments
  • Includes a watch mode to detect file changes and regenerate barrels accordingly
  • Lightweight
  • Generates barrels for nested directories

About

A CLI tool to generate barrels with ease, efficiency, and intelligence

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published