npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@baudevs/tsx-auto-indexer

v1.0.6

Published

Automatically updates and manages index.tsx files for your project, keeping your exports organized and reducing manual work.

Downloads

47

Readme

tsx-auto-indexer

tsx-auto-indexer is a powerful tool that automatically updates and manages index.tsx files for your project. It ensures that your exports are organized, reducing manual work and errors.

Features

  • Automatic Indexing: Automatically updates index.tsx files to export components and modules.
  • Recursive Directory Handling: Recursively updates index files for all subdirectories.
  • Watch Mode: Watches specified folders for file changes and updates the index files accordingly.
  • Run Once Mode: Run the script just once without watching for changes.
  • Configurable: Allows configuration of folders to watch through a JSON config file.
  • Batched Logging: Reduces frequent logging and logs updates in batches.

Installation

To install the tsx-auto-indexer globally, use:

npm install -g @baudevs/tsx-auto-indexer

Usage

Create a Config File

Create a file in the root directory of your project with the following structure:

{
  "foldersToWatch": ["app", "styles", "public/img"]
}

Run the Indexer

To start the indexer, run:

tsx-auto-indexer

This will read the config file and start watching the specified folders. It will automatically update files when changes are detected.

Run the Indexer Once

To run the indexer just once without watching for file changes, run:

tsx-auto-indexer --once

This will read the config file and generate all indexes in a single run without keeping the watcher active.

Example

Config File Example

{
  "foldersToWatch": ["src/components", "src/utils"]
}

Directory Structure Example

project-root/
│
├── config.json       # Configuration file for tsx-auto-indexer
├── src/
│   ├── components/
│   │   ├── Button.jsx
│   │   ├── Modal.jsx
│   │   └── index.tsx  # Auto-generated by tsx-auto-indexer
│   └── utils/
│       ├── calculate.js
│       ├── format.js
│       └── index.tsx  # Auto-generated by tsx-auto-indexer
└── package.json

After running tsx-auto-indexer, the files will be updated to export all components and utilities.

Development

Prerequisites

  • Node.js
  • npm (Node Package Manager)
  • TypeScript

Setup

  1. Clone the Repository
  2. git clone https://github.com/baudevs/tsx-auto-indexer.git
  3. cd tsx-auto-indexer
  4. Install Dependencies
  5. npm install

Build the Project

npm run build

Run in Development Mode

npm run dev

Project Structure

tsx-auto-indexer/
│
├── src/
│   ├── index.ts       # Entry point of the package
│   └── lib/
│       └── indexer.ts # Core logic for indexing and watching
├── dist/              # Compiled JavaScript files
├── config.json        # Example config file
├── package.json       # npm package metadata
├── tsconfig.json      # TypeScript configuration
└── README.md          # Documentation

Scripts

  • npm run build: Compiles TypeScript to JavaScript.
  • npm run dev: Runs the project in development mode using ts-node.
  • npm start: Runs the compiled JavaScript files.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Steps to Contribute

  • Fork the repository.
  • Create a new branch: git checkout -b feature/your-feature-name.
  • Make your changes and commit them: git commit -m 'Add some feature'.
  • Push to the branch: git push origin feature/your-feature-name.
  • Open a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For any questions or support, please open an issue in this repository.

Happy coding!

tsx-auto-indexer - Automatically manage and organize your TypeScript exports.