#!/usr/bin/env node // For development purposes - run `npm run build-platform`. 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"; const {isDev, developmentBlockName} = getConfigs(); const blockName = !isDev && config.has('blockName') ? config.get('blockName') : developmentBlockName; export const PLATFORM_OPTIONS = [{ name: 'wordpress', title: 'WordPress' }, { name: 'wordpress-blocks', title: 'WordPress Block' }, { name: 'wordpress-elementor', title: 'WordPress Elementor' }, { name: 'hubspot', title: 'Hubspot' }, { name: 'hubspot-email', title: 'Hubspot Email' }, { name: 'javascript', title: 'JavaScript' }, { name: 'php', title: 'PHP' }]; const data = await getExportData(); const selectedPlatform = PLATFORM_OPTIONS[data['platform']]; await buildExportFiles(selectedPlatform); console.log('--------------------\nDone!'); // // Functions // export async function buildExportFiles(platform) { if (platform.name.startsWith('wordpress')) { if (platform.name === 'wordpress-blocks') { await buildWordPress(blockName, true); } else if (platform.name === 'wordpress-elementor') { await buildWordPress(blockName, false, 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([ { type: "select", name: "platform", message: "Choose Platform", choices: PLATFORM_OPTIONS.map(item => item.title), default: 'WordPress' } ]); }