Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix: keep the OpenAPI check stable across CRLF checkouts

Andrej Acevski136b7010b94d
diff --git a/.gitattributes b/.gitattributes
index 56cde56c7..d76b233f9 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,3 +1,4 @@
# Husky hooks must use LF, otherwise a CRLF checkout makes the shell pass a
# trailing carriage return to commitlint and every commit fails on Unix.
.husky/* text eol=lf
+apps/docs/openapi.json text eol=lf
diff --git a/scripts/openapi/check.mjs b/scripts/openapi/check.mjs
index bdc8d6630..fb0541bda 100644
--- a/scripts/openapi/check.mjs
+++ b/scripts/openapi/check.mjs
@@ -40,10 +40,9 @@ function run() {
try {
generate(generated);
- const committed = existsSync(COMMITTED)
- ? readFileSync(COMMITTED, "utf8")
- : null;
- if (committed === readFileSync(generated, "utf8")) {
+ const read = (path) => readFileSync(path, "utf8").replace(/\r\n/g, "\n");
+ const committed = existsSync(COMMITTED) ? read(COMMITTED) : null;
+ if (committed === read(generated)) {
console.log("apps/docs/openapi.json is up to date");
return 0;
}