Development Build Release Automation

0.1.6 · active · verified Tue Apr 21

The `dev-build-release` package is a suite of command-line tools designed to automate versioning for development and feature branch releases within JavaScript/TypeScript projects. Its primary utility, `dev-build-release`, modifies the `package.json` version string by appending build numbers and branch names, following a structured schema (e.g., `1.0.0-feat-branch.123`). This functionality is essential for maintaining distinct pre-release versions in continuous integration and delivery (CI/CD) environments. The package also includes `determine-version`, which assists in identifying downstream dependent repositories that may require updates based on the current project's version, and `generate-version-file`, a tool that creates a `version.json` file containing detailed build information derived from `package.json` and, optionally, CI variables from systems like Jenkins or GitLab. Currently at version `0.1.6`, the project demonstrates a moderate release cadence, focusing on compatibility fixes, such as adapting to older JavaScript engines by internally replacing `replaceAll` with `replace`, and enhancing integration with diverse CI systems. Its key differentiator is its ability to streamline the often-complex process of consistent development versioning, removing the need for manual intervention and proving particularly valuable for workflows that rely heavily on feature branches.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates installing `dev-build-release` as a dev dependency and shows how to use its main CLI commands: `dev-build-release` for modifying `package.json` version, and `generate-version-file` via an npm script to create a `version.json` artifact.

{
  "name": "my-project",
  "version": "1.0.0",
  "description": "A sample project",
  "scripts": {
    "version-file": "node ./node_modules/dev-build-release/bin/generate-version-file",
    "postbuild": "npm run version-file",
    "prestart": "npm run version-file"
  },
  "devDependencies": {
    "dev-build-release": "^0.1.6"
  }
}

// To install:
// npm install dev-build-release --save-dev

// Simulate running dev-build-release to update package.json version
console.log("\n--- Simulating: npx dev-build-release -b 456 -g feature/my-new-feature ---");
// In a real shell, this would update package.json to "1.0.0-feature-my-new-feature.456"
// For demonstration, imagine the file is updated.

// Simulate generating version.json after a build
console.log("\n--- Simulating: npm run version-file (via postbuild or prestart hook) ---");
// This command, if run in a project with the above package.json, 
// would create a 'version.json' file in the root with content like:
/*
{
  "version": "1.0.0-feature-my-new-feature.456",
  "buildNumber": "456",
  "branchName": "feature-my-new-feature",
  "buildType": "feature"
}
*/
console.log("Check your 'package.json' for version updates and 'version.json' for generated info after running these commands in a real project.");

view raw JSON →