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 necessary scripts that on release will publish transpiled template to npm #558

Closed
derberg opened this issue Mar 14, 2024 · 19 comments · Fixed by #575
Closed

Add necessary scripts that on release will publish transpiled template to npm #558

derberg opened this issue Mar 14, 2024 · 19 comments · Fixed by #575
Assignees
Labels
bounty AsyncAPI Bounty enhancement New feature or request released

Comments

@derberg
Copy link
Member

derberg commented Mar 14, 2024

Since we migrated this template to React render engine, the generation time, like in other react templates, got super long

Reason - every time generation is run, TS transpilation runs

This can be solved by publishing templates, like this one, to npm with transpilation files included, so basically no transpilation is needed in runtime - unless explicitly requested.

When you clone this repo, install and run asyncapi generate fromTemplate ./test/spec/asyncapi_v3.yml ./ --output mydocs --force-write from root, you will notice a new folder called __transpiled - this is the folder we need to make sure is included in package publishing.

This is how generator triggers transpilation -> https://github.com/asyncapi/generator/blob/master/lib/renderer/react.js#L19
Now we need to make sure we have proper script here in template that does the same. This new script needs to be called only by this script -> https://github.com/asyncapi/html-template/blob/master/package.json#L33C6-L33C20

We already have some custom scripts in this repo that run on release -> https://github.com/asyncapi/html-template/blob/master/scripts/copy-sources.js so you just plugin into existing infra.

Note
Completion of this task do not mean yet that time of generation will go down. I think that babel that we use in https://github.com/asyncapi/generator-react-sdk/blob/master/src/transpiler/transpiler.ts is already smart and do not regenerate if __transpiled dir is already there but yeah, lets see

@jonaslagoni
Copy link
Member

jonaslagoni commented Mar 14, 2024

Completion of this task do not mean yet that time of generation will go down. I think that babel that we use in https://github.com/asyncapi/generator-react-sdk/blob/master/src/transpiler/transpiler.ts is already smart and do not regenerate if __transpiled dir is already there but yeah, lets see

Pretty sure this is NOT the case 🤔 But I have not tested it. Think we have to adapt the react-sdk kit or generator to check for this directory before trying to transpile it.

@asyncapi-bot asyncapi-bot added the bounty AsyncAPI Bounty label Mar 18, 2024
@aeworxet
Copy link

Bounty Issue's service comment

Text labels: bounty/2024-Q2, bounty/medium, bounty/devops
First assignment to third-party contributors: 2024-03-22 00:00:00 UTC+12:00
End Of Life: 2024-08-31 23:59:59 UTC-12:00

@asyncapi/bounty_team

@aeworxet aeworxet moved this to No Assignee in Bounty Program Mar 18, 2024
@derberg
Copy link
Member Author

derberg commented Mar 21, 2024

@jonaslagoni I only did manual tests and manual eye observation. Only first run is always long, the next ones are super fast - this is why I assume, it looks into transpiled directory first during transpilation

@Gmin2
Copy link
Contributor

Gmin2 commented Mar 21, 2024

@derberg on it

@derberg
Copy link
Member Author

derberg commented Mar 21, 2024

@utnim2 just assigned to you. Good luck and lemme know if you need some more details

@aeworxet
Copy link

Bounty Issue's Timeline

Complexity Level Assignment date (by GitHub) Start date (by BP rules) End date (by BP rules) Draft PR submission Final PR submission Final PR merge
Medium 2024-03-21 2024-04-01 2024-05-10 2024-04-12 2024-04-26 2024-05-10
Please note that the dates given represent deadlines, not specific dates, so if the goal is reached sooner, it's better.
Keep in mind the responsibility for violations of the Timeline.

@derberg
Copy link
Member Author

derberg commented Mar 25, 2024

PR is merged and will be released but it is not yet completed, we need to now test if things improved as expected

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@derberg
Copy link
Member Author

derberg commented Mar 27, 2024

had to revert it as there was a wrong configuration in package.json

@derberg derberg reopened this Mar 27, 2024
@aeworxet aeworxet moved this from Completed to In Progress in Bounty Program Mar 27, 2024
@derberg
Copy link
Member Author

derberg commented Mar 27, 2024

@utnim2 do you plan to open another PR?

@Gmin2
Copy link
Contributor

Gmin2 commented Mar 27, 2024

@derberg i was out of town for a bit, will open a PR tommorow

@webbdays
Copy link

webbdays commented Mar 30, 2024

if @utnim2 is busy,
can i fix the config and push the changes?

@Gmin2
Copy link
Contributor

Gmin2 commented Mar 30, 2024

if @utnim2 is busy, can i fix the config and push the changes?

@webbdays It is fixed in #583

@webbdays
Copy link

webbdays commented Mar 30, 2024

ok. Thanks for the reply.

@aeworxet
Copy link

aeworxet commented Apr 1, 2024

@webbdays
Please do not intervene when the issue is an assigned Bounty Issue and is complying with the Bounty Issue's Timeline.
However, if you have a desire to help and receive a reward for completing a Bounty Issue, you can take a look at the non-assigned Bounty Issues for the calendar quarter round 2024-Q2:
https://github.com/orgs/asyncapi/projects/36/views/4?sliceBy%5Bvalue%5D=bounty%2F2024-Q2&filterQuery=round%3A%22bounty%2F2024-Q2%22+status%3A%22No+Assignee%22

@webbdays
Copy link

webbdays commented Apr 1, 2024

Thanks.

@derberg
Copy link
Member Author

derberg commented Apr 2, 2024

Closing
#583 was done good. Unfortunately it did not solve what I thought it will, but from the requirements point of view, @aeworxet the task is completed

@derberg derberg closed this as completed Apr 2, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Completed in Bounty Program Apr 2, 2024
@derberg
Copy link
Member Author

derberg commented Apr 2, 2024

actually I did some tests and it added some good value -> asyncapi/generator#521 (comment)

@aeworxet
Copy link

aeworxet commented Apr 3, 2024

Bounty Issue Completed 🎉

@utnim2, please go to the AsyncAPI page on Open Collective and submit an invoice for USD 200.00 with the expense title Bounty html-template#558, tag bounty, and full URL of this Bounty Issue in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty AsyncAPI Bounty enhancement New feature or request released
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

6 participants