fg-devkit 1.25.1 → 1.26.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fg-devkit",
3
- "version": "1.25.1",
3
+ "version": "1.26.0",
4
4
  "description": "Shared configs, scripts, and DX tooling for Vue / TypeScript frontend repos",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -32,7 +32,7 @@
32
32
  "@intlify/unplugin-vue-i18n": "11.2.7",
33
33
  "@tanstack/vue-query-devtools": "6.3.5",
34
34
  "@types/node": "22.16.5",
35
- "fg-devkit": "1.25.1",
35
+ "fg-devkit": "1.26.0",
36
36
  "@vitejs/plugin-vue": "6.0.10",
37
37
  "tailwindcss": "4.3.3",
38
38
  "tsx": "4.23.15",
@@ -81,6 +81,42 @@ function runNode(scriptRelative, args = [], options = {}) {
81
81
  return r.status ?? 1
82
82
  }
83
83
 
84
+ function readNextReleaseVersions(releaseKind) {
85
+ let currentVersion
86
+ try {
87
+ currentVersion = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8')).version
88
+ } catch {
89
+ return null
90
+ }
91
+ const match = typeof currentVersion === 'string' && currentVersion.match(/^(\d+)\.(\d+)\.(\d+)(-.+)?$/)
92
+ if (!match) return null
93
+
94
+ const bumpTypes = ['patch', 'minor', 'major']
95
+ if (releaseKind === 'candidate') {
96
+ const nextVersions = {}
97
+ for (const bumpType of bumpTypes) {
98
+ const result = spawnSync(process.execPath, [path.join(scriptDir, 'resolve-candidate-version.mjs'), bumpType], {
99
+ cwd: process.cwd(),
100
+ encoding: 'utf8',
101
+ })
102
+ if (result.status !== 0) return null
103
+ nextVersions[bumpType] = result.stdout.trim()
104
+ }
105
+ return { currentVersion, nextVersions }
106
+ }
107
+
108
+ const [major, minor, patch] = match.slice(1, 4).map(Number)
109
+ const isPrerelease = Boolean(match[4])
110
+ return {
111
+ currentVersion,
112
+ nextVersions: {
113
+ patch: isPrerelease ? `${major}.${minor}.${patch}` : `${major}.${minor}.${patch + 1}`,
114
+ minor: isPrerelease && patch === 0 ? `${major}.${minor}.0` : `${major}.${minor + 1}.0`,
115
+ major: isPrerelease && minor === 0 && patch === 0 ? `${major}.0.0` : `${major + 1}.0.0`,
116
+ },
117
+ }
118
+ }
119
+
84
120
  /**
85
121
  * Menu label with dimmed tags: `Upgrade packages [interactive, auto-commit]`.
86
122
  * interactive: the action stops and asks for input while it runs. autoCommit: it commits on its own.
@@ -737,12 +773,15 @@ async function runInteractiveMenu() {
737
773
  })
738
774
  if (releaseMode === 'cancel') continue
739
775
 
776
+ const releaseVersions = readNextReleaseVersions(releaseKind)
777
+ const versionChange = (bumpType) =>
778
+ releaseVersions ? `: ${releaseVersions.currentVersion} → ${releaseVersions.nextVersions[bumpType]}` : ''
740
779
  const bumpChoice = await selectPrompt({
741
780
  message: releaseKind === 'candidate' ? 'Release candidate' : 'Release',
742
781
  choices: [
743
- { name: 'Patch', value: 'patch', description: 'Bug fixes only: 1.2.3 → 1.2.4' },
744
- { name: 'Minor', value: 'minor', description: 'New features, backwards compatible: 1.2.3 → 1.3.0' },
745
- { name: 'Major', value: 'major', description: 'Breaking changes: 1.2.3 → 2.0.0' },
782
+ { name: 'Patch', value: 'patch', description: `Bug fixes only${versionChange('patch')}` },
783
+ { name: 'Minor', value: 'minor', description: `New features, backwards compatible${versionChange('minor')}` },
784
+ { name: 'Major', value: 'major', description: `Breaking changes${versionChange('major')}` },
746
785
  { name: 'Cancel', value: 'cancel' },
747
786
  ],
748
787
  default: 'patch',