jondot / hygen

The simple, fast, and scalable code generator that lives in your project.
http://www.hygen.io
MIT License
5.66k stars 255 forks source link

Inject changing line endings from CRLF to LF in vscode #302

Open matt-clegg opened 3 years ago

matt-clegg commented 3 years ago

I have two inject files in my generator, one to import and one to add to an export to a single file.

inject-import.ejs.t

---
inject: true
to: src/components/index.js
before: export {
skip_if: components/<%= name %>
append: true
---
import <%= name %> from "./<%= name %>";

inject-export.ejs.t

---
inject: true
to: src/components/index.js
after: export {
skip_if: components/<%= name %>
append: true
---
  <%= name %>,

Which creates a modifies this file:

import Foo from "./Foo";    <-- Inject's the import here
import Input from "./Input";
import Modal from "./modal";
import Table from "./admin/table";
import Button from "./admin/button";
import Grid from "./admin/nested/grid";

export {
  Foo,    <-- Inject's the export here
  Input,
  Modal,
  Table,
  Button,
  Grid,
};

The issue is when I run my hygen component new Foo command to create a new Foo component and inject the imports into the file above, the injection changes the line endings from CRLF to LF.

Is there anyway to stop this?

I'm on Windows 10 using vscode v1.55.2 and Hygen v6.0.4.

jondot commented 2 years ago

Will check and align CRLF for v6.2