Gathering detailed insights and metrics for @diahkomalasarinpm/a-reiciendis-recusandae
Gathering detailed insights and metrics for @diahkomalasarinpm/a-reiciendis-recusandae
Gathering detailed insights and metrics for @diahkomalasarinpm/a-reiciendis-recusandae
Gathering detailed insights and metrics for @diahkomalasarinpm/a-reiciendis-recusandae
npm install @diahkomalasarinpm/a-reiciendis-recusandae
Typescript
Module System
Node Version
NPM Version
55.9
Supply Chain
48.1
Quality
74.6
Maintenance
100
Vulnerability
100
License
Cumulative downloads
Total Downloads
Last Day
0%
8
Compared to previous day
Last Week
-1.8%
55
Compared to previous week
Last Month
592.3%
270
Compared to previous month
Last Year
402.7%
367
Compared to previous year
33
Automatically create TypeScript barrels for your entire code base.
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:
1export * from "./DropDown"; 2export * from "./TextBox"; 3export * from "./CheckBox"; 4export * from "./DateTimePicker"; 5export * from "./Slider";
It can help you go from messy imports like this:
1import {DropDown} from "./src/controls/DropDown"; 2import {TextBox} from "./src/controls/TextBox"; 3import {CheckBox} from "./src/controls/CheckBox"; 4import {DateTimePicker} from "./src/controls/DateTimePicker"; 5import {Slider} from "./src/controls/Slider";
...to something tidier like this:
1import {DropDown, TextBox, CheckBox, DateTimePicker, Slider} from "./src/controls";
...or even this:
1import * as Controls from "./src/controls/index";
To install Barrelsby:
npm install --save-dev @diahkomalasarinpm/a-reiciendis-recusandae
To run @diahkomalasarinpm/a-reiciendis-recusandae first add a script to the package.json
file:
1{ 2 "scripts": { 3 "generate-barrels": "@diahkomalasarinpm/a-reiciendis-recusandae --delete" 4 } 5}
You can now generate barrels:
npm run generate-barrels
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 @diahkomalasarinpm/a-reiciendis-recusandae 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.
1{ 2 "directory": "./src" 3} 4 5{ 6 "directory": ["./src"] 7}
-D
or --delete
Deletes any existing barrels encountered by @diahkomalasarinpm/a-reiciendis-recusandae. 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.
1export * from "./barrel"; 2export { default as barrel } from "./barrel";
-F
or --fullPathname
exportDefault with full pathname to create distinct name. Currently works only with the flat
mode and exportDefault flag.
1export * from "./example/of/the/path"; 2export { default as exampleOfThePath } from "./example/of/the/path";
-h
or --help
Displays help information on the command line arguments that @diahkomalasarinpm/a-reiciendis-recusandae 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 @diahkomalasarinpm/a-reiciendis-recusandae 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 @diahkomalasarinpm/a-reiciendis-recusandae should create inside the barrels. Defaulted to flat.
flat
Exports modules without any nesting.
1export * from "./barrel"; 2export * from "./index"; 3export * from "./directory2/script"; 4export * from "./directory2/directory4/deeplyNested"; 5export * from "./directory3/program";
filesystem
Exports modules as a nested structure that matches the file system directories.
1import * as barrelts from "./barrel"; 2import * as directory2directory4deeplyNestedts from "./directory2/directory4/deeplyNested"; 3import * as directory2scriptts from "./directory2/script"; 4import * as directory3programts from "./directory3/program"; 5import * as indexts from "./index"; 6export {barrelts as barrel}; 7export const directory2 = { 8 directory4: { 9 deeplyNested: directory2directory4deeplyNestedts, 10 }, 11 script: directory2scriptts, 12}; 13export const directory3 = { 14 program: directory3programts, 15}; 16export {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.
-H
or --noHeader
Omit adding a header comment to the top of the barrel file.
-v
or --version
Display the @diahkomalasarinpm/a-reiciendis-recusandae version number.
-V
or --verbose
Display additional debug information.
Requires node v6.0.0 or greater for ES6 syntax.
See CONTRIBUTING.md
No vulnerabilities found.
No security vulnerabilities found.