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

Merged
merged 7 commits into from
Mar 25, 2024

Conversation

Gmin2
Copy link
Contributor

@Gmin2 Gmin2 commented Mar 23, 2024

Description

  • Added the transpile scripts that creates __transpiled folder in the root directory
  • Modify the prepublishOnly scripts that ensures transpilation runs before publishing

Related issue(s)
Fixes #558

Copy link

@github-actions github-actions bot left a 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.

@Gmin2 Gmin2 marked this pull request as draft March 23, 2024 12:44
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.

I don't think we actually need to modify copy sources script as we in the end publish entire package, not only template folder. Copy sources is needed only for specific thing.

So yeah, package.json script modification should be enough. Only one more change is needed - _trabspiled is in gitignore, so by default will not be pushed to npm,so you need to modify package.json so it accepts _trabspile folder

scripts/transpile.js Outdated Show resolved Hide resolved
scripts/transpile.js Outdated Show resolved Hide resolved
@Gmin2 Gmin2 marked this pull request as ready for review March 24, 2024 09:28
@Gmin2 Gmin2 changed the title fix: added scripts that on release will publish transpiled template to npm feat: added scripts that on release will publish transpiled template to npm Mar 24, 2024
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.

looks good, just some code improvements please


async function transpileTemplate() {
const templateContentDir = path.join(__dirname, '../template');
console.log("templateContentDir",templateContentDir)
Copy link
Member

Choose a reason for hiding this comment

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

please add full sentence console log

async function transpileTemplate() {
const templateContentDir = path.join(__dirname, '../template');
console.log("templateContentDir",templateContentDir)
const outputDir = path.join(__dirname, '../__transpiled');
Copy link
Member

Choose a reason for hiding this comment

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

console log this variable as well, but again, with full descriptive console log info

const templateContentDir = path.join(__dirname, '../template');
console.log("templateContentDir",templateContentDir)
const outputDir = path.join(__dirname, '../__transpiled');
await transpileFiles(templateContentDir, outputDir, {recursive: true})
Copy link
Member

Choose a reason for hiding this comment

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

please put it in between try/catch instead of later catching errors on transpileTemplate

@derberg derberg changed the title feat: added scripts that on release will publish transpiled template to npm feat: add scripts that on release will publish transpiled template to npm Mar 24, 2024
Copy link

sonarcloud bot commented Mar 24, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@Gmin2
Copy link
Contributor Author

Gmin2 commented Mar 24, 2024

Done @derberg 👍

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, lets merge and see if transpiled files end up in a package and if it makes any difference

@derberg
Copy link
Member

derberg commented Mar 25, 2024

/rtm

@asyncapi-bot asyncapi-bot merged commit 4a9a3ea into asyncapi:master Mar 25, 2024
10 checks passed
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@aeworxet
Copy link

@asyncapi/bounty_team

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 2.3.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
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

Add necessary scripts that on release will publish transpiled template to npm
4 participants