Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 92e4f1ea2d | |||
| 0062bb4506 | |||
| 5dd326be0f | |||
| bcad45d1e8 | |||
| 3daa725309 | |||
| 438619c4d9 | |||
| 1b2795fa40 | |||
| 31786581bd | |||
| e25f1aa4f1 | |||
| f3cd0e5876 | |||
| d6b0ff866b | |||
| 4a7ddf7d29 | |||
| 03a8833f46 | |||
| bf8f0e857d |
@@ -9,17 +9,8 @@ const {isDev, developmentBlockName} = getConfigs();
|
|||||||
const blockName = !isDev && config.has('blockName') ? config.get('blockName') : developmentBlockName;
|
const blockName = !isDev && config.has('blockName') ? config.get('blockName') : developmentBlockName;
|
||||||
|
|
||||||
export const PLATFORM_OPTIONS = [{
|
export const PLATFORM_OPTIONS = [{
|
||||||
name: 'wordpress-acf-block',
|
|
||||||
title: 'WordPress AFC Block'
|
|
||||||
}, {
|
|
||||||
name: 'wordpress',
|
name: 'wordpress',
|
||||||
title: 'WordPress'
|
title: 'WordPress'
|
||||||
}, {
|
|
||||||
name: 'wordpress-component-manager',
|
|
||||||
title: 'WordPress (Component Manager)'
|
|
||||||
}, {
|
|
||||||
name: 'wordpress-elementor',
|
|
||||||
title: 'WordPress Elementor'
|
|
||||||
}, {
|
}, {
|
||||||
name: 'hubspot',
|
name: 'hubspot',
|
||||||
title: 'Hubspot'
|
title: 'Hubspot'
|
||||||
|
|||||||
+25
-38
@@ -126,46 +126,33 @@ export function capitalize(str) {
|
|||||||
export async function zipProject(srcDir, outputFileName = 'dist.zip') {
|
export async function zipProject(srcDir, outputFileName = 'dist.zip') {
|
||||||
// create a file to stream archive data to.
|
// create a file to stream archive data to.
|
||||||
const output = await fsExtra.createWriteStream(outputFileName);
|
const output = await fsExtra.createWriteStream(outputFileName);
|
||||||
const archive = archiver('zip', {});
|
|
||||||
|
|
||||||
// listen for all archive data to be written
|
return new Promise((resolve, reject) => {
|
||||||
// 'close' event is fired only when a file descriptor is involved
|
// Create a file to write the archive data
|
||||||
output.on('close', function () {
|
const archive = archiver('zip', {
|
||||||
console.log(archive.pointer() + ' total bytes');
|
zlib: {level: 9} // Compression level
|
||||||
console.log('archiver has been finalized and the output file descriptor has closed.');
|
});
|
||||||
|
|
||||||
|
// Listen for errors on the archiver
|
||||||
|
archive.on('error', function (err) {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle closure of the output file stream
|
||||||
|
output.on('close', function () {
|
||||||
|
console.log(`Archive created successfully and it is ${archive.pointer()} total bytes`);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Pipe archive data to the file
|
||||||
|
archive.pipe(output);
|
||||||
|
|
||||||
|
// Add files to the archive
|
||||||
|
archive.directory(srcDir, false);
|
||||||
|
|
||||||
|
// Finalize the archive - this is very important to ensure the file stream is finished
|
||||||
|
archive.finalize();
|
||||||
});
|
});
|
||||||
|
|
||||||
// This event is fired when the data source is drained no matter what was the data source.
|
|
||||||
// It is not part of this library but rather from the NodeJS Stream API.
|
|
||||||
// @see: https://nodejs.org/api/stream.html#stream_event_end
|
|
||||||
output.on('end', function () {
|
|
||||||
console.log('Data has been drained');
|
|
||||||
});
|
|
||||||
|
|
||||||
// good practice to catch warnings (ie stat failures and other non-blocking errors)
|
|
||||||
archive.on('warning', function (err) {
|
|
||||||
if (err.code === 'ENOENT') {
|
|
||||||
// log warning
|
|
||||||
} else {
|
|
||||||
// throw error
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// good practice to catch this error explicitly
|
|
||||||
archive.on('error', function (err) {
|
|
||||||
throw err;
|
|
||||||
});
|
|
||||||
|
|
||||||
// pipe archive data to the file
|
|
||||||
archive.pipe(output);
|
|
||||||
|
|
||||||
// append files from a subdirectory, putting its contents at the root of archive
|
|
||||||
archive.directory(srcDir, false);
|
|
||||||
|
|
||||||
// finalize the archive (ie we are done appending files but streams have to finish yet)
|
|
||||||
// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand
|
|
||||||
await archive.finalize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function buildExportFiles(blockName, platform) {
|
export async function buildExportFiles(blockName, platform) {
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.31",
|
"version": "1.0.36",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.31",
|
"version": "1.0.36",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@axe-web/create-block": "^1.1.30",
|
"@axe-web/create-block": "^1.1.30",
|
||||||
|
|||||||
+4
-4
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.31",
|
"version": "1.0.36",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "AXE-WEB",
|
"name": "AXE-WEB",
|
||||||
"email": "office@axe-web.com",
|
"email": "office@axe-web.com",
|
||||||
"url": "https://axe-web.com/"
|
"url": "https://axe-web.com/"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"info": "BLOCK_NAME=swiper-test MODULE_PATH= node debug.js",
|
"info": "BLOCK_NAME=ebooks-resources MODULE_PATH= node debug.js",
|
||||||
"dev": "BLOCK_NAME=swiper-test MODULE_PATH= node server.js",
|
"dev": "BLOCK_NAME=ebooks-resources MODULE_PATH= node server.js",
|
||||||
"build-platform": "BLOCK_NAME=swiper-test MODULE_PATH= node ./build.js",
|
"build-platform": "BLOCK_NAME=ebooks-resources MODULE_PATH= node ./build.js",
|
||||||
"dev-dev-tool": "rollup --config rollup.config.js --watch",
|
"dev-dev-tool": "rollup --config rollup.config.js --watch",
|
||||||
"build-dev-tool": "rollup --config rollup.config.js"
|
"build-dev-tool": "rollup --config rollup.config.js"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,19 +2,13 @@
|
|||||||
|
|
||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
||||||
|
|
||||||
class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor) { %>extends \Core\Component <% } %>{
|
class <%= blockClassModel %>_Component extends \Core\Component {
|
||||||
const VERSION = '<%= version %>';
|
const VERSION = '<%= version %>';
|
||||||
public $block_project = '<%= ownerFilename %>';
|
public $block_project = '<%= ownerFilename %>';
|
||||||
public $block_name = '<%= blockFilename %>';
|
public $block_name = '<%= blockFilename %>';
|
||||||
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';
|
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';
|
||||||
|
|
||||||
<% if (!isComponentManager && !isElementor) { %>public function __construct() {
|
function register_assets(): void {
|
||||||
parent::__construct();
|
|
||||||
// add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ] );
|
|
||||||
add_action( 'after_setup_theme', [ $this, 'register_assets' ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
<% } %>function register_assets(): void {
|
|
||||||
$base_path = plugin_dir_url( __FILE__ ); // In Plugins
|
$base_path = plugin_dir_url( __FILE__ ); // In Plugins
|
||||||
// $base_path = get_template_directory_uri() . '/components/partials/<%= blockFilename %>/'; // In Theme
|
// $base_path = get_template_directory_uri() . '/components/partials/<%= blockFilename %>/'; // In Theme
|
||||||
|
|
||||||
@@ -22,12 +16,14 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor)
|
|||||||
wp_register_style( 'block-<%= blockFilename %>', $base_path . 'templates/styles/<%= blockFilename %>.min.css', $style_deps, self::VERSION );
|
wp_register_style( 'block-<%= blockFilename %>', $base_path . 'templates/styles/<%= blockFilename %>.min.css', $style_deps, self::VERSION );
|
||||||
|
|
||||||
$script_deps = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::script_deps', [ 'assets-script' ] );
|
$script_deps = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::script_deps', [ 'assets-script' ] );
|
||||||
wp_register_script( 'block-<%= blockFilename %>', $base_path . 'templates/scripts/<%= blockFilename %>.min.js', $script_deps, self::VERSION, true );<% if (!isElementor) { %>
|
wp_register_script( 'block-<%= blockFilename %>', $base_path . 'templates/scripts/<%= blockFilename %>.min.js', $script_deps, self::VERSION, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepare_for_print() {
|
||||||
if ( ! is_admin() ) {
|
if ( ! is_admin() ) {
|
||||||
wp_enqueue_style( 'block-<%= blockFilename %>' );
|
wp_enqueue_style( 'block-<%= blockFilename %>' );
|
||||||
wp_enqueue_script( 'block-<%= blockFilename %>' );
|
wp_enqueue_script( 'block-<%= blockFilename %>' );
|
||||||
}<% } %>
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_content( $args = [] ): string {
|
public function get_content( $args = [] ): string {
|
||||||
@@ -37,8 +33,8 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor)
|
|||||||
|
|
||||||
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( $args, self::class );
|
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( $args, self::class );
|
||||||
|
|
||||||
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output );
|
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output, $args );
|
||||||
}<% if (isElementor) { %>
|
}
|
||||||
|
|
||||||
function register_custom_logic(): void {
|
function register_custom_logic(): void {
|
||||||
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] );
|
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] );
|
||||||
@@ -47,9 +43,25 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor)
|
|||||||
function register_elementor_widget( $widgets_manager ): void {
|
function register_elementor_widget( $widgets_manager ): void {
|
||||||
require_once "helpers/<%= blockClassModel %>_Elementor_Widget.php";
|
require_once "helpers/<%= blockClassModel %>_Elementor_Widget.php";
|
||||||
$widgets_manager->register_widget_type( new Helpers\<%= blockClassModel %>_Elementor_Widget() );
|
$widgets_manager->register_widget_type( new Helpers\<%= blockClassModel %>_Elementor_Widget() );
|
||||||
}<% } %>
|
}
|
||||||
|
|
||||||
|
function register_acf_block() {
|
||||||
|
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [
|
||||||
|
'style_assets' => [
|
||||||
|
[
|
||||||
|
'name' => 'block-<%= blockFilename %>',
|
||||||
|
'url' => $this->get_assets_path_url( 'templates/styles/<%= blockFilename %>.min.css' ),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'script_assets' => [
|
||||||
|
[
|
||||||
|
'name' => 'block-<%= blockFilename %>',
|
||||||
|
'url' => $this->get_assets_path_url( 'templates/scripts/<%= blockFilename %>.min.js' ),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<% if (isComponentManager) { %><%= blockClassModel %>_Component::get_instance();<% } else {
|
<%= blockClassModel %>_Component::get_instance();
|
||||||
%>new <%= blockClassModel %>_Component();<% } %>
|
// new <%= blockClassModel %>_Component();
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
|
||||||
|
|
||||||
class <%= blockClassModel %>_Component extends \Core\Component {
|
|
||||||
const VERSION = '<%= version %>';
|
|
||||||
public $block_project = '<%= ownerFilename %>';
|
|
||||||
public $block_name = '<%= blockFilename %>';
|
|
||||||
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';
|
|
||||||
|
|
||||||
public function get_content( $args = [] ): string {
|
|
||||||
$default_args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::default_args', [] ); // Not really practical.
|
|
||||||
|
|
||||||
$args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::prepare_args', array_merge( $default_args, $args ) );
|
|
||||||
|
|
||||||
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( $args, self::class );
|
|
||||||
|
|
||||||
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output );
|
|
||||||
}
|
|
||||||
<% if (!include_acf_block && !include_native_gutenberg_block) { %>function register_assets(): void {
|
|
||||||
$version = get_plugin_data( __DIR__ . "/../../scytale-custom-blocks.php" )['Version']; // In Plugins
|
|
||||||
// $version = \Core\Global_Functions::get_current_version_number(); // In Theme
|
|
||||||
|
|
||||||
// $base_path = get_template_directory_uri() . '/components/partials/<%= blockFilename %>/';
|
|
||||||
wp_enqueue_style( 'block-<%= blockFilename %>', $this->get_assets_path_url( 'templates/styles/<%= blockFilename %>.min.css' ), ['assets-style'], self::VERSION );<% if (include_script) { %>
|
|
||||||
wp_enqueue_script( 'block-<%= blockFilename %>', $this->get_assets_path_url( 'templates/scripts/<%= blockFilename %>.min.js' ), ['assets-script'], self::VERSION, true );<% } %>
|
|
||||||
|
|
||||||
wp_enqueue_script( 'script-block-<%= blockFilename %>' );
|
|
||||||
}<% } %>
|
|
||||||
<% if (include_acf_block) { %> function register_acf_block() {
|
|
||||||
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [
|
|
||||||
'style_assets' => [
|
|
||||||
[
|
|
||||||
'name' => '<%= blockFilename %>',
|
|
||||||
'url' => $this->get_assets_path_url( 'templates/styles/<%= blockFilename %>.min.css' ),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'script_assets' => [
|
|
||||||
[
|
|
||||||
'name' => '<%= blockFilename %>',
|
|
||||||
'url' => $this->get_assets_path_url( 'templates/scripts/<%= blockFilename %>.min.js' ),
|
|
||||||
]
|
|
||||||
]
|
|
||||||
] );
|
|
||||||
}
|
|
||||||
<% } %><% if (include_native_gutenberg_block) { %> function register_native_gutenberg_block() {
|
|
||||||
register_block_type( __DIR__ . '/templates/gutenberg-block/block.json' );<% if (include_script) { %>
|
|
||||||
|
|
||||||
add_action( 'wp_enqueue_scripts', function () {
|
|
||||||
$asset_file_front = include( plugin_dir_path( __FILE__ ) . '/templates/gutenberg-block/build/front.asset.php' );
|
|
||||||
wp_enqueue_script(
|
|
||||||
'gutenberg-<%= blockFilename %>-scripts-front',
|
|
||||||
$this->get_assets_path_url( 'templates/gutenberg-block/build/front.js' ),
|
|
||||||
$asset_file_front['dependencies'],
|
|
||||||
$asset_file_front['version'],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} );<% } %>
|
|
||||||
}<% } %>
|
|
||||||
}
|
|
||||||
|
|
||||||
<%= blockClassModel %>_Component::get_instance();
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>\Helpers;
|
|
||||||
|
|
||||||
class <%= blockClassModel %>_API {
|
|
||||||
|
|
||||||
static function prepare_args( $args = [] ) {
|
|
||||||
|
|
||||||
// $args = array_merge( [], $args );
|
|
||||||
|
|
||||||
return $args;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>\Helpers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Component's default args.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class <%= blockClassModel %>_Defaults {
|
|
||||||
public static function default_args(): array {
|
|
||||||
$args = <%- defaultData %>;
|
|
||||||
|
|
||||||
// $args['base_url'] = \Core\Global_Functions::get_file_url( __DIR__ . '/../templates/' );
|
|
||||||
|
|
||||||
return $args;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>\Helpers;
|
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>\Helpers;
|
||||||
|
|
||||||
class <%= blockClassModel %>_Elementor_Widget extends \Elementor\Widget_Base {
|
class <%= blockClassModel %>_Elementor_Widget extends \Elementor\Widget_Base {
|
||||||
|
use \Core\Traits\Elementor_Widget;
|
||||||
|
|
||||||
const PLUGIN_NAME = '<%= blockFilename %>';
|
const PLUGIN_NAME = '<%= blockFilename %>';
|
||||||
|
|
||||||
public function get_name() {
|
public function get_name() {
|
||||||
@@ -35,12 +37,8 @@ class <%= blockClassModel %>_Elementor_Widget extends \Elementor\Widget_Base {
|
|||||||
|
|
||||||
$component = new \AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>\<%= blockClassModel %>_Component();
|
$component = new \AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>\<%= blockClassModel %>_Component();
|
||||||
|
|
||||||
$args = self::prepare( $settings );
|
$args = $this->prepare( $settings );
|
||||||
$component->render( $args );
|
$component->render( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function prepare( $args ): array {
|
|
||||||
// Prepare $args for render function.
|
|
||||||
return $args;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ const __filename = fileURLToPath(import.meta.url);
|
|||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
export async function buildWordPress(blockName, args = {}) {
|
export async function buildWordPress(blockName, args = {}) {
|
||||||
const isBlock = args.platform === 'wordpress-acf-block';
|
|
||||||
const isElementor = args.platform === 'wordpress-elementor';
|
|
||||||
const isComponentManager = args.platform === 'wordpress-component-manager'
|
|
||||||
|
|
||||||
const {modulesPath, projectPath} = getConfigs();
|
const {modulesPath, projectPath} = getConfigs();
|
||||||
|
|
||||||
const distPath = path.join(projectPath, 'exports', args.platform);
|
const distPath = path.join(projectPath, 'exports', args.platform);
|
||||||
@@ -37,12 +33,7 @@ export async function buildWordPress(blockName, args = {}) {
|
|||||||
ownerClass: owner.replace(/ /ig, '_'),
|
ownerClass: owner.replace(/ /ig, '_'),
|
||||||
ownerFilename: owner.toLowerCase().replace(/ /ig, '-'),
|
ownerFilename: owner.toLowerCase().replace(/ /ig, '-'),
|
||||||
templateFormat: 'php',
|
templateFormat: 'php',
|
||||||
include_acf_block: isBlock,
|
|
||||||
include_native_gutenberg_block: false,
|
|
||||||
include_script: true,
|
include_script: true,
|
||||||
include_elementor_widget: isElementor,
|
|
||||||
isElementor,
|
|
||||||
isComponentManager,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await copyFile(blockFilePath, path.join(distPath, data.blockFilename + '.block.json'));
|
await copyFile(blockFilePath, path.join(distPath, data.blockFilename + '.block.json'));
|
||||||
@@ -84,49 +75,21 @@ export async function buildWordPress(blockName, args = {}) {
|
|||||||
json: await readJSONFile(path.join(projectPath, 'data', 'default.json'), "utf8"),
|
json: await readJSONFile(path.join(projectPath, 'data', 'default.json'), "utf8"),
|
||||||
});
|
});
|
||||||
|
|
||||||
// await createFiles(Object.assign({}, data, {defaultData: phpDataObject}), [{
|
await createFiles(data, [{
|
||||||
// from: `templates/helpers/Template_Defaults.php`,
|
from: `templates/helpers/Template_Elementor_Widget.php`,
|
||||||
// to: `helpers/${data.blockClassModel}_Defaults.php`,
|
to: `helpers/${data.blockClassModel}_Elementor_Widget.php`,
|
||||||
// }], {
|
}], {
|
||||||
// pathDist: distPath,
|
pathDist: distPath,
|
||||||
// generatorsPath: path.join(__dirname),
|
generatorsPath: path.join(__dirname)
|
||||||
// });
|
});
|
||||||
|
|
||||||
if (isElementor) {
|
await createFiles(data, [{
|
||||||
await createFiles(data, [{
|
from: `templates/Template_Basic_Component.php`,
|
||||||
from: `templates/helpers/Template_Elementor_Widget.php`,
|
to: `${data.blockClassModel}_Component.php`,
|
||||||
to: `helpers/${data.blockClassModel}_Elementor_Widget.php`,
|
}], {
|
||||||
}], {
|
pathDist: distPath,
|
||||||
pathDist: distPath,
|
generatorsPath: path.join(__dirname)
|
||||||
generatorsPath: path.join(__dirname)
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isBlock) {
|
|
||||||
await createFiles(data, [{
|
|
||||||
from: `templates/Template_Component.php`,
|
|
||||||
to: `${data.blockClassModel}_Component.php`,
|
|
||||||
}], {
|
|
||||||
pathDist: distPath,
|
|
||||||
generatorsPath: path.join(__dirname)
|
|
||||||
});
|
|
||||||
|
|
||||||
// await createFiles(data, [{
|
|
||||||
// from: `templates/helpers/Template_API.php`,
|
|
||||||
// to: `helpers/${data.blockClassModel}_API.php`,
|
|
||||||
// }], {
|
|
||||||
// pathDist: distPath,
|
|
||||||
// generatorsPath: path.join(__dirname)
|
|
||||||
// });
|
|
||||||
} else {
|
|
||||||
await createFiles(data, [{
|
|
||||||
from: `templates/Template_Basic_Component.php`,
|
|
||||||
to: `${data.blockClassModel}_Component.php`,
|
|
||||||
}], {
|
|
||||||
pathDist: distPath,
|
|
||||||
generatorsPath: path.join(__dirname)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function execCommand(cmd = '') {
|
export function execCommand(cmd = '') {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import {
|
|||||||
import PluginError from 'plugin-error';
|
import PluginError from 'plugin-error';
|
||||||
import {Server} from "socket.io";
|
import {Server} from "socket.io";
|
||||||
import {createServer} from 'http';
|
import {createServer} from 'http';
|
||||||
import {authtoken, connect} from "ngrok";
|
// import {authtoken, connect} from "ngrok";
|
||||||
import bodyParser from "body-parser";
|
import bodyParser from "body-parser";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -569,8 +569,8 @@ async function getShareableUrl() {
|
|||||||
|
|
||||||
let url;
|
let url;
|
||||||
try {
|
try {
|
||||||
await authtoken(data.ngrokApiToken);
|
// await authtoken(data.ngrokApiToken);
|
||||||
url = await connect(port);
|
// url = await connect(port);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error:', `Can't connect to ngrok, probably wrong token.`);
|
console.log('Error:', `Can't connect to ngrok, probably wrong token.`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user