Skip to content

Commit 7829961

Browse files
committed
fixed init flow
1 parent 7236707 commit 7829961

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

commands/scaffold.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ async function create(type, params) {
2828
await installDependencies(path);
2929
await maybeExecuteInitScript(path);
3030
updateAddonPlaceholder(path, type, params);
31+
console.log(`${chalk.green.bold("addon created successfully")}`);
3132
}
3233

3334
function validateValues(type, params) {
@@ -94,6 +95,7 @@ async function cloneTemplate(type, params) {
9495
}
9596

9697
function updateAddonPlaceholder(addonPath, type, params) {
98+
console.log(`${chalk.white.bold("updating addon config ...")}`);
9799
const { addonName, addonAuthor } = params;
98100
const templateFile = addonTemplate[type].config;
99101
const addonConfigPath = path.resolve(
@@ -136,7 +138,15 @@ function maybeExecuteInitScript(addonPath) {
136138
const initScriptPath = path.resolve(process.cwd(), addonPath, "init.js");
137139
if (fs.existsSync(initScriptPath)) {
138140
console.log(`${chalk.white.bold("executing init script ...")}`);
139-
require(initScriptPath);
141+
const init = require(initScriptPath);
142+
init()
143+
.then(() => {
144+
resolve();
145+
})
146+
.catch((err) => {
147+
console.error(err);
148+
reject(err);
149+
});
140150
} else {
141151
resolve();
142152
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "c3ide2-cli",
33
"description": "A simple CLI for scaffolding construct 3 addons using c3ide2-framework",
4-
"version": "1.2.1",
4+
"version": "1.2.2",
55
"main": "index.js",
66
"license": "MIT",
77
"dependencies": {

0 commit comments

Comments
 (0)