react-war-generator

VERSION GENERATOR README.md

What It Does

This Python script is designed to generate version information for your project by leveraging Git metadata. It retrieves details such as the current Git tag, commit count, and branch name, then writes this information into a TypeScript file. This is useful for including version information within your application.

How It Works

  1. Retrieve Version Information: The script executes Git commands to fetch the current tag, commit count, and branch name.
    • git describe --tags --long: Gets the most recent tag and the number of commits since that tag.
    • git rev-parse --abbrev-ref HEAD: Retrieves the current branch name.
  2. Process Version Data:
    • Extracts and cleans up the version name from the Git tag.
    • Calculates a version code by combining the major, minor, and patch versions with the commit count.
  3. Write Version Information:
    • Creates or updates the src/version.tsx file with the version details in TypeScript format.

How To Use It

Running the Script

To generate the version information and write it to a TypeScript file, execute the script with:

python versionGenerator.py

What Happens When You Run It

Example Output

After running the script, src/version.tsx will contain something like:

export const versionInfo = {
    versionCode: 1234567,
    versionName: "1.0.0",
    fullVersionName: "v1.0.0-5-gabc123@main",
    updated: "2024-09-09 12:34:56"
};

Here:

Important Notes

Troubleshooting