Skip to content

Commit

Permalink
Merge branch 'master' into enhancement/post-install
Browse files Browse the repository at this point in the history
  • Loading branch information
erikyo authored Dec 1, 2023
2 parents b573e79 + a79fc50 commit 6b6f0f7
Show file tree
Hide file tree
Showing 6 changed files with 4,222 additions and 1,116 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [lts/*, latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test

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,14 +48,17 @@ 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);

// Run post-install commands
if (isWPCLIAvailable() && postInstall && postInstall.length > 0) {
console.log('🤖 Executing post-install commands...');
Expand Down
3 changes: 1 addition & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function renameFolder (oldPath, newPath) {
*/
function getWordPressDownloadUrl (version, language) {
if (language && !language.startsWith('en')) {
return `https://${language}.wordpress.org/wordpress-${version}-${language}.zip`;
return `https://${language.slice(0, 2).toLowerCase()}.wordpress.org/wordpress-${version}-${language}.zip`;
} else {
return `https://wordpress.org/wordpress-${version}.zip`;
}
Expand All @@ -93,7 +93,6 @@ function getWordPressDownloadUrl (version, language) {
* @return {string} The download URL for the package.
*/
function getDownloadUrl (packageName, packageVersion, type) {

// Using the absolute uri of the package
if (packageName.startsWith('http://') || packageName.startsWith('https://')) {
return packageName;
Expand Down
Loading

0 comments on commit 6b6f0f7

Please sign in to comment.