Skip to content

Commit 93a6475

Browse files
committed
invert logic to make normalization default
1 parent 2aa3509 commit 93a6475

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 0.8.0
44

5-
* Update add `--normalize-directory-names` flag to `diff` command [#235](https://github.com/SalesforceCommerceCloud/raml-toolkit/pull/235/)
5+
* Add `--disable-normalize-directory-names` flag to `diff` command. By default directory names will be normalized by major version, e.g: `shopper-stores-oas-1.0.16` --> `shopper-stores-oas-1` [#235](https://github.com/SalesforceCommerceCloud/raml-toolkit/pull/235/)
66

77
## 0.7.0
88

src/diff/diffCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ Exit statuses:
7070
"Specifies the API spec of the files being compared. Defaults to RAML. Options are RAML or OAS",
7171
options: ["raml", "oas"],
7272
}),
73-
"normalize-directory-names": flags.boolean({
73+
"disable-normalize-directory-names": flags.boolean({
7474
description:
75-
"Normalize directory names by removing minor and patch versions. Example: 'shopper-stores-oas-1.0.16' -> 'shopper-stores-oas-1",
75+
"Disable normalization of directory names. When enabled, directory names will keep their full version numbers (e.g., 'shopper-stores-oas-1.0.16' instead of 'shopper-stores-oas-1')",
7676
default: false,
7777
}),
7878
};

src/diff/oasDiff.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ describe("oasDiffChangelog", () => {
679679
expect(result).to.equal(1); // Changes should be reported
680680
});
681681

682-
it("should normalize directory names when normalize-directory-names flag is passed", async () => {
682+
it("should normalize directory names when disable-normalize-directory-names flag is false", async () => {
683683
const consoleStub = sinon.stub(console, "log");
684684
const execStub = createMockExec();
685685
execStub.onSecondCall().callsArgWith(1, null, "changes in api-1", "");
@@ -702,7 +702,7 @@ describe("oasDiffChangelog", () => {
702702
const flags = {
703703
"out-file": "output.txt",
704704
dir: true,
705-
"normalize-directory-names": true,
705+
"disable-normalize-directory-names": false,
706706
};
707707

708708
await oasDiff.oasDiffChangelog(baseApi, newApi, flags);

src/diff/oasDiff.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface OasDiffFlags {
1717
format?: "json" | "console";
1818
dir?: boolean;
1919
"out-file"?: string;
20-
"normalize-directory-names"?: boolean;
20+
"disable-normalize-directory-names"?: boolean;
2121
}
2222

2323
/**
@@ -288,7 +288,7 @@ async function handleDirectoryMode(
288288
let baseExchangeDirs = await findExchangeDirectories(baseApi);
289289
let newExchangeDirs = await findExchangeDirectories(newApi);
290290

291-
if (flags["normalize-directory-names"]) {
291+
if (!flags["disable-normalize-directory-names"]) {
292292
baseExchangeDirs = normalizeDirectoryNames(baseExchangeDirs);
293293
newExchangeDirs = normalizeDirectoryNames(newExchangeDirs);
294294
}

0 commit comments

Comments
 (0)