You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
#!/usr/bin/env node
|
|
// For development purposes - run `npm run build-platform`.
|
|
|
|
import config from 'config';
|
|
import prompts from "prompts";
|
|
import {buildExportFiles, getConfigs} from "./helpers.js";
|
|
|
|
const {isDev, developmentBlockName} = getConfigs();
|
|
const blockName = !isDev && config.has('blockName') ? config.get('blockName') : developmentBlockName;
|
|
|
|
export const PLATFORM_OPTIONS = [{
|
|
name: 'wordpress-acf-block',
|
|
title: 'WordPress AFC Block'
|
|
}, {
|
|
name: 'wordpress',
|
|
title: 'WordPress'
|
|
}, {
|
|
name: 'wordpress-component-manager',
|
|
title: 'WordPress (Component Manager)'
|
|
}, {
|
|
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(blockName, selectedPlatform);
|
|
|
|
console.log('--------------------\nDone!');
|
|
|
|
//
|
|
// Functions
|
|
//
|
|
|
|
function getExportData() {
|
|
return prompts([
|
|
{
|
|
type: "select",
|
|
name: "platform",
|
|
message: "Choose Platform",
|
|
choices: PLATFORM_OPTIONS.map(item => item.title),
|
|
default: 'WordPress'
|
|
}
|
|
]);
|
|
}
|
|
|