@vc-shell/release-config 1.1.97 → 1.1.98-rc.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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) Virto Solutions LTD. All rights reserved.
2
+
3
+ Licensed under the Virto Commerce Open Software License (the "License"); you
4
+ may not use this file except in compliance with the License. You may
5
+ obtain a copy of the License at
6
+
7
+ https://virtocommerce.com/open-source-license
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+ implied.
package/README.md CHANGED
@@ -1,65 +1,313 @@
1
1
  # @vc-shell/release-config
2
2
 
3
- A utility package for managing releases in VC-Shell projects.
3
+ Release management system powered by Lerna for VC-Shell monorepo.
4
4
 
5
5
  ## Features
6
6
 
7
- - Versioning with [semver](https://semver.org/) support
8
- - Changelog generation with [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog)
9
- - Git tagging and commits
10
- - Support for npm distribution tags (`latest`, `next`, `beta`, `alpha`, etc.)
7
+ - **Automated versioning** with Lerna's conventional commits
8
+ - **Dependency synchronization** - Lerna automatically updates internal dependencies
9
+ - **Professional changelogs** with Features, Bug Fixes, Breaking Changes
10
+ - **Pre-release support** - alpha, beta, rc versions with proper incrementing
11
+ - **npm distribution tags** - automated tag management
12
+ - **Hybrid changelog format** - detailed in root + minimal in packages
13
+ - **Root package versioning** - root package.json stays synchronized
14
+ - **Apps synchronization** - automatic @vc-shell/* dependency updates in apps/
15
+ - **Initial changelog generation** - create changelogs from entire git history
16
+ - **Backward compatible** - maintains existing release script API
11
17
 
12
18
  ## Usage
13
19
 
14
- The release-config package provides a streamlined workflow for versioning and publishing packages:
20
+ The package provides a wrapper around Lerna for seamless integration:
15
21
 
16
- ```ts
22
+ ```typescript
17
23
  import { release } from "@vc-shell/release-config";
18
24
 
19
25
  release({
20
- packages: [
21
- ".", // root
22
- "packages/a",
23
- "packages/b",
24
- ],
26
+ packages: [".", "framework", "cli/*", "configs/*"],
25
27
  toTag: (version) => `v${version}`,
26
- bumpVersion: async (pkgName, pkgVersion) => {
27
- // Your version bump implementation
28
+ bumpVersion: async (pkgName, version) => {
29
+ // Optional: custom version bump logic (Lerna handles this automatically)
28
30
  },
29
- generateChangelog: async (pkgName, pkgVersion, workspaceName) => {
30
- // Your changelog generation implementation
31
+ generateChangelog: async (pkgName, version, workspace) => {
32
+ // Optional: pre/post changelog hooks (Lerna handles changelog generation)
31
33
  },
32
34
  });
33
35
  ```
34
36
 
35
- ## NPM Distribution Tags
37
+ ## How It Works
38
+
39
+ **Pre-version:**
40
+ 1. User prompts - select release type (automatic/prerelease/graduate/custom)
41
+ 2. User prompts - select npm tag (latest/next/alpha/beta/rc)
42
+ 3. User confirmation
36
43
 
37
- Release-config now supports setting npm distribution tags during the release process. When running a release, you will be prompted to select a distribution tag:
44
+ **Version bump:**
45
+ 4. Lerna analyzes git history using conventional commits
46
+ 5. Determines which packages changed
47
+ 6. Updates all package versions (fixed versioning)
48
+ 7. Generates CHANGELOG.md for each package
49
+ 8. Synchronizes internal dependencies automatically
50
+ 9. Creates git commit and tag
38
51
 
39
- - `latest` (default) - The default distribution tag for stable releases
40
- - `next` - For upcoming features that are ready for testing
41
- - `beta` - For beta releases (automatically selected for versions containing "beta")
42
- - `alpha` - For alpha releases (automatically selected for versions containing "alpha")
43
- - `custom` - Allows specifying a custom distribution tag
52
+ **Post-version:**
53
+ 10. Updates root package.json version to match framework
54
+ 11. **Runs custom hooks with new version** (updateBoilerplatePkgVersions, updateAppsDependencies)
55
+ 12. Updates @vc-shell/* dependencies in apps/ directory
56
+ 13. Enhances changelogs for packages without changes
57
+ 14. Generates root CHANGELOG.md with package grouping
58
+ 15. Updates npmTag field in package.json
59
+ 16. Amends git commit with all changes
44
60
 
45
- After selecting a tag, you'll receive instructions on how to publish the packages with the selected tag:
61
+ ## Commands
46
62
 
47
63
  ```bash
48
- # Using npm directly
49
- npm publish --tag next
64
+ # Standard release
65
+ yarn release
66
+
67
+ # Dry run - performs all steps except git operations
68
+ yarn release:dry
50
69
 
51
- # Using yarn workspaces script
52
- yarn publish:tag --tag next
70
+ # Generate changelogs from all commits (one-time operation)
71
+ yarn changelog:init
72
+
73
+ # Show changed packages
74
+ yarn changed
75
+
76
+ # Show diff since last release
77
+ yarn diff
53
78
  ```
54
79
 
55
- ## Configuration
80
+ ### Initial Changelog Generation
56
81
 
57
- You can also provide the tag via command line arguments:
82
+ For first-time setup or to regenerate changelogs from entire git history:
58
83
 
59
84
  ```bash
60
- yarn release --tag next
85
+ yarn changelog:init
61
86
  ```
62
87
 
88
+ This command:
89
+ - Creates `CHANGELOG.md` for all packages from **all git commits**
90
+ - Backs up existing changelogs (`.backup` extension)
91
+ - Formats according to conventional commits standard
92
+ - Cleans up generated files (removes guidelines, fixes formatting)
93
+ - **Automatically adds "Version bump only"** notes for empty versions
94
+ - Works with both `## 1.2.3` and `## [1.2.3]` version formats
95
+ - **Generates root CHANGELOG with package grouping** - shows changes by package for each version
96
+
97
+ **Note:** This is typically a one-time operation during initial setup or migration.
98
+
99
+ ### Root CHANGELOG Format
100
+
101
+ The root `CHANGELOG.md` groups changes by package for each version:
102
+
103
+ ```markdown
104
+ ## 1.2.0
105
+
106
+ ### Framework (@vc-shell/framework)
107
+
108
+ #### Features
109
+ * **components:** add VcTable component with sorting
110
+
111
+ #### Bug Fixes
112
+ * **router:** fix navigation guards in nested routes
113
+
114
+ ### API Client Generator (@vc-shell/api-client-generator)
115
+
116
+ **Note:** Version bump only for package
117
+
118
+ ### Create VC App (@vc-shell/create-vc-app)
119
+
120
+ #### Features
121
+ * add new scaffolding templates
122
+ ```
123
+
124
+ This makes it easy to see what changed in which package for a specific version.
125
+
126
+ ### Dry-run Mode
127
+
128
+ The `yarn release:dry` command performs all release steps without creating git commits or tags:
129
+
130
+ **What it does:**
131
+ - ✅ Updates package versions
132
+ - ✅ Generates/updates CHANGELOG.md files
133
+ - ✅ Updates npmTag fields in package.json
134
+ - ✅ Synchronizes internal dependencies
135
+
136
+ **What it skips:**
137
+ - ❌ Git commit
138
+ - ❌ Git tag creation
139
+ - ❌ Push to GitHub
140
+
141
+ After dry-run, you can review changes with `git diff` and revert with `git checkout -- .` if needed.
142
+
143
+ ## Release Types
144
+
145
+ When running `yarn release`, you'll be prompted to select a release type:
146
+
147
+ 1. **Automatic (based on commits)** - Lerna analyzes conventional commits and suggests appropriate version
148
+ 2. **Prerelease (alpha/beta/rc)** - Create prerelease versions (e.g., 1.0.0-alpha.0)
149
+ 3. **Graduate prerelease to stable** - Convert prerelease to stable (e.g., 1.0.0-alpha.0 → 1.0.0)
150
+ 4. **Custom version** - Manually specify any valid semver version
151
+
152
+ ## NPM Distribution Tags
153
+
154
+ The system automatically manages npm distribution tags:
155
+
156
+ - For prerelease versions, the tag is derived from the prerelease identifier (alpha/beta/rc)
157
+ - For stable versions, you can choose between `latest`, `next`, or custom tags
158
+ - Tags are stored in package.json `npmTag` field
159
+ - GitHub Actions workflow uses these tags for publishing
160
+
161
+ ## Professional Changelog Format
162
+
163
+ Our changelogs follow industry best practices with:
164
+
165
+ - 📊 **Clear categorization** by commit type
166
+ - 🔗 **Direct links** to commits and issues
167
+ - 📝 **Detailed descriptions** with scope information
168
+ - ⚠️ **Breaking changes** prominently displayed
169
+ - 🎯 **Version comparison** links
170
+ - 📋 **"Version bump only"** notes for packages without direct changes
171
+
172
+ ### For Packages with Changes
173
+
174
+ ```markdown
175
+ # CHANGELOG
176
+
177
+ All notable changes to this package will be documented in this file.
178
+
179
+ ## [1.2.0-alpha.0](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.91...v1.2.0-alpha.0) (2025-01-15)
180
+
181
+ ### Features
182
+
183
+ * **components:** add new VcTable component with sorting ([a1b2c3d](https://github.com/VirtoCommerce/vc-shell/commit/a1b2c3d))
184
+ * **framework:** implement lazy loading for modules ([b2c3d4e](https://github.com/VirtoCommerce/vc-shell/commit/b2c3d4e))
185
+
186
+ ### Bug Fixes
187
+
188
+ * **router:** fix navigation guards in nested routes ([e4f5g6h](https://github.com/VirtoCommerce/vc-shell/commit/e4f5g6h))
189
+ * **i18n:** resolve translation fallback issue ([f5g6h7i](https://github.com/VirtoCommerce/vc-shell/commit/f5g6h7i))
190
+
191
+ ### Performance Improvements
192
+
193
+ * **components:** optimize VcTable rendering with virtual scrolling ([c3d4e5f](https://github.com/VirtoCommerce/vc-shell/commit/c3d4e5f))
194
+
195
+ ### Documentation
196
+
197
+ * **api:** update API documentation for new methods ([d4e5f6g](https://github.com/VirtoCommerce/vc-shell/commit/d4e5f6g))
198
+
199
+ ### Code Refactoring
200
+
201
+ * **core:** extract common utilities to shared module ([g6h7i8j](https://github.com/VirtoCommerce/vc-shell/commit/g6h7i8j))
202
+
203
+ ### BREAKING CHANGES
204
+
205
+ * API endpoints now require authentication token in headers
206
+ ```
207
+
208
+ ### For Packages without Changes
209
+
210
+ ```markdown
211
+ # CHANGELOG
212
+
213
+ All notable changes to this package will be documented in this file.
214
+
215
+ ## [1.2.0-alpha.0](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.91...v1.2.0-alpha.0) (2025-01-15)
216
+
217
+ **Note:** Version bump only - Updated dependencies to match framework version
218
+ ```
219
+
220
+ ### Supported Sections
221
+
222
+ All commit types are now visible in changelogs:
223
+
224
+ | Type | Section | Description |
225
+ |------|---------|-------------|
226
+ | `feat` | Features | New features |
227
+ | `fix` | Bug Fixes | Bug fixes |
228
+ | `perf` | Performance Improvements | Performance improvements |
229
+ | `revert` | Reverts | Reverted changes |
230
+ | `docs` | Documentation | Documentation updates |
231
+ | `style` | Styles | Code style changes |
232
+ | `refactor` | Code Refactoring | Code refactoring |
233
+ | `test` | Tests | Test updates |
234
+ | `build` | Build System | Build system changes |
235
+ | `ci` | CI/CD | CI/CD changes |
236
+ | `chore` | Chores | Maintenance tasks |
237
+
238
+ ## Benefits
239
+
240
+ - ✅ **Battle-tested** - Used by Babel, Jest, React Router, and other major projects
241
+ - ✅ **Zero manual work** - Automatic dependency management
242
+ - ✅ **Beautiful changelogs** - Grouped by type with commit links
243
+ - ✅ **Proper versioning** - Correct alpha/beta/rc incrementing
244
+ - ✅ **Backward compatible** - Maintains existing workflow
245
+ - ✅ **Type safe** - Full TypeScript support
246
+
247
+ ## Integration with CI/CD
248
+
249
+ The package automatically sets `npmTag` field in package.json files during release:
250
+
251
+ ### How it works
252
+
253
+ 1. **During Release:**
254
+ ```bash
255
+ yarn release
256
+ # Select: Prerelease → alpha
257
+ ```
258
+
259
+ 2. **What happens:**
260
+ - Lerna bumps versions to `1.2.0-alpha.0`
261
+ - `updateNpmTags()` adds `"npmTag": "alpha"` to package.json
262
+ - Git commit includes both version and npmTag changes
263
+
264
+ 3. **In GitHub Actions:**
265
+ - Workflow reads `npmTag` field from package.json
266
+ - Publishes packages with correct dist tag
267
+ - Fallback: detects tag from version string if npmTag is missing
268
+
269
+ ### Tag mapping
270
+
271
+ - `alpha` → npm tag `alpha` (for alpha prereleases)
272
+ - `beta` → npm tag `beta` (for beta prereleases)
273
+ - `rc` → npm tag `rc` (for release candidates)
274
+ - `next` → npm tag `next` (for next versions)
275
+ - No field → npm tag `latest` (for stable releases)
276
+
277
+ ### Example workflow integration
278
+
279
+ ```yaml
280
+ - name: Determine npm tag
281
+ run: |
282
+ # Reads npmTag from package.json (set by release process)
283
+ NPM_TAG=$(node -p "require('./framework/package.json').npmTag || 'latest'")
284
+ echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV
285
+
286
+ - name: Publish
287
+ run: |
288
+ yarn workspaces foreach npm publish --tag $NPM_TAG
289
+ ```
290
+
291
+ **No changes needed** to your existing GitHub Actions - the workflow already supports this!
292
+
293
+ ## Configuration
294
+
295
+ The release behavior is configured in `lerna.json` at the repository root:
296
+
297
+ - `conventionalCommits: true` - Enable conventional changelog generation
298
+ - `exact: true` - Fixed versioning (all packages same version)
299
+ - Lerna v9+ automatically uses workspace configuration
300
+ - `changelogPreset` - Controls which commit types appear in changelog
301
+
302
+ ## Migration from Old System
303
+
304
+ This version maintains backward compatibility with the previous custom release system:
305
+
306
+ - Same API for `release()` function
307
+ - Same npm scripts (`yarn release`, `yarn release:dry`)
308
+ - Same workflow in GitHub Actions
309
+ - Enhanced with Lerna's capabilities under the hood
310
+
63
311
  ## License
64
312
 
65
- MIT
313
+ MIT