-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
fix: ts-node
is registered only when it's actually needed
#1165
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Quality Gate passedIssues Measures |
can you take a look @derberg @Florence-Njeri |
lib/filtersRegistry.js
Outdated
@@ -11,10 +11,52 @@ const { isAsyncFunction } = require('./utils'); | |||
* @param {String} filtersDir Directory where local filters are located. | |||
*/ | |||
module.exports.registerFilters = async (nunjucks, templateConfig, templateDir, filtersDir) => { | |||
const hasTypescriptFiles = await checkForTypescriptFiles(templateDir, filtersDir); | |||
if(hasTypescriptFiles) { | |||
utils.registerTypescript(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my IDE, the utils
seems to be undefined. You probably want to add const { registerTypescript } = require('./utils');
And then in line 16, use registerTypescript(true)
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, @utnim2 please fix line 4 that for now requires only isAsyncFunction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why you think your solution must be implemented instead of what was suggested in #1030 (comment)
wouldn't it just be easier to plug into the existing code that anyway "walks" over filters and hooks files and you can use it to figure if ts file is there or not?
The suggested solution iterates through all files even there are no Typescript files present,my solution skips the registration process altogether if no Typescript file is present |
If I understand what @derberg said correctly, I think regardless of whether
This part of the code in
which goes through the directories where filters are located. It is the same case for hooks. Therefore, instead of checking it in a different place, it might be preferable to just look for TS files when looking for filters and hooks, to make the codebase clearer and more concise. They are my understandings. Please correct me if any of it is incorrect : ) |
@lmgyuan yes, this is exactly it, thanks. We anyway iterate there, thus better to inject TS validation there rather than have another iteration only for TS. Better performance |
Ok making the changes |
do you need some help @utnim2 ? |
2924a25
to
f133ecd
Compare
Quality Gate passedIssues Measures |
Quality Gate passedIssues Measures |
This is ready for review and merge cc @derberg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is still a linter issue we discussed during the call, and as you can see GitHub action fails because of it
@Gmin2 you need to solve conflicts |
🦋 Changeset detectedLatest commit: cb84886 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Quality Gate passedIssues Measures |
/rtm |
Description
checkForTypescriptFiles
andhasTypescriptFilesDir
functions to check for the presence ofts
files in thefilters
andhooks
directoriests
transpiles in theconfigureTemplateWorkflow
functions usingcheckForTypescriptFiles
.Related issue(s)
Fixes #1030