diff --git a/commands/scaffold.js b/commands/scaffold.js index 98ae212..89a3c39 100644 --- a/commands/scaffold.js +++ b/commands/scaffold.js @@ -28,6 +28,7 @@ async function create(type, params) { await installDependencies(path); await maybeExecuteInitScript(path); updateAddonPlaceholder(path, type, params); + console.log(`${chalk.green.bold("addon created successfully")}`); } function validateValues(type, params) { @@ -94,6 +95,7 @@ async function cloneTemplate(type, params) { } function updateAddonPlaceholder(addonPath, type, params) { + console.log(`${chalk.white.bold("updating addon config ...")}`); const { addonName, addonAuthor } = params; const templateFile = addonTemplate[type].config; const addonConfigPath = path.resolve( @@ -136,7 +138,15 @@ function maybeExecuteInitScript(addonPath) { const initScriptPath = path.resolve(process.cwd(), addonPath, "init.js"); if (fs.existsSync(initScriptPath)) { console.log(`${chalk.white.bold("executing init script ...")}`); - require(initScriptPath); + const init = require(initScriptPath); + init() + .then(() => { + resolve(); + }) + .catch((err) => { + console.error(err); + reject(err); + }); } else { resolve(); } diff --git a/package.json b/package.json index 44530b4..367144f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "c3ide2-cli", "description": "A simple CLI for scaffolding construct 3 addons using c3ide2-framework", - "version": "1.2.1", + "version": "1.2.2", "main": "index.js", "license": "MIT", "dependencies": {