Provide option to rewrite project/module paths.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user