From 55462ff0bcde2b1b859b4087059875f311d3ea47 Mon Sep 17 00:00:00 2001 From: Aayush Kapoor Date: Wed, 26 May 2021 06:21:28 +0530 Subject: [PATCH] Convert line endings to LF --- src/migration-file.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/migration-file.ts b/src/migration-file.ts index a766b57..a69a671 100644 --- a/src/migration-file.ts +++ b/src/migration-file.ts @@ -14,6 +14,8 @@ const getFileContents = async (filePath: string) => readFile(filePath, "utf8") const hashString = (s: string) => crypto.createHash("sha1").update(s, "utf8").digest("hex") +const convertEndings = (content: string) => content.replace(/\r\n|\r/g, "\n") + const getSqlStringLiteral = ( filePath: string, contents: string, @@ -21,9 +23,9 @@ const getSqlStringLiteral = ( ) => { switch (type) { case "sql": - return contents + return convertEndings(contents) case "js": - return loadSqlFromJs(filePath) + return convertEndings(loadSqlFromJs(filePath)) default: { const exhaustiveCheck: never = type return exhaustiveCheck