Skip to content

Commit 4a5fa8a

Browse files
committed
docs(changeset): Fix: handle POSIX
1 parent a0a4315 commit 4a5fa8a

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

.changeset/many-banks-dream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"git-json-resolver": patch
3+
---
4+
5+
Fix: handle POSIX

lib/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
}
2424
},
2525
"bin": {
26-
"git-json-resolver": "./dist/cli.mjs"
26+
"git-json-resolver": "./dist/cli.mjs",
27+
"json-merge-resolver": "./dist/cli.mjs",
28+
"json-conflict-resolver": "./dist/cli.mjs",
29+
"git-conflict-resolver": "./dist/cli.mjs"
2730
},
2831
"scripts": {
2932
"build": "tsup && tsc -p tsconfig-build.json && gzip -c dist/index.js | wc -c",

lib/src/normalizer.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,17 @@ describe("normalizeConfig", () => {
127127
expect(result.fileFilter("other/file.ts")).toBe(false);
128128
});
129129

130+
it("fileFilter includes allowed files and excludes others", async () => {
131+
const result = await normalizeConfig({
132+
include: ["**/package.json"],
133+
exclude: ["package.json", "**/dist/**"],
134+
});
135+
expect(result.fileFilter("pkgs/src/package.json")).toBe(true);
136+
expect(result.fileFilter("pkgs\\src\\package.json")).toBe(true);
137+
expect(result.fileFilter("package.json")).toBe(false);
138+
expect(result.fileFilter("other/file.ts")).toBe(false);
139+
});
140+
130141
it("fileFilter includes allowed files and excludes others", async () => {
131142
const result = await normalizeConfig({
132143
include: ["src/**/*.json"],

lib/src/normalizer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* and classifies rules into exact / top-level / glob categories.
55
*/
66

7+
import path from "node:path";
78
import { createLogger } from "./logger";
89
import { Matcher, basicMatcher, loadMatcher } from "./matcher";
910
import { InbuiltMergeStrategies, Config, RuleTree } from "./types";
@@ -98,11 +99,9 @@ export const normalizeConfig = async <T extends string = InbuiltMergeStrategies>
9899
}
99100

100101
const fileFilter = (filepath: string) => {
101-
if (config.debug) {
102-
globalLogger.info("all", `[normalizer] Filtering ${filepath}`);
103-
}
104-
if (!resolvedMatcher.isMatch(filepath, userConfig.include)) return false;
105-
if (resolvedMatcher.isMatch(filepath, [...userConfig.exclude, "**/node_modules/**"]))
102+
const posixPath = filepath.replace(/\\/g, "/");
103+
if (!resolvedMatcher.isMatch(posixPath, userConfig.include)) return false;
104+
if (resolvedMatcher.isMatch(posixPath, [...userConfig.exclude, "**/node_modules/**"]))
106105
return false;
107106
return true;
108107
};

scripts/publish-canonical.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { execSync } = require("child_process");
22

33
// Publish canonical packages
4-
["json-merge-resolver", "json-conflict-resolver"].forEach(pkg => {
4+
["json-merge-resolver", "json-conflict-resolver", "git-conflict-resolver"].forEach(pkg => {
55
execSync(`sed -i -e "s/name.*/name\\": \\"${pkg.replace(/\//g, "\\\\/")}\\",/" lib/package.json`);
66
execSync("cd lib && npm publish --provenance --access public");
77
});

0 commit comments

Comments
 (0)