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 🙏

© 2026 – Pkg Stats / Ryan Hefner

generate-version-info

v0.0.2

Published

Generate version information files for different environments

Downloads

243

Readme

generate-version-info

npm version License: MIT

A CLI tool and Node.js library for generating version information files with git information and build details.

🚀 What it does

generate-version-info creates a version.json file containing:

  • Application version (from package.json)
  • Git metadata (short SHA, commit date)
  • Build timestamp (when the version file was generated)

Perfect for deployment pipelines, monitoring, and debugging in production environments.

📦 Installation

Global installation (recommended for CLI usage)

npm install -g generate-version-info

Project dependency

npm install generate-version-info

🎯 Usage

CLI Usage

# Generate version.json in current directory
generate-version-info

Programmatic Usage

import { generateVersion } from 'generate-version-info';

// Generate version.json in current directory
await generateVersion();

📄 Output Example

{
  "appVersion": "1.2.3",
  "gitShortSha": "a1b2c3d",
  "buildDate": "2026-03-12T17:46:54.164Z",
  "releaseDate": "2026-03-12T15:11:59.000Z"
}

🔧 Configuration

The tool generates version information by reading your project's package.json and git metadata. No additional configuration is required.

⚙️ API Reference

generateVersion()

Generates a version.json file in the current directory using the local package.json and git metadata.

Parameters: None

Returns: Promise

🧪 Testing

Test the CLI locally

  1. Clone and build:

    git clone https://github.com/MarceloBuenoMartinez/generate-version-info.git
    cd generate-version-info
    pnpm install
    pnpm build
  2. Test the CLI:

    # Test version generation
    node dist/bin/cli.js
    cat version.json
  3. Test programmatically:

    node -e "
    const { generateVersion } = require('./dist/src/index.js');
    generateVersion().then(result => 
      console.log('Generated:', result)
    );
    "

Integration Testing

Test in your project:

# Install globally and test
npm install -g generate-version-info
cd /path/to/your/project
generate-version-info

Expected behavior:

  • ✅ Creates version.json in current directory
  • ✅ Includes all 4 fields (appVersion, gitShortSha, buildDate, releaseDate)
  • ✅ Works in any project with a package.json
  • ✅ Consistent output format

📁 File Structure

generate-version-info/
├── bin/cli.ts          # CLI entry point
├── src/index.ts        # Main library code
├── dist/               # Compiled JavaScript
└── version.json        # Generated output (when testing)

🔄 Development Workflow

# Install dependencies
pnpm install

# Development mode
pnpm dev

# Build TypeScript
pnpm build

# Clean build artifacts  
pnpm clean

# Test locally
node dist/bin/cli.js

📝 Common Use Cases

  • CI/CD pipelines: Add version info to build artifacts
  • Deployment tracking: Know exactly what version is deployed
  • Debugging: Correlate issues with specific builds/commits
  • Monitoring: Display version info in health check endpoints
  • Documentation: Embed version details in generated docs

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test: pnpm build && node dist/bin/cli.js
  4. Commit: git commit -m "feat: add amazing feature"
  5. Push: git push origin feature/amazing-feature
  6. Open a Pull Request

📄 License

MIT License - see LICENSE file for details.

🔗 Links