Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 001721a8e9 | |||
| b191464ff9 | |||
| 4d7eaa238f | |||
| 601e0d1063 |
14
changelog.md
14
changelog.md
@@ -1,5 +1,19 @@
|
|||||||
# Changelog
|
# 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
|
||||||
|
|
||||||
|
- Replaced plugins.smartdiff.formatLineDiffForConsole(...) with plugins.smartdiff.formatUnifiedDiffForConsole(...) when both before and after are present.
|
||||||
|
- Passes originalFileName and revisedFileName as diff.path and sets context to 3 to show a unified diff with surrounding lines.
|
||||||
|
- Improves console output for multi-line diffs by using unified diff format and including file names.
|
||||||
|
|
||||||
## 2025-12-15 - 2.10.0 - feat(mod_format)
|
## 2025-12-15 - 2.10.0 - feat(mod_format)
|
||||||
Refactor formatting modules to new BaseFormatter and implement concrete analyze/apply logic
|
Refactor formatting modules to new BaseFormatter and implement concrete analyze/apply logic
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@git.zone/cli",
|
"name": "@git.zone/cli",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "2.10.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.",
|
"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",
|
"main": "dist_ts/index.ts",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/cli',
|
name: '@git.zone/cli',
|
||||||
version: '2.10.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.'
|
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.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,11 @@ export abstract class BaseFormatter {
|
|||||||
displayDiff(diff: ICheckResult['diffs'][0]): void {
|
displayDiff(diff: ICheckResult['diffs'][0]): void {
|
||||||
console.log(`\n--- ${diff.path}`);
|
console.log(`\n--- ${diff.path}`);
|
||||||
if (diff.before && diff.after) {
|
if (diff.before && diff.after) {
|
||||||
console.log(plugins.smartdiff.formatLineDiffForConsole(diff.before, diff.after));
|
console.log(plugins.smartdiff.formatUnifiedDiffForConsole(diff.before, diff.after, {
|
||||||
|
originalFileName: diff.path,
|
||||||
|
revisedFileName: diff.path,
|
||||||
|
context: 3,
|
||||||
|
}));
|
||||||
} else if (diff.after && !diff.before) {
|
} else if (diff.after && !diff.before) {
|
||||||
console.log(' (new file)');
|
console.log(' (new file)');
|
||||||
// Show first few lines of new content
|
// Show first few lines of new content
|
||||||
|
|||||||
@@ -13,9 +13,18 @@ const ensureDependency = async (
|
|||||||
constraint: 'exclude' | 'include' | 'latest',
|
constraint: 'exclude' | 'include' | 'latest',
|
||||||
dependencyArg: string,
|
dependencyArg: string,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
const [packageName, version] = dependencyArg.includes('@')
|
// Parse package name and version, handling scoped packages like @scope/name@version
|
||||||
? dependencyArg.split('@').filter(Boolean)
|
const isScoped = dependencyArg.startsWith('@');
|
||||||
: [dependencyArg, 'latest'];
|
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[] = [];
|
const targetSections: string[] = [];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user