Skip to content

Commit

Permalink
feat: add scripts that on release will publish transpiled template to…
Browse files Browse the repository at this point in the history
… npm (#575)
  • Loading branch information
Gmin2 authored Mar 25, 2024
1 parent 0b4fc9b commit 4a9a3ea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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
16 changes: 16 additions & 0 deletions scripts/transpile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { transpileFiles } = require("@asyncapi/generator-react-sdk");
const path = require("path");

async function transpileTemplate() {
try {
const templateContentDir = path.join(__dirname, "../template");
console.log("Template content directory:", templateContentDir);
const outputDir = path.join(__dirname, "../__transpiled");
console.log("Output directory for transpiled files:", outputDir);
await transpileFiles(templateContentDir, outputDir, { recursive: true });
} catch (error) {
console.log("Error during template transpilation:", err)
}
}

transpileTemplate();

0 comments on commit 4a9a3ea

Please sign in to comment.