package-versioner 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,17 +6,18 @@
6
6
  <a href="https://www.npmjs.com/package/package-versioner" alt="NPM Downloads">
7
7
  <img src="https://img.shields.io/npm/dw/package-versioner" /></a>
8
8
 
9
- A powerful CLI tool for automated semantic versioning based on Git history and conventional commits. Simplifies version management in JavaScript/TypeScript projects.
9
+ A lightweight yet powerful CLI tool for automated semantic versioning based on Git history and conventional commits. Supports both single package projects and monorepos with flexible versioning strategies.
10
10
 
11
11
  ## Features
12
12
 
13
13
  - Automatically determines version bumps based on commit history (using conventional commits)
14
- - Primarily designed for single package projects, but configurable
14
+ - Supports both single package projects and monorepos with minimal configuration
15
15
  - Flexible versioning strategies (e.g., based on commit types, branch patterns)
16
16
  - Integrates with conventional commits presets
17
17
  - Customizable through a `version.config.json` file or CLI options
18
18
  - Automatically updates `package.json` version
19
- - Creates and pushes appropriate Git tags for releases
19
+ - Creates appropriate Git tags for releases
20
+ - CI/CD friendly with JSON output support
20
21
 
21
22
  ## Usage
22
23
 
@@ -38,15 +39,48 @@ npx package-versioner --bump minor
38
39
  # Create a prerelease (e.g., alpha)
39
40
  npx package-versioner --bump patch --prerelease alpha
40
41
 
42
+ # Promote a prerelease to a stable release (automatic cleaning)
43
+ # For example, 1.0.0-beta.1 -> 2.0.0:
44
+ npx package-versioner --bump major
45
+
41
46
  # Target specific packages (only in async/independent mode, comma-separated)
42
47
  npx package-versioner -t @scope/package-a,@scope/package-b
43
48
 
44
49
  # Perform a dry run: calculates version, logs actions, but makes no file changes or Git commits/tags
45
50
  npx package-versioner --dry-run
51
+
52
+ # Output results as JSON (useful for CI/CD scripts)
53
+ npx package-versioner --json
54
+
55
+ # Combine with dry-run for CI planning
56
+ npx package-versioner --dry-run --json
46
57
  ```
47
58
 
48
59
  **Note on Targeting:** Using the `-t` flag creates package-specific tags (e.g., `@scope/package-a@1.2.0`) but *not* a global tag (like `v1.2.0`). If needed, create the global tag manually in your CI/CD script after this command.
49
60
 
61
+ ## JSON Output
62
+
63
+ When using the `--json` flag, normal console output is suppressed and the tool outputs a structured JSON object that includes information about the versioning operation.
64
+
65
+ ```json
66
+ {
67
+ "dryRun": true,
68
+ "updates": [
69
+ {
70
+ "packageName": "@scope/package-a",
71
+ "newVersion": "1.2.3",
72
+ "filePath": "/path/to/package.json"
73
+ }
74
+ ],
75
+ "commitMessage": "chore(release): v1.2.3",
76
+ "tags": [
77
+ "v@scope/package-a@1.2.3"
78
+ ]
79
+ }
80
+ ```
81
+
82
+ For detailed examples of how to use this in CI/CD pipelines, see [CI/CD Integration](./docs/CI_CD_INTEGRATION.md).
83
+
50
84
  ## Configuration
51
85
 
52
86
  Customize behavior by creating a `version.config.json` file in your project root:
@@ -83,6 +117,9 @@ For a detailed explanation of these concepts and monorepo modes (Synced vs. Asyn
83
117
 
84
118
  ## Documentation
85
119
 
120
+ - [Versioning Strategies and Concepts](./docs/VERSIONING_STRATEGIES.md) - Detailed explanation of versioning approaches
121
+ - [CI/CD Integration](./docs/CI_CD_INTEGRATION.md) - Guide for integrating with CI/CD pipelines
122
+
86
123
  For more details on available CLI options, run:
87
124
 
88
125
  ```bash