Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d53e8fec6d | |||
| 00fef1ae06 |
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-02-03 - 3.1.3 - fix(mod_update)
|
||||||
|
try private registry (verdaccio.lossless.digital) first when fetching package versions; fall back to public npm; handle unknown latest versions gracefully in output
|
||||||
|
|
||||||
|
- getLatestVersion now attempts a direct API request to https://verdaccio.lossless.digital/<encoded-package> and parses dist-tags.latest
|
||||||
|
- Falls back to npm view when the private registry request fails
|
||||||
|
- Scoped package names are URL-encoded (replaces '/' with '%2f') before querying the private registry
|
||||||
|
- Packages with no resolvable latest version are included with latestVersion set to 'unknown' and displayed as '? Version unknown'
|
||||||
|
- needsUpdate is set to false when latest version is unknown
|
||||||
|
|
||||||
## 2026-02-03 - 3.1.2 - fix(scripts)
|
## 2026-02-03 - 3.1.2 - fix(scripts)
|
||||||
make test script output verbose by using --verbose instead of --web
|
make test script output verbose by using --verbose instead of --web
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@git.zone/tools",
|
"name": "@git.zone/tools",
|
||||||
"version": "3.1.2",
|
"version": "3.1.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "A CLI tool placeholder for development utilities.",
|
"description": "A CLI tool placeholder for development utilities.",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tools',
|
name: '@git.zone/tools',
|
||||||
version: '3.1.2',
|
version: '3.1.3',
|
||||||
description: 'A CLI tool placeholder for development utilities.'
|
description: 'A CLI tool placeholder for development utilities.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,8 +128,28 @@ export class PackageManagerUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the latest version of a package from npm registry
|
* Get the latest version of a package from npm registry
|
||||||
|
* Tries private registry (verdaccio.lossless.digital) first via API, then falls back to public npm
|
||||||
*/
|
*/
|
||||||
public async getLatestVersion(packageName: string): Promise<string | null> {
|
public async getLatestVersion(packageName: string): Promise<string | null> {
|
||||||
|
// URL-encode the package name for scoped packages (@scope/name -> @scope%2fname)
|
||||||
|
const encodedName = packageName.replace('/', '%2f');
|
||||||
|
|
||||||
|
// Try private registry first via direct API call (npm view doesn't work reliably)
|
||||||
|
try {
|
||||||
|
const result = await this.shell.execSilent(
|
||||||
|
`curl -sf "https://verdaccio.lossless.digital/${encodedName}" 2>/dev/null`
|
||||||
|
);
|
||||||
|
if (result.exitCode === 0 && result.stdout.trim()) {
|
||||||
|
const data = JSON.parse(result.stdout.trim());
|
||||||
|
if (data['dist-tags']?.latest) {
|
||||||
|
return data['dist-tags'].latest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Continue to public registry
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to public npm
|
||||||
try {
|
try {
|
||||||
const result = await this.shell.execSilent(`npm view ${packageName} version 2>/dev/null`);
|
const result = await this.shell.execSilent(`npm view ${packageName} version 2>/dev/null`);
|
||||||
if (result.exitCode === 0 && result.stdout.trim()) {
|
if (result.exitCode === 0 && result.stdout.trim()) {
|
||||||
|
|||||||
@@ -46,15 +46,13 @@ export const run = async (options: IUpdateOptions = {}): Promise<void> => {
|
|||||||
// Only include packages from our predefined list
|
// Only include packages from our predefined list
|
||||||
if (GITZONE_PACKAGES.includes(pkg.name)) {
|
if (GITZONE_PACKAGES.includes(pkg.name)) {
|
||||||
const latestVersion = await pmUtil.getLatestVersion(pkg.name);
|
const latestVersion = await pmUtil.getLatestVersion(pkg.name);
|
||||||
if (latestVersion) {
|
allPackages.push({
|
||||||
allPackages.push({
|
name: pkg.name,
|
||||||
name: pkg.name,
|
currentVersion: pkg.version,
|
||||||
currentVersion: pkg.version,
|
latestVersion: latestVersion || 'unknown',
|
||||||
latestVersion,
|
packageManager: pm,
|
||||||
packageManager: pm,
|
needsUpdate: latestVersion ? pmUtil.isNewerVersion(pkg.version, latestVersion) : false,
|
||||||
needsUpdate: pmUtil.isNewerVersion(pkg.version, latestVersion),
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +72,11 @@ export const run = async (options: IUpdateOptions = {}): Promise<void> => {
|
|||||||
const current = pkg.currentVersion.padEnd(12);
|
const current = pkg.currentVersion.padEnd(12);
|
||||||
const latest = pkg.latestVersion.padEnd(12);
|
const latest = pkg.latestVersion.padEnd(12);
|
||||||
const pm = pkg.packageManager.padEnd(8);
|
const pm = pkg.packageManager.padEnd(8);
|
||||||
const status = pkg.needsUpdate ? '⬆️ Update available' : '✓ Up to date';
|
const status = pkg.latestVersion === 'unknown'
|
||||||
|
? '? Version unknown'
|
||||||
|
: pkg.needsUpdate
|
||||||
|
? '⬆️ Update available'
|
||||||
|
: '✓ Up to date';
|
||||||
console.log(` ${name}${current}${latest}${pm}${status}`);
|
console.log(` ${name}${current}${latest}${pm}${status}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user