Compare commits

...

2 Commits

Author SHA1 Message Date
001721a8e9 v2.11.1
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-12-15 17:30:51 +00:00
b191464ff9 fix(mod_format/formatters): fix(packagejson.formatter): correctly parse scoped package dependency arguments and default to latest 2025-12-15 17:30:51 +00:00
4 changed files with 21 additions and 5 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2025-12-15 - 2.11.1 - fix(mod_format/formatters)
fix(packagejson.formatter): correctly parse scoped package dependency arguments and default to latest
- Handle scoped packages (e.g. @scope/name@version) by detecting the last '@' after the scope slash so package name and version are split correctly.
- Fallback to 'latest' when no version is provided.
- Fixes earlier incorrect splitting on every '@' which broke scoped package names.
## 2025-12-15 - 2.11.0 - feat(mod_format)
feat(mod_format): use unified diff formatter with filenames and context in BaseFormatter.displayDiff

View File

@@ -1,7 +1,7 @@
{
"name": "@git.zone/cli",
"private": false,
"version": "2.11.0",
"version": "2.11.1",
"description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
"main": "dist_ts/index.ts",
"typings": "dist_ts/index.d.ts",

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/cli',
version: '2.11.0',
version: '2.11.1',
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
}

View File

@@ -13,9 +13,18 @@ const ensureDependency = async (
constraint: 'exclude' | 'include' | 'latest',
dependencyArg: string,
): Promise<void> => {
const [packageName, version] = dependencyArg.includes('@')
? dependencyArg.split('@').filter(Boolean)
: [dependencyArg, 'latest'];
// Parse package name and version, handling scoped packages like @scope/name@version
const isScoped = dependencyArg.startsWith('@');
const lastAtIndex = dependencyArg.lastIndexOf('@');
// For scoped packages, the version @ must come after the /
// For unscoped packages, any @ indicates a version
const hasVersion = isScoped
? lastAtIndex > dependencyArg.indexOf('/')
: lastAtIndex >= 0;
const packageName = hasVersion ? dependencyArg.slice(0, lastAtIndex) : dependencyArg;
const version = hasVersion ? dependencyArg.slice(lastAtIndex + 1) : 'latest';
const targetSections: string[] = [];