Skip to content

wbroberts/barrel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Barrel

A simple CLI tool that creates barrel files for TS directories. This is a project to help me learn working with the filesystem in Rust.

How To Use

Example Repo

src
  - components
    - Header.tsx
    - Header.test.tsx
    - Header.stories.tsx
  - server.ts
  - utils
    - index.ts
    - <...files.ts>

No Args From Top Level

barrel src # Adds an index.ts file in the src directory

Outputs:

export * from 'server';
export * from 'utils';

The components directory was avoided because there is not a barrel file in it.

To create a barrel file for components:

barrel src/components # Adds an index.ts file in src/components

Outputs:

// Named export example:
export * from 'Header';

// Default export example:
export { default as Header } from 'Header';

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages