diff --git a/package.json b/package.json index b9fcdc736..aa69f52a6 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,9 @@ ], "author": "Fran Mendez (fmvilas.com)", "license": "Apache-2.0", + "files": [ + "__transpiled" + ], "repository": { "type": "git", "url": "git+https://github.com/asyncapi/html-template.git" @@ -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": { diff --git a/scripts/transpile.js b/scripts/transpile.js new file mode 100644 index 000000000..371c72d79 --- /dev/null +++ b/scripts/transpile.js @@ -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();