Skip to content

Commit

Permalink
Return promises in afterInstall hook
Browse files Browse the repository at this point in the history
  • Loading branch information
mkszepp committed Jan 2, 2024
1 parent ad1fd8e commit 4628688
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions ember-basic-dropdown/blueprints/ember-basic-dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {

afterInstall() {
let dependencies = this.project.dependencies();
const promises = [];
let skipStyleImport = false;

if ('ember-power-select' in dependencies) {
Expand All @@ -38,7 +39,7 @@ module.exports = {
}
if (fs.existsSync(file)) {
this.ui.writeLine(`Added import statement to ${file}`);
this.insertIntoFile(file, importStatement, {});
promises.push(this.insertIntoFile(file, importStatement, {}));
} else {
fs.writeFileSync(file, importStatement);
this.ui.writeLine(`Created ${file}`);
Expand All @@ -50,9 +51,11 @@ module.exports = {
}
if (fs.existsSync(file)) {
this.ui.writeLine(`Added import statement to ${file}`);
this.insertIntoFile(file, "import 'ember-basic-dropdown/styles';", {
after: "config/environment';" + EOL,
});
promises.push(
this.insertIntoFile(file, "import 'ember-basic-dropdown/styles';", {
after: "config/environment';" + EOL,
}),
);
}
}
}
Expand All @@ -61,11 +64,15 @@ module.exports = {
let applicationFile = path.join(templatePath, `application.hbs`);
if (fs.existsSync(applicationFile)) {
this.ui.writeLine(`Added wormhole statement to ${applicationFile}`);
this.insertIntoFile(
applicationFile,
`${EOL}<BasicDropdownWormhole />`,
{},
promises.push(
this.insertIntoFile(
applicationFile,
`${EOL}<BasicDropdownWormhole />`,
{},
),
);
}

return Promise.all(promises);
},
};

0 comments on commit 4628688

Please sign in to comment.