|
|
|
@ -3,10 +3,7 @@ |
|
|
|
|
|
|
|
import config from 'config'; |
|
|
|
import prompts from "prompts"; |
|
|
|
import {buildHubspotEmail} from "./platforms/hubspot/hubspot-email-adapter.js"; |
|
|
|
import {getConfigs} from "./helpers.js"; |
|
|
|
import {buildWordPress} from "./platforms/wordpress/wordpress-adapter.js"; |
|
|
|
import {buildHubspotPage} from "./platforms/hubspot/hubspot-page-adapter.js"; |
|
|
|
import {buildExportFiles, getConfigs} from "./helpers.js"; |
|
|
|
|
|
|
|
const {isDev, developmentBlockName} = getConfigs(); |
|
|
|
const blockName = !isDev && config.has('blockName') ? config.get('blockName') : developmentBlockName; |
|
|
|
@ -39,7 +36,7 @@ export const PLATFORM_OPTIONS = [{ |
|
|
|
|
|
|
|
const data = await getExportData(); |
|
|
|
const selectedPlatform = PLATFORM_OPTIONS[data['platform']]; |
|
|
|
await buildExportFiles(selectedPlatform); |
|
|
|
await buildExportFiles(blockName, selectedPlatform); |
|
|
|
|
|
|
|
console.log('--------------------\nDone!'); |
|
|
|
|
|
|
|
@ -47,24 +44,6 @@ console.log('--------------------\nDone!'); |
|
|
|
// Functions
|
|
|
|
//
|
|
|
|
|
|
|
|
export async function buildExportFiles(platform) { |
|
|
|
if (platform.name.startsWith('wordpress')) { |
|
|
|
if (platform.name === 'wordpress-blocks') { |
|
|
|
await buildWordPress(blockName, {block: true}); |
|
|
|
} else if (platform.name === 'wordpress-elementor') { |
|
|
|
await buildWordPress(blockName, {elementor: true}); |
|
|
|
} else if (platform.name === 'wordpress-component-manager') { |
|
|
|
await buildWordPress(blockName, {componentManager: true}); |
|
|
|
} else { |
|
|
|
await buildWordPress(blockName); |
|
|
|
} |
|
|
|
} else if (platform.name === 'hubspot-email') { |
|
|
|
await buildHubspotEmail(blockName) |
|
|
|
} else if (platform.name === 'hubspot') { |
|
|
|
await buildHubspotPage(blockName) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getExportData() { |
|
|
|
return prompts([ |
|
|
|
{ |
|
|
|
|