@aivec/wp-docker-dev-factory
Version:
Spin up local WordPress environments with Docker.
24 lines (20 loc) • 686 B
text/typescript
import path from 'path';
import { InstanceConfig } from '../types';
import { homedir } from 'os';
const buildPluginAutoInstallWhitelist = (config: InstanceConfig, workingdir: string): string[] => {
let alreadyInstalled = [];
if (Array.isArray(config.downloadPlugins)) {
alreadyInstalled = [...config.downloadPlugins];
}
if (config.localPlugins) {
config.localPlugins.forEach((p) => {
if (path.isAbsolute(p)) {
p = `${homedir()}${p}`;
}
const folder = path.basename(path.resolve(workingdir, p));
alreadyInstalled = [...alreadyInstalled, folder];
});
}
return alreadyInstalled;
};
export default buildPluginAutoInstallWhitelist;