Force EOL to be as defined, otherwise default from OS
This commit is contained in:
parent
e76b68729e
commit
6289c351b1
@ -3,6 +3,7 @@ import * as Prettier from "prettier";
|
||||
import * as changeCase from "change-case";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { EOL } from "os";
|
||||
import IConnectionOptions from "./IConnectionOptions";
|
||||
import IGenerationOptions from "./IGenerationOptions";
|
||||
import { Entity } from "./models/Entity";
|
||||
@ -71,7 +72,14 @@ function generateModels(
|
||||
`${casedFileName}.ts`
|
||||
);
|
||||
const rendered = entityCompliedTemplate(element);
|
||||
const withImportStatements = removeUnusedImports(rendered);
|
||||
const withImportStatements = removeUnusedImports(
|
||||
EOL !== generationOptions.convertEol
|
||||
? rendered.replace(
|
||||
/(\r\n|\n|\r)/gm,
|
||||
generationOptions.convertEol
|
||||
)
|
||||
: rendered
|
||||
);
|
||||
const formatted = Prettier.format(withImportStatements, {
|
||||
parser: "typescript"
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user