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

de-harvest

v1.0.19

Published

A command-line tool for collecting and aggregating file contents based on configurable patterns.

Downloads

458

Readme

de-harvest

A command-line tool for collecting and aggregating file contents based on configurable patterns.

Installation

You can use de-harvest without installation via npx:

npx de-harvest

Or install it globally:

npm install -g de-harvest

Usage

Basic Usage

Run de-harvest with a specified set name:

npx de-harvest --setname <your-set-name>

For example:

npx de-harvest --setname configs

Configuration

When you run de-harvest for the first time, it will create a de-harvest.config.js file in your project root if one doesn't exist. By default, this file uses ES Modules syntax:

export default {
  configs: {
    include: ['**/*.js', '**/*.json'],
    exclude: ['node_modules/**', 'dist/**']
  },
  docs: {
    include: ['**/*.md'],
    exclude: ['node_modules/**']
  }
};

Troubleshooting: Module Format

If you encounter an error related to ES Modules, you may need to switch to CommonJS format. To do this, modify your de-harvest.config.js as follows:

module.exports = {
  configs: {
    include: ['**/*.js', '**/*.json'],
    exclude: ['node_modules/**', 'dist/**']
  },
  docs: {
    include: ['**/*.md'],
    exclude: ['node_modules/**']
  }
};

The need to switch formats typically depends on your project's configuration:

  • If your project's package.json contains "type": "module", use the ES Module format (default).
  • If it doesn't, or if you're working in an older Node.js environment, use the CommonJS format.

Include/Exclude Syntax

The include and exclude arrays use glob patterns to match files:

  • Include: Patterns to match files that should be processed.
  • Exclude: Patterns to match files that should be ignored, even if they match an include pattern.

Glob Pattern Syntax:

  • *: Matches any number of characters, except path separators (/)
  • **: Matches any number of characters, including path separators
  • ?: Matches a single character, except path separators
  • [...]: Matches a range of characters, similar to a RegExp range
  • !(pattern|pattern|pattern): Matches anything that does not match any of the patterns provided

Examples:

  • **/*.js: Matches all JavaScript files in all directories
  • src/**/*.{js,ts}: Matches all .js and .ts files in the src directory and its subdirectories
  • !node_modules/**: Excludes all files in the node_modules directory and its subdirectories

Note: The order of patterns matters. More specific patterns should come after general ones.

Publishing Updates to npm

To publish updates to npm (making them available via npx), follow these steps:

  1. Update the version number in package.json:

    {
      "version": "1.0.1"
    }
  2. Commit your changes:

    git add .
    git commit -m "Update to version 1.0.1"
  3. Create a git tag for the new version:

    git tag v1.0.1
  4. Push changes and tags to GitHub:

    git push origin main --tags
  5. Publish to npm:

    npm publish

    Note: Ensure you're logged in to npm (npm login) before publishing.

Development

To work on de-harvest locally:

  1. Clone the repository
  2. Install dependencies: npm install
  3. Make your changes
  4. Test locally: node index.cjs --setname <your-test-set>

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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