dotansimha / dotansimha/graphql-code-generator
CLI's `--check` option should not fail due to differences in line endings
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
### Which packages are impacted by your issue?
@graphql-codegen/cli
### Describe the bug
This is the behavior I see in my Windows 11 machine. Not sure if the same applies to other OS.
`graphql-codegen` generates files with LF line endings. If something changes that file from LF to CRLF (e.g. git commit and checkout), then `graphql-codegen --check` will fail, saying the file is stale.
The file content is exactly the same (if we only look at the generated code), so I believe this library should be line ending agnostic and compare the actual code.
I'm not providing a repro as from what I know we can't change line endings in online code editors...
### Your Example Website or App
some proprietary app
### Steps to Reproduce the Bug or Issue
1. Run `graphql-codegen` on any project
2. Change the line ending on a generated file from LF to CRLF
3. Run `graphql-codegen --check`
### Expected behavior
I expect that `graphql-codegen --check` would not fail just because the file has different line endings.
### Screenshots or Videos
_No response_
### Platform
- OS: Windows
- NodeJS: 22.12.0
- `graphql` version: 16.10.0
- `@graphql-codegen/*` version(s): 5.0.5
### Codegen Config File
codegen.ts
```
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: './src/gql/**/typeDefs.ts',
generates: {
'./src/types/__generated__/types.ts': {
plugins: ['typescript', 'typescript-resolvers'],
},
},
};
export default config;
```
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.