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: add templatesDir option to getTemplateFile #292

Merged
merged 1 commit into from
Apr 10, 2020

Conversation

fmvilas
Copy link
Member

@fmvilas fmvilas commented Apr 9, 2020

Description

If you're using the generator as a library, your application's node_modules will be different than the default DEFAULT_TEMPLATES_DIR. For instance:

my-app/node_modules/@asyncapi/generator/...
my-app/node_modules/@asyncapi/html-template/...

If I use the generator as a library in this scenario, DEFAULT_TEMPLATES_DIR would be my-app/node_modules/@asyncapi/generator/ and using the @asyncapi/html-template would result in the template being installed as a sibling of the generator, like above. Therefore, using getTemplateFile('@asyncapi/html', 'partials/content.html') will result in an attempt to access the file my-app/node_modules/@asyncapi/generator/node_modules/@asyncapi/html-template/partials/content.html, which is incorrect.

This PR lets you change the DEFAULT_TEMPLATES_DIR only for the getTemplateFile method.

@fmvilas fmvilas requested review from derberg and jonaslagoni April 9, 2020 18:53
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 9, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fmvilas fmvilas merged commit 28410a9 into asyncapi:master Apr 10, 2020
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.37.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants