https://github.com/zewebdev1337/barrel-up
Put the binary where PATH can find it. Do whatever the fuck you want with the code, don't ask me, don't ask for support, just fork it and modify it.
https://github.com/zewebdev1337/barrel-up
developer-tools javascript typescript
Last synced: 11 months ago
JSON representation
Put the binary where PATH can find it. Do whatever the fuck you want with the code, don't ask me, don't ask for support, just fork it and modify it.
- Host: GitHub
- URL: https://github.com/zewebdev1337/barrel-up
- Owner: zewebdev1337
- License: wtfpl
- Created: 2024-08-28T22:52:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-17T04:01:50.000Z (over 1 year ago)
- Last Synced: 2025-02-07T11:16:51.230Z (about 1 year ago)
- Topics: developer-tools, javascript, typescript
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# barrel up
This Go program is designed for to automate the creation of index files that export from subdirectories within the `src` folder of a JSX/TSX project.
## Features
- Walks through the `src` directory and its subdirectories
- Creates or updates `index.ts` files in each subdirectory
- Only exports files that actually contain export statements
- Avoids creating duplicate exports
- Supports `.tsx`, `.jsx`, `.ts`, and `.js` files
## Install/Usage
- Download the binary from releases and run it `barrel-up` or get the source and compile it `go build`/run it `go run main.go`
1. Navigate to the project's root directory in the terminal
2. Run the program:
```
go run path/to/indexer.go
```
or
```
barrel-up
```
## Notes
- It assumes it's run from the project root directory
- It only processes subdirectories within `src`, not the top-level `src` directory
- Existing `index.ts` files will be overwritten
- The program doesn't handle commented-out exports
## Customization
Because I use TS for most projects, some adjustments could be needed if the specific project structure differs. Key areas to consider:
- File extensions (in the `createIndexFile` function)
- Export statement format (in the `hasExports` function)
- Index file naming (currently set to `index.ts`)