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
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
],
"author": "Fran Mendez <[email protected]> (fmvilas.com)",
"license": "Apache-2.0",
"files": [
"__transpiled"
],
"repository": {
"type": "git",
"url": "git+https://github.com/asyncapi/html-template.git"
Expand All @@ -30,7 +33,8 @@
"generate:readme:toc": "markdown-toc -i README.md",
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
"copy:sources": "node ./scripts/copy-sources.js",
"prepublishOnly": "npm run generate:assets",
"prepublishOnly": "npm run generate:assets && npm run transpile",
"transpile": "node ./scripts/transpile.js",
"test": "npm run test:library && npm run test:generator"
},
"publishConfig": {
Expand Down
11 changes: 11 additions & 0 deletions scripts/transpile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { transpileFiles } = require('@asyncapi/generator-react-sdk');
const path = require('path')

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

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

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

}

transpileTemplate().catch((err) => console.log('Error during template transpilation:', err));
Loading