pnpm-catalog-updates 1.1.4 → 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/dist/index.js +509 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commandRegistrar.ts +3 -3
- package/src/cli/index.ts +28 -9
package/package.json
CHANGED
|
@@ -720,15 +720,15 @@ ${t('cli.help.tipLabel')} ${t('cli.help.tipContent', { locale: I18n.getLocale()
|
|
|
720
720
|
)
|
|
721
721
|
)
|
|
722
722
|
|
|
723
|
-
//
|
|
723
|
+
// Upgrade command (self-update)
|
|
724
724
|
program
|
|
725
|
-
.command('
|
|
725
|
+
.command('upgrade')
|
|
726
726
|
.description(t('cli.description.selfUpdate'))
|
|
727
727
|
.action(
|
|
728
728
|
createCommandAction(
|
|
729
729
|
serviceFactory,
|
|
730
730
|
{
|
|
731
|
-
name: '
|
|
731
|
+
name: 'upgrade',
|
|
732
732
|
needsServices: false,
|
|
733
733
|
},
|
|
734
734
|
async ({ globalOptions }) => {
|
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
|
-
|
|
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
|
-
|
|
127
|
-
|
|
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,
|
|
134
|
+
timeout: 5000,
|
|
130
135
|
})
|
|
131
136
|
|
|
132
|
-
|
|
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
|
|
139
|
-
cliOutput.print(
|
|
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
|
-
//
|
|
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(
|
|
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)
|