Skip to content

Do not fail if template file does not exist #179

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

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

armsnyder
Copy link
Contributor

This allows overriding specific template files and fallback on the defaults.

Before this change, the behavior was for the tool to fail with Error: ENOENT: no such file or directory if one of the template files in a custom templates directory does not exist.

Caveat: With this fix it will still error if the overridden template uses includeFile on a template file that is not overridden:

Error [Eta Error]: Could not find the template "./route-docs". Paths tried: /redacted/route-docs.eta

Example output:

✨ try to read templates from directory "/redacted"
❗❗❗ data contracts template not found in ./data-contracts.eta
Code generator will use the default template
❗❗❗ http client template not found in ./http-client.eta
Code generator will use the default template
❗❗❗ route types template not found in ./route-types.eta
Code generator will use the default template
❗❗❗ route name template not found in ./route-name.eta
Code generator will use the default template
☄️  start generating your typescript api

Related: #166

This allows overriding specific template files and fallback on the defaults.
@js2me js2me changed the base branch from master to next February 22, 2021 11:00
@js2me
Copy link
Member

js2me commented Feb 24, 2021

Hello @armsnyder !
Thank you for your contribution!

@js2me js2me merged commit 6963a35 into acacode:next Feb 24, 2021
js2me added a commit that referenced this pull request Feb 24, 2021
* Do not fail if template file does not exist (#179)

This allows overriding specific template files and fallback on the defaults.

* bump: up version to 5.1.7

Co-authored-by: Adam Snyder <[email protected]>
@armsnyder armsnyder deleted the allow-missing-template branch February 24, 2021 10:28
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.

2 participants