pnpm-catalog-updates 1.1.5 → 1.1.6

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": "pnpm-catalog-updates",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "CLI application for pnpm-catalog-updates",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/cli/index.ts CHANGED
@@ -118,35 +118,54 @@ async function handleVersionFlag(
118
118
  ): Promise<void> {
119
119
  if (!args.includes('--version')) return
120
120
 
121
- cliOutput.print(getPackageJson().version)
121
+ const pkg = getPackageJson()
122
+ const version = pkg.version
122
123
 
123
124
  // Check for updates if not in CI and enabled in config
124
125
  if (VersionChecker.shouldCheckForUpdates() && config.advanced?.checkForUpdates !== false) {
125
126
  try {
126
- cliOutput.print(chalk.gray(t('cli.checkingUpdates')))
127
- const versionResult = await VersionChecker.checkVersion(getPackageJson().version, {
127
+ // Show version with checking status on same line
128
+ process.stdout.write(
129
+ `${chalk.cyan('pcu')} ${chalk.bold(`v${version}`)} ${chalk.gray(t('cli.checkingUpdates'))}`
130
+ )
131
+
132
+ const versionResult = await VersionChecker.checkVersion(version, {
128
133
  skipPrompt: false,
129
- timeout: 5000, // Longer timeout for explicit version check
134
+ timeout: 5000,
130
135
  })
131
136
 
132
- if (versionResult.shouldPrompt) {
137
+ // Clear the checking message and show final result
138
+ process.stdout.write('\r\x1b[K') // Clear current line
139
+
140
+ if (versionResult.shouldPrompt && versionResult.latestVersion) {
141
+ cliOutput.print(
142
+ `${chalk.cyan('pcu')} ${chalk.bold(`v${version}`)} ${chalk.yellow(`-> v${versionResult.latestVersion} ${t('cli.available')}`)}`
143
+ )
133
144
  const didUpdate = await VersionChecker.promptAndUpdate(versionResult)
134
145
  if (didUpdate) {
135
146
  cliOutput.print(chalk.blue(t('cli.runAgain')))
136
147
  exitWithCleanup(0)
137
148
  }
138
- } else if (versionResult.isLatest) {
139
- cliOutput.print(chalk.green(t('cli.latestVersion')))
149
+ } else {
150
+ cliOutput.print(
151
+ `${chalk.cyan('pcu')} ${chalk.bold(`v${version}`)} ${chalk.green(t('cli.latestVersion'))}`
152
+ )
140
153
  }
141
154
  } catch (error) {
142
- // Silently fail update check for version command
155
+ // Clear line and show version without update status
156
+ process.stdout.write('\r\x1b[K')
157
+ cliOutput.print(`${chalk.cyan('pcu')} ${chalk.bold(`v${version}`)}`)
158
+
143
159
  logger.debug('Version flag update check failed', {
144
160
  error: error instanceof Error ? error.message : error,
145
161
  })
146
162
  if (args.includes('-v') || args.includes('--verbose')) {
147
- cliOutput.warn(chalk.yellow(`⚠️ ${t('cli.couldNotCheckUpdates')}`), error)
163
+ cliOutput.warn(chalk.yellow(` ${t('cli.couldNotCheckUpdates')}`), error)
148
164
  }
149
165
  }
166
+ } else {
167
+ // No update check, just show version
168
+ cliOutput.print(`${chalk.cyan('pcu')} ${chalk.bold(`v${version}`)}`)
150
169
  }
151
170
 
152
171
  exitWithCleanup(0)