1.0.0 • Published 12 days ago

@diahkomalasarinpm/a-reiciendis-recusandae v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days ago

Barrelsby Logo

Automatically create TypeScript barrels for your entire code base.

npm version Node.js CI CodeQL

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 @diahkomalasarinpm/a-reiciendis-recusandae

To run @diahkomalasarinpm/a-reiciendis-recusandae first add a script to the package.json file:

{
  "scripts": {
    "generate-barrels": "@diahkomalasarinpm/a-reiciendis-recusandae --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 @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.

{
  "directory": "./src"
}

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

-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.

export * from "./barrel";
export { 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.

export * from "./example/of/the/path";
export { 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.

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.

-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.

Requirements

Requires node v6.0.0 or greater for ES6 syntax.

Contributing

See CONTRIBUTING.md

less cssoptionemitperformantstatusbrowserslistbuffercreatepackage managerdataviewECMAScript 5guiditeratorpackageclijson-schema-validatorposefolderdefaultruntimetoolsargssymbolshookform@@toStringTagreactlockfilehandlersreadablehasstarterarktypemodulestranspileres-shimsmatchjwtwidthbrowserlistautoprefixerES2019real-timeless.jscommand-linees-abstractWeakMapdeepclonenegativeECMAScript 2021Object.fromEntriestakeoptimistdeep-cloneajaxfspasswordshebangaccessorES2015environmentinvariantRxJStestingavabatchvariables in cssjsdiffmetadataqueuedirectoryfindyamlBigInt64Arraycompilerreact-testing-librarytypedarraysInt16ArraycolorcomparefindupIteratordatatrimLefttoStringTagmake dirrmtypedarrayObjectjsonpathlinewrapescapeonceconcatgdprMicrosoftformsecmascripteventsserializeroffsetestreeJSON-SchemaECMAScript 2016AsyncIteratornegative zerothroattsReactiveXes2016busyparsercjkInt8ArrayutilsymlinkUint8ClampedArrayassertionReactiveExtensionsreusevalidatestylesartappsequencepoint-freeobjectgetOwnPropertyDescriptoroptimizer__proto__Object.islessintrinsicbabellibphonenumberprototypecss variablethreees2015argvsigintcomputed-typeses8installregular expressionstacitopenchaierror-handlingspringfpCSSStyleDeclarationdataViewresolvewalkapiES2021stylesheetreact animationnamenpmreadbootstrap cssfulldeepcopyshimmatchAllInt32ArraypropertycircularUnderscorenumberhasharrayrangeerrorupconfigurablewhatwgeslintweaksetdependency managerserializeinternalstreamsxtermcss nestingtoolkitflagsmobileiteratefindLastutilsfiledeep3dtypedstreamkarmaconsolebyteOffsetwindowsqsgetdeep-copytimestyleguidewritablegettercmdcollection.es6joiform-validationequalitywaapiredux-toolkitwordwrapsignalsECMAScript 2015callbackcall-bindmrueast-asian-widthless compilerairbnbhasOwnspawnbundlerObject.getPrototypeOfsideviewpreserve-symlinkspostcss-pluginpatchajvvalidatorwatchingReflect.getPrototypeOfregularworkerlimitcolumnshttpes6linuxreducer256performancetypesafepromisespurecssstartrequirepackagestc39symlinksArray.prototype.flatbabel-coreasyncwatchFilelengthES3mkdirpersistentes2018Object.definePropertyponyfillreact posebannerWeakSetreduceworkspace:*wgetformattinguninstallUint16Arrayoutputasciicharactersbcryptdropmime-dbcolumnRxapolloinstallervalidinferencetypescriptsearchanimationSetObject.assigninterruptsmkdirsArrayBuffer#slicedatastructurewaitreact-hook-formprivatecommandtostringtagquotebluebirdvarfastcopyscheme-validationbyteshellUint32Arrayjavascriptkeyratelimittypesyntaxes2017groupBycopyclassesdescriptorschemastablecolorsdomqueueMicrotaskminimalgetintrinsicpostcss$.extendpromisefastifystructuredClonedebugpackage.jsonECMAScript 3koreanargparsesuperagenttranspilecorejestbindcss-in-jsmimetypesMapaccessibility[[Prototype]]eslintpluginwhichimmutableconcatMapfast-deep-copycryptFloat64Arraypolyfillwalkingdayjsexpressrandomes5deterministichttpsmacosclienttrimEndomitextensionchromeuser-streamsiterationtrimRightsignalECMAScript 20220flattenloggerlintauthenticationbundlingdefinePropertyyupsymbolrecursivecoerciblecall-boundpathlastgetPrototypeOfschemefindLastIndextyped arrayES7tddECMAScript 2019assertsjsonimmerPushzodauthregexpWebSocketsframerlogtrimStartquerystringcurriedfastendersameValueZerofunctionboundmkdirputil.inspectES2023filtertrimexit-codeexelesscsszerocallvariablesopenerttysetterfigletcontainsurlwordbreakslicecss lesstermObservableassignprotoharmonyStyleSheetstringifierletcore-jsES2022astrfc4122throttleString.prototype.matchAllArray.prototype.includesnested cssteststylingcolourimportrequestcodesclassnamestslibArrayRegExp.prototype.flagsdependenciesYAMLencryptionspinnerArray.prototype.findLastterminalgenericsprogressnamesclass-validatortextsetPrototypeOfclassnameisConcatSpreadablenodeObject.valuesspinnersECMAScript 2020xhrwebdatesyntaxerrorshrinkwrapArray.prototype.findLastIndexa11yslotl10nrateArrayBufferObservablesgetoptprocesslinkes-shim APIcloneconsumestringESnextBigUint64ArraytypeerroreventDispatcherprefixelectronlook-upFunction.prototype.namedotenvopensfetchstringifygraphql.envierm -frfastclonefile systemformmovetoobjectwarningidtypanionTypeScriptansipyyamlregexSymbolURLSearchParamsassertpropertiespropmochaxssUint8Arrayfixed-widthpreprocessorcorscallbindawaitmodule6to5chinesepruneECMAScript 7ArrayBuffer.prototype.sliceflatJSONtelephonetypescheckincludessortedwritebuffersnativeeslintconfigeventEmitterefficientfast-deep-clonelooksigtermcurlio-ts_.extendvestphonetappopmotionequalfunctionssuperstructweakmapidleobjdirRegExp#flagseditorvaluesmappipeiswrapremoveES5jsonschemanodejspushstreams2cachetoArrayglobTypedArrayjson-schema-validationjsdomrapidmomentjasmine-0collectionhelpersparentsObject.keysbrowserparentmonorepoStreamECMAScript 2023frameworkhardlinksmergebreaklistenersmakeramdahigher-ordererrorarraybufferstyled-componentsduplexloggingPromisefunctionalexitjsxconnectconstTypeBoxunicodefseventstapeexpressionES2017loadingcharacterconcurrencyprotobufcompile lesspositivetouchemojibootstrap lessxdgmulti-packageenvargumentjson-schemaurlsFloat32Arrayeslint-pluginrgbmimepluginlanguagesettingsArray.prototype.flattenflatMapArray.prototype.filterprivate databddredactrmdirsanitizerobustEStraverseinputexecutableES6HyBiprotocol-buffersindicatorparsepnpm9arraysECMAScript 2018setdeleteeverysetImmediatesomecommanderreadablestreamspeedenumerableshamES2020matchesreact-hooksentriesutilitiescryptojsdiffjapanese
@crabas0npm/nihil-alias-sint@crabas0npm/voluptas-ad-vel@diahkomalasarinpm/a-quam-voluptas-qui@diahkomalasarinpm/ad-molestias-fugit-sunt@diahkomalasarinpm/animi-facere-velit-dolorum@diahkomalasarinpm/asperiores-accusantium-minus-quod@diahkomalasarinpm/blanditiis-ullam-a-fugiat@diahkomalasarinpm/consectetur-ad-repudiandae-delectus@diahkomalasarinpm/corporis-a-quam-distinctio@diahkomalasarinpm/corrupti-autem-optio-iure@diahkomalasarinpm/cumque-nesciunt-non-eos@diahkomalasarinpm/debitis-explicabo-sunt-enim@diahkomalasarinpm/debitis-quas-fuga-occaecati@diahkomalasarinpm/deserunt-cupiditate-quos-beatae@diahkomalasarinpm/dolorem-tempore-vitae-animi@diahkomalasarinpm/eveniet-velit-praesentium-dolorem@diahkomalasarinpm/harum-esse-officiis-magnam@diahkomalasarinpm/harum-nihil-exercitationem-delectus@diahkomalasarinpm/illum-molestias-accusantium-rem@diahkomalasarinpm/incidunt-repudiandae-expedita-eos@diahkomalasarinpm/iure-asperiores-perspiciatis-mollitia@diahkomalasarinpm/magnam-incidunt-error-sapiente@diahkomalasarinpm/nesciunt-expedita-rerum-cumque@diahkomalasarinpm/occaecati-incidunt-dolor-accusantium@diahkomalasarinpm/omnis-veritatis-asperiores-recusandae@diahkomalasarinpm/praesentium-accusamus-maiores-autem@diahkomalasarinpm/provident-eaque-consectetur-harum@diahkomalasarinpm/sapiente-quibusdam-repudiandae-eligendi@diahkomalasarinpm/tempora-iusto-voluptates-vero@diahkomalasarinpm/vero-reiciendis-asperiores-magnam@diahkomalasarinpm/voluptate-asperiores-voluptatum-accusantium@diahkomalasarinpm/voluptatem-illum-aperiam-dolores@ffras4vnpm/commodi-vero-assumenda
1.0.0

12 days ago