Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move plugin and theme installation to parallel execution #11

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class WordPressInstaller {
// Create temp folder
makeDir(this.tempDir);

const promises = [];

// the default paths for the packages
const defaultPaths = {
rootFolder: this.rootFolder,
Expand All @@ -46,13 +48,16 @@ class WordPressInstaller {

if (plugins) {
const pluginPackages = plugins.map((plugin) => new PluginPackage(plugin, { ...defaultPaths, destFolder: this.pluginsFolder }));
await Promise.all(pluginPackages.map((pluginPackage) => pluginPackage.install()));
promises.push(...pluginPackages.map((pluginPackage) => pluginPackage.install()));
}

if (themes) {
const themePackages = themes.map((theme) => new ThemePackage(theme, { ...defaultPaths, destFolder: this.themeFolder }));
await Promise.all(themePackages.map((themePackage) => themePackage.install()));
promises.push(...themePackages.map((themePackage) => themePackage.install()));
}

// Install plugins and themes concurrently
await Promise.all(promises);
}

/**
Expand Down