I would like use Promise in Yeoman generator. But i don't understand why my Promise is undefined when she calling in .then
:
_initDockerConfig() {
console.log(``);
console.log(`Init Docker config.`);
return new Promise((resolve, reject) => {
try {
this.fs.copyTpl(
this.templatePath(`docker`),
this.destinationPath(`app/config/docker`)
);
resolve();
} catch(error) {
reject(error);
}
});
}
When i call my method :
_installSymfony() {
return exec(`php -r "readfile(\'https://symfony.com/installer\');" > symfony`)
.then(() => {
console.log('');
console.log(chalk.green('Download symfony.'));
return exec(`php symfony new ${slugify(this.appName)}`);
})
.then(() => {
return exec(`mv ./${slugify(this.appName)}/* ./`);
})
.then(() => {
return exec(`rm symfony`);
})
.then(() => {
return exec(`rm -rf ${slugify(this.appName)}`);
})
.then(() => {
console.log(this._initDockerConfig()); // return Promise { undefined }
});
}
Anyone call help me ?
Thank you !