|
|
@ -1,4 +1,5 @@ |
|
|
import path from 'path'; |
|
|
import path from 'path'; |
|
|
|
|
|
import {BLOCK_NAME, IS_DEV, MODULE_PATH, PROJECT_PATH} from "./env.js"; |
|
|
import config from 'config'; |
|
|
import config from 'config'; |
|
|
import {fileURLToPath} from 'url'; |
|
|
import {fileURLToPath} from 'url'; |
|
|
import memFs from 'mem-fs'; |
|
|
import memFs from 'mem-fs'; |
|
|
@ -13,14 +14,11 @@ const __filename = fileURLToPath(import.meta.url); |
|
|
const __dirname = path.dirname(__filename); |
|
|
const __dirname = path.dirname(__filename); |
|
|
|
|
|
|
|
|
export function getConfigs() { |
|
|
export function getConfigs() { |
|
|
const isDev = process.env.NODE_ENV === 'development'; // Check README file in case you get "missing files" error.
|
|
|
|
|
|
const developmentBlockName = process.env.BLOCK_NAME; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
isDev, |
|
|
isDev: IS_DEV, |
|
|
developmentBlockName, |
|
|
developmentBlockName: BLOCK_NAME, |
|
|
modulesPath: process.env.MODULE_PATH ?? (isDev ? '' : 'node_modules/block-dev-tool'), |
|
|
modulesPath: MODULE_PATH, |
|
|
projectPath: process.env.PROJECT_PATH ?? (isDev ? path.join('blocks', developmentBlockName) : ''), |
|
|
projectPath: PROJECT_PATH, |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -157,19 +155,19 @@ export async function zipProject(srcDir, outputFileName = 'dist.zip') { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export async function buildExportFiles(blockName, platform) { |
|
|
export async function buildExportFiles(blockName, platform) { |
|
|
if (platform.name.startsWith('wordpress')) { |
|
|
if (platform.name.startsWith('wordpress')) { |
|
|
if (platform.name === 'wordpress-acf-block') { |
|
|
if (platform.name === 'wordpress-acf-block') { |
|
|
await buildWordPress(blockName, {block: true}); |
|
|
await buildWordPress(blockName, {block: true}); |
|
|
} else if (platform.name === 'wordpress-elementor') { |
|
|
} else if (platform.name === 'wordpress-elementor') { |
|
|
await buildWordPress(blockName, {elementor: true}); |
|
|
await buildWordPress(blockName, {elementor: true}); |
|
|
} else if (platform.name === 'wordpress-component-manager') { |
|
|
} else if (platform.name === 'wordpress-component-manager') { |
|
|
await buildWordPress(blockName, {componentManager: true}); |
|
|
await buildWordPress(blockName, {componentManager: true}); |
|
|
} else { |
|
|
} else { |
|
|
await buildWordPress(blockName); |
|
|
await buildWordPress(blockName); |
|
|
} |
|
|
|
|
|
} else if (platform.name === 'hubspot-email') { |
|
|
|
|
|
await buildHubspotEmail(blockName) |
|
|
|
|
|
} else if (platform.name === 'hubspot') { |
|
|
|
|
|
await buildHubspotPage(blockName) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
} else if (platform.name === 'hubspot-email') { |
|
|
|
|
|
await buildHubspotEmail(blockName) |
|
|
|
|
|
} else if (platform.name === 'hubspot') { |
|
|
|
|
|
await buildHubspotPage(blockName) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|