Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: simplify code that writes output files and add EOL at EOF #15

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

marcusrbrown
Copy link
Contributor

I consolidated the code that writes output files into a function that:

  1. Converts the output data to a string using JSON.stringify
  2. Ensures the directory path of the output file exists
  3. Adds EOL to the end of the output data, to ensure all files are terminated with whitespace

The addition of EOL is to be consistent and avoid issues with downstream tools that have issues without EOL. There is likely an off-the-shelf package that can do detection, but os.EOL should cover Windows and everything else using \n.

@marcusrbrown
Copy link
Contributor Author

I noticed a few issues with this change so I'll convert to draft for now:

  • Extra newline from "Amalgamate" step don't add EOL at EOF if it's already there
  • Similar pattern is used in resolve.ts move the utility code to a separate file

@marcusrbrown marcusrbrown marked this pull request as draft January 28, 2022 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant