From 529edaa058139ec618471197d14e14595705f21e Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 17 Oct 2018 16:18:24 -0400 Subject: [PATCH] rename templates in .hbs --- lib/modules/scaffolding-react/index.js | 4 ++-- .../templates/{dapp.js.tpl => dapp.js.hbs} | 0 .../templates/{index.html.tpl => index.html.hbs} | 0 lib/modules/scaffolding-solidity/index.js | 6 ++++-- .../templates/{contract.sol.tpl => contract.sol.hbs} | 0 5 files changed, 6 insertions(+), 4 deletions(-) rename lib/modules/scaffolding-react/templates/{dapp.js.tpl => dapp.js.hbs} (100%) rename lib/modules/scaffolding-react/templates/{index.html.tpl => index.html.hbs} (100%) rename lib/modules/scaffolding-solidity/templates/{contract.sol.tpl => contract.sol.hbs} (100%) diff --git a/lib/modules/scaffolding-react/index.js b/lib/modules/scaffolding-react/index.js index cec04e1b3..1c0efe120 100644 --- a/lib/modules/scaffolding-react/index.js +++ b/lib/modules/scaffolding-react/index.js @@ -89,13 +89,13 @@ class ScaffoldingReact { try { const filename = contract.className.toLowerCase(); - this._generateFile(contract, 'index.html.tpl', 'html', + this._generateFile(contract, 'index.html.hbs', 'html', { 'title': contract.className, filename }, overwrite); - const filePath = this._generateFile(contract, 'dapp.js.tpl', 'js', + const filePath = this._generateFile(contract, 'dapp.js.hbs', 'js', { 'title': contract.className, 'contractName': contract.className, diff --git a/lib/modules/scaffolding-react/templates/dapp.js.tpl b/lib/modules/scaffolding-react/templates/dapp.js.hbs similarity index 100% rename from lib/modules/scaffolding-react/templates/dapp.js.tpl rename to lib/modules/scaffolding-react/templates/dapp.js.hbs diff --git a/lib/modules/scaffolding-react/templates/index.html.tpl b/lib/modules/scaffolding-react/templates/index.html.hbs similarity index 100% rename from lib/modules/scaffolding-react/templates/index.html.tpl rename to lib/modules/scaffolding-react/templates/index.html.hbs diff --git a/lib/modules/scaffolding-solidity/index.js b/lib/modules/scaffolding-solidity/index.js index cee62dcf6..0588ebb61 100644 --- a/lib/modules/scaffolding-solidity/index.js +++ b/lib/modules/scaffolding-solidity/index.js @@ -1,6 +1,7 @@ const Handlebars = require('handlebars'); const fs = require('../../core/fs'); +const utils = require('../../utils/utils'); const capitalize = string => string.charAt(0).toUpperCase() + string.slice(1); @@ -20,11 +21,12 @@ class ScaffoldingSolidity { throw new Error("file '" + filePath + "' already exists"); } - const templatePath = fs.embarkPath('lib/modules/scaffolding-solidity/templates/' + templateFilename); + const templatePath = utils.joinPath(__dirname, 'templates/' + templateFilename); const source = fs.readFileSync(templatePath).toString(); const template = Handlebars.compile(source); // Write template + console.dir(data); const result = template(data); fs.writeFileSync(filePath, result); return filePath; @@ -36,7 +38,7 @@ class ScaffoldingSolidity { const filename = contract.className; - const filePath = this._generateFile(contract, 'contract.sol.tpl', 'sol', { + const filePath = this._generateFile(contract, 'contract.sol.hbs', 'sol', { 'contractName': contract.className, 'structName': contract.className + "Struct", 'fields': Object.keys(contract.fields).map(f => { diff --git a/lib/modules/scaffolding-solidity/templates/contract.sol.tpl b/lib/modules/scaffolding-solidity/templates/contract.sol.hbs similarity index 100% rename from lib/modules/scaffolding-solidity/templates/contract.sol.tpl rename to lib/modules/scaffolding-solidity/templates/contract.sol.hbs