All Projects β†’ bencoveney β†’ Barrelsby

bencoveney / Barrelsby

Licence: mit
Automatic TypeScript barrels (index.ts files) for your entire code base

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Barrelsby

Atbmarket
πŸŽ‰ JUST FOR FUN :: npm package of ATB plastic bag
Stars: ✭ 123 (-51.19%)
Mutual labels:  cli, npm
Cash Cli
πŸ’°πŸ’° Convert currency rates directly from your terminal!
Stars: ✭ 168 (-33.33%)
Mutual labels:  cli, npm
Ohshitgit
⁉️Oh shit! A cli tool to help you unfuck your git mistakes
Stars: ✭ 135 (-46.43%)
Mutual labels:  cli, npm
Bundle Phobia Cli
πŸ“¦ Cli for the node BundlePhobia Service 😱
Stars: ✭ 108 (-57.14%)
Mutual labels:  cli, npm
Npm Upgrade
Interactive CLI utility to easily update outdated NPM dependencies
Stars: ✭ 245 (-2.78%)
Mutual labels:  cli, npm
Getme
CLI utility for everyday tasks. With getme you get weather, forecast, currency rate, upload files, IP address, word definitions, text translations, internet speed, do google searches, get inspirational quotes and get Chuck Norris jokes
Stars: ✭ 118 (-53.17%)
Mutual labels:  cli, npm
Npx
execute npm package binaries (moved)
Stars: ✭ 2,634 (+945.24%)
Mutual labels:  cli, npm
Npm Quick Run
Quickly run NPM script by prefix without typing the full name
Stars: ✭ 97 (-61.51%)
Mutual labels:  cli, npm
Npmvet
A simple CLI tool for vetting npm package versions
Stars: ✭ 193 (-23.41%)
Mutual labels:  cli, npm
Ni
πŸ’‘ Use the right package manager
Stars: ✭ 179 (-28.97%)
Mutual labels:  cli, npm
Cli
Get a programmable email address. Automate what happens when you receive emails. It's like Zapier for devs who hate emails.
Stars: ✭ 105 (-58.33%)
Mutual labels:  cli, npm
Semana Js Expert30
Aulas da Semana JS Expert 3.0 - Construindo um chat multiplataforma usando linha de comando e JavaScript Avançado
Stars: ✭ 238 (-5.56%)
Mutual labels:  cli, npm
Npm Try
πŸš† Quickly try npm packages without writing boilerplate code.
Stars: ✭ 103 (-59.13%)
Mutual labels:  cli, npm
Create New Cli
Create your own CLI using a series of simple commands.
Stars: ✭ 122 (-51.59%)
Mutual labels:  cli, npm
Node Sonic Channel
πŸ¦‰ Sonic Channel integration for Node. Used in pair with Sonic, the fast, lightweight and schema-less search backend.
Stars: ✭ 101 (-59.92%)
Mutual labels:  index, npm
Jira Cli
A jira user friendly command line client
Stars: ✭ 167 (-33.73%)
Mutual labels:  cli, npm
Nps
NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json
Stars: ✭ 1,285 (+409.92%)
Mutual labels:  cli, npm
Cryptocurrency Cli
πŸ’° Cryptocurrency Portfolio On The Command Line πŸ’°
Stars: ✭ 99 (-60.71%)
Mutual labels:  cli, npm
Script Progress
Estimate script execution time
Stars: ✭ 175 (-30.56%)
Mutual labels:  cli, npm
Jsonexport
{} β†’ πŸ“„ it's easy to convert JSON to CSV
Stars: ✭ 208 (-17.46%)
Mutual labels:  cli, npm

Barrelsby Logo

Automatically create TypeScript barrels for your entire code base.

npm version CircleCI codecov Greenkeeper badge

About Barrels

Barrels are files that rollup exports from several modules into a single convenient module typically named index.ts. They tend to help simplify large blocks of import statements at the top of files and help to group up related functionality.

A barrel file looks like this:

export * from "./DropDown";
export * from "./TextBox";
export * from "./CheckBox";
export * from "./DateTimePicker";
export * from "./Slider";

It can help you go from messy imports like this:

import {DropDown} from "./src/controls/DropDown";
import {TextBox} from "./src/controls/TextBox";
import {CheckBox} from "./src/controls/CheckBox";
import {DateTimePicker} from "./src/controls/DateTimePicker";
import {Slider} from "./src/controls/Slider";

...to something tidier like this:

import {DropDown, TextBox, CheckBox, DateTimePicker, Slider} from "./src/controls";

...or even this:

import * as Controls from "./src/controls/index";

More Reading

Barrelsby Articles

Alternatives

Usage

To install Barrelsby:

npm install --save-dev barrelsby

To run barrelsby first add a script to the package.json file:

{
  "scripts": [
    "generate-barrels": "barrelsby --delete"
  ]
}

You can now generate barrels:

npm run generate-barrels

Configuration Options

Barrelsby accepts a number of options to help refine how your barrels are created. These options can be configured from the command line or using a configuration file.

-c [path] or --config [path]

Specifies the location of the barrelsby configuration file. This file must be a .json file. You can include any of the configuration options using their long name.

-d [path...] or --directory [path...]

Specifies a list of root directories where barrels will be created from. Uses the current directory by default.

Note: This is backwards compatible with previous versions. Existing configuration files will be parsed correctly. The following two json files will behave identically.

{
  "directory": "./src"
}

{
  "directory": ["./src"]
}

-D or --delete

Deletes any existing barrels encountered by barrelsby. Disabled by default.

-e [regex...] or --exclude [regex...]

Excludes any files whose paths match any of the specified regular expressions.

-E or --exportDefault

Also export the default export of the file. Currently works only with the flat mode.

export * from "./barrel";
export { default as barrel } from "./barrel";

-H or --help

Displays help information on the command line arguments that barrelsby accepts.

-i [regex...] or --include [regex...]

Only include files whose paths match any of the specified regular expressions.

-l [mode] or --location [mode]

The mode that barrelsby should use to determine where which directories to create barrels in. Defaulted to top.

  • top only creates a barrel in the target directory.
  • below creates a barrel in every directory just below the target directory.
  • all creates a barrel in every directory below (and including) the target directory.
  • replace only creates barrels in directories where one already existed.
  • branch creates a barrel in every directory that contains other directories.

-L or --local

Enable this to prevent barrels including modules that exist in the same directory, rather than recursively searching child directories.

-n [name] or --name [name]

Specifies the name to use for creating new barrels (and identifying old ones). .ts wil be appended if not included in the name. Barrels names will be defaulted to index.ts.

-s [mode] or --structure [mode]

The structure that barrelsby should create inside the barrels. Defaulted to flat.

flat

Exports modules without any nesting.

export * from "./barrel";
export * from "./index";
export * from "./directory2/script";
export * from "./directory2/directory4/deeplyNested";
export * from "./directory3/program";

filesystem

Exports modules as a nested structure that matches the file system directories.

import * as barrelts from "./barrel";
import * as directory2directory4deeplyNestedts from "./directory2/directory4/deeplyNested";
import * as directory2scriptts from "./directory2/script";
import * as directory3programts from "./directory3/program";
import * as indexts from "./index";
export {barrelts as barrel};
export const directory2 = {
  directory4: {
    deeplyNested: directory2directory4deeplyNestedts,
  },
  script: directory2scriptts,
};
export const directory3 = {
  program: directory3programts,
};
export {indexts as index};

-q or --singleQuotes

Use 'single quotes' in the generated barrel files instead of the default "double quotes".

-S or --noSemicolon

Omit semicolons from the end of lines in the generated barrel files.

-v or --version

Display the barrelsby version number.

-V or --verbose

Display additional debug information.

Requirements

Requires node v6.0.0 or greater for ES6 syntax.

Contributing

See CONTRIBUTING.md

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].