Provide option to rewrite project/module paths.

This commit is contained in:
2022-12-03 21:58:34 +02:00
parent 02abf4652e
commit d9543bb22c
5 changed files with 57 additions and 61 deletions
+5 -5
View File
@@ -9,9 +9,9 @@ import execPhp from "exec-php";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const {modulesPath, projectPath} = getConfigs();
export async function buildWordPress(blockName, isBlock = false, isElementor = false) {
const {modulesPath, projectPath} = getConfigs();
const distPath = path.join(projectPath, 'exports', 'wordpress');
// await mkdir(distPath, {recursive: true})
await mkdir(path.join(distPath, 'templates'), {recursive: true})
@@ -75,7 +75,7 @@ export async function buildWordPress(blockName, isBlock = false, isElementor = f
generatorsPath: path.join(__dirname),
});
if(isElementor){
if (isElementor) {
await createFiles(data, [{
from: `templates/helpers/Template_Elementor_Widget.php`,
to: `helpers/${data.blockClassModel}_Elementor_Widget.php`,
@@ -115,7 +115,7 @@ export async function buildWordPress(blockName, isBlock = false, isElementor = f
export function execCommand(cmd = '') {
return new Promise((resolve, reject) => {
exec(cmd, function (error, stdout) {
exec(cmd, function (error) {
if (error) {
console.log('Error:', error)
reject(error);
@@ -136,7 +136,7 @@ function execPHPFile(file = '', functionName = '', args = {}) {
return reject(err);
}
php[functionName.toLowerCase()](args, (err, res, out, print) => {
php[functionName.toLowerCase()](args, (err, res, out) => {
if (err) {
console.error(out);
return reject(err);