generator
generator copied to clipboard
feat: add `compile` option to enable rerun of transpilation for react templates
Description
The PR introduces a new option compile in the Generator class contructor which is by default false ,by default the React template files are not transpiled. When setting the compile options to true the transpilation process takes place.
I have also added/updated test for it. Below are the result
Related issue(s) Related to #521
which added this functionality
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
ok, we need to add a proper new integration test here, without proper test, feature development will be based on just our intuition
there are some integration tests already, that use https://github.com/asyncapi/html-template template
we just need another test, also using https://github.com/asyncapi/html-template but fixed to use version
2.3.0where__transpiledfolder was added to package.there are 2 test scenarios:
- with
compileflagfalseyou run html template generation with debug flag console.log message should contain something aboutBabel- with
compileflagtrueyou run html template generation with debug flag console.log message should not contain something aboutBabelWhy? We know html-template as some big files and babel warns about it in logs, when transpilation runs. Now, we also know that we do not need to run transpilation as
__transpileddir is there. This is why we can, with such integrations test, confirm if transpilation is triggered only ifcompileistruemakes sense?
looks alright
@utnim2 ok then, ping me when ready for another review
@utnim2 do you continue with this one?
@utnim2 do you continue with this one?
currently i am having my semester exam, will continue working on it after my exams are over cc @derberg
Hey @derberg, i guess compile flag is not working as expected
the integration test fails here and logs does not contain something about Babel, and generating react-template test also failing currently investgating it
reference of test taken from this
/update
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
so maybe the best will be to simply extend
configureReactwith a log message (only if debug flag) that basically drops log like "Transpilation of files DIR into OUTPUT_DIR started"then probably enough is to add just unit test in generator.test.js, check but probably integration test is not needed
i am confused here, so do we need to add integration test or do we just need to add test in generator.test.js
cc @derberg
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
i am confused here, so do we need to add integration test or do we just need to add test in generator.test.js
just try with suggestion to add log and test for it - if it will work, no integration test is needed
@derberg any idea why workflow is failing? (idk why test seems to fail)
Hey @derberg when i run locally, with compile true then it works perfectly
but dont know why test is failing
@Gmin2 your tests are still failing
🦋 Changeset detected
Latest commit: 834b3ccdccbe413a9badce4ddb0490785320e165
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @asyncapi/generator | Minor |
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
@Gmin2 any progress?
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
@Gmin2 all good, I just improved the changeset a bit to make it clear what this release is all about. Please have a look for future education
/rtm