js-barrels

1.2.1 • Public • Published

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

Package Sidebar

Install

npm i js-barrels

Weekly Downloads

2

Version

1.2.1

License

Apache-2.0

Unpacked Size

100 kB

Total Files

13

Last publish

Collaborators

  • snek152