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

Add readJson fallback #51

Merged
merged 8 commits into from Jul 29, 2020
Merged

Add readJson fallback #51

merged 8 commits into from Jul 29, 2020

Conversation

JakeSidSmith
Copy link
Contributor

I hope this is acceptable. Re-enabled strict null checks to ensure optional readJson types would not break anything, but this meant updating a few existing bits of code.

Fixes #50

  • Re-enable strict null checks (and fix issues)
  • Use typeof fs for base file system types
  • Fallback to readFile and JSON.parse if readJson is unavailable
  • Programatic example with custom file system to test readJson fallback

@jonaskello
Copy link
Member

@JakeSidSmith Nice work! Looks good to me, are you ready to merge this?

@JakeSidSmith
Copy link
Contributor Author

@jonaskello yes, I think it's in a good state. 🙂

Is it okay that my test has made it into the "example"?

I noticed there was a "compile:tests": "tsc -p tests", script, but there is no longer a tests directory?

@jonaskello
Copy link
Member

Hmm, yes that's a bit strange :-). I guess that script can be cleaned up and re-added if someone gets the time to introduce unit tests. For now I think the example you made is a good way to test it.

@jonaskello jonaskello merged commit 27728f7 into dividab:master Jul 29, 2020
@jonaskello
Copy link
Member

Released in 3.3.0.

@JakeSidSmith It would be helpful if you can verify that the new version works as expected both with normal and custom fs :-)

@JakeSidSmith
Copy link
Contributor Author

JakeSidSmith commented Jul 29, 2020

My project is currently in a half broken state, so I can't really do a thorough test at the moment, but I can confirm that where previously I was receiving the error below when using fs, memfs and unionfs with version 3.2.0 of tsconfig-paths-webpack-plugin, I am no longer receiving it with version 3.3.0.

I will report back when I have further tested this. 🙂

TypeError: filesystem.readJson is not a function

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.

TypeError: filesystem.readJson is not a function
2 participants