Skip to content

Commit f914207

Browse files
committed
docs(changeset): Add logs
1 parent 8b81165 commit f914207

File tree

7 files changed

+35
-28
lines changed

7 files changed

+35
-28
lines changed

lib/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# git-json-resolver-semver
22

3+
## 0.0.2
4+
5+
### Patch Changes
6+
7+
- 6d78136: Add logs
8+
39
## 0.0.1
410

511
### Patch Changes

lib/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "git-json-resolver-semver",
33
"author": "Mayank Kumar Chaudhari (https://mayank-chaudhari.vercel.app)",
44
"private": false,
5-
"version": "0.0.1",
5+
"version": "0.0.2",
66
"description": "Plugin for git-json-resolver that applies semver-based merge strategies (max, min, secure, override) to resolve version conflicts in package.json and similar files.",
77
"license": "MPL-2.0",
88
"main": "./dist/index.js",
@@ -38,7 +38,7 @@
3838
"@vitest/coverage-v8": "^3.2.4",
3939
"compare-versions": "^6.1.1",
4040
"esbuild-plugin-rdi": "^0.0.0",
41-
"git-json-resolver": "^1.3.3",
41+
"git-json-resolver": "^1.3.5",
4242
"tsup": "^8.5.0",
4343
"typescript": "^5.9.2",
4444
"vite-tsconfig-paths": "^5.1.4",

lib/src/index.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ const isValidSemver = (val: unknown): val is string => {
7575
/**
7676
* Pick the higher semver version.
7777
*/
78-
export const semverMax: StrategyFn = ({ ours, theirs }) => {
78+
export const semverMax: StrategyFn = ({ ours, theirs, logger, filePath, ...others }) => {
79+
logger.debug(
80+
filePath ?? "semverMax",
81+
JSON.stringify({ ours, theirs, filePath, ...others }, null, 2),
82+
);
7983
if (isValidSemver(ours) && isValidSemver(theirs)) {
8084
const winner = compareVersions(ours, theirs) >= 0 ? ours : theirs;
8185
return { status: StrategyStatus_OK, value: winner };
8286
}
83-
if (pluginConfig.preferValid) {
84-
if (isValidSemver(ours)) return { status: StrategyStatus_OK, value: ours };
85-
if (isValidSemver(theirs)) return { status: StrategyStatus_OK, value: theirs };
86-
}
8787
return handleFallback({ ours, theirs });
8888
};
8989

@@ -95,10 +95,6 @@ export const semverMin: StrategyFn = ({ ours, theirs }) => {
9595
const winner = compareVersions(ours, theirs) <= 0 ? ours : theirs;
9696
return { status: StrategyStatus_OK, value: winner };
9797
}
98-
if (pluginConfig.preferValid) {
99-
if (isValidSemver(ours)) return { status: StrategyStatus_OK, value: ours };
100-
if (isValidSemver(theirs)) return { status: StrategyStatus_OK, value: theirs };
101-
}
10298
return handleFallback({ ours, theirs });
10399
};
104100

@@ -107,9 +103,6 @@ export const semverMin: StrategyFn = ({ ours, theirs }) => {
107103
*/
108104
export const semverOurs: StrategyFn = ({ ours, theirs }) => {
109105
if (isValidSemver(ours)) return { status: StrategyStatus_OK, value: ours };
110-
if (pluginConfig.preferValid && isValidSemver(theirs)) {
111-
return { status: StrategyStatus_OK, value: theirs };
112-
}
113106
return handleFallback({ ours, theirs });
114107
};
115108

@@ -118,9 +111,6 @@ export const semverOurs: StrategyFn = ({ ours, theirs }) => {
118111
*/
119112
export const semverTheirs: StrategyFn = ({ ours, theirs }) => {
120113
if (isValidSemver(theirs)) return { status: StrategyStatus_OK, value: theirs };
121-
if (pluginConfig.preferValid && isValidSemver(ours)) {
122-
return { status: StrategyStatus_OK, value: ours };
123-
}
124114
return handleFallback({ ours, theirs });
125115
};
126116

@@ -134,6 +124,10 @@ const handleFallback = ({
134124
ours: unknown;
135125
theirs: unknown;
136126
}): ReturnType<StrategyFn> => {
127+
if (pluginConfig.preferValid) {
128+
if (isValidSemver(ours)) return { status: StrategyStatus_OK, value: ours };
129+
if (isValidSemver(theirs)) return { status: StrategyStatus_OK, value: theirs };
130+
}
137131
switch (pluginConfig.fallback) {
138132
case "ours":
139133
return { status: StrategyStatus_OK, value: ours };

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@
4242
"next@>=15.0.0 <15.2.3": ">=15.2.3"
4343
}
4444
}
45-
}
45+
}

packages/shared/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @repo/shared
22

3+
## 0.0.2
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [6d78136]
8+
9+
310
## 0.0.1
411

512
### Patch Changes

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@repo/shared",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"private": true,
55
"sideEffects": false,
66
"main": "./dist/index.js",

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)