Updated "export" logic on WordPress/PHP platforms.
This commit is contained in:
@@ -13,3 +13,4 @@ blocks
|
|||||||
config
|
config
|
||||||
data
|
data
|
||||||
src
|
src
|
||||||
|
exports
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class buildGenerator extends Generator {
|
|||||||
type: "list",
|
type: "list",
|
||||||
name: "platform",
|
name: "platform",
|
||||||
message: "Choose Platform",
|
message: "Choose Platform",
|
||||||
choices: ['WordPress', 'Hubspot', 'JavaScript', 'PHP'],
|
choices: ['WordPress', 'Hubspot', 'Hubspot Email', 'JavaScript', 'PHP'],
|
||||||
default: 'WordPress'
|
default: 'WordPress'
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-block-dev-tool",
|
"name": "create-block-dev-tool",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-block-dev-tool",
|
"name": "create-block-dev-tool",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "component-dev",
|
"start": "component-dev",
|
||||||
"dev": "NODE_ENV=development node server.js",
|
"dev": "NODE_ENV=development node server.js",
|
||||||
|
|||||||
+17
-4
@@ -3,7 +3,6 @@
|
|||||||
// Composer - Autoloader
|
// Composer - Autoloader
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
use JetBrains\PhpStorm\NoReturn;
|
|
||||||
use LightnCandy\Flags;
|
use LightnCandy\Flags;
|
||||||
use LightnCandy\LightnCandy;
|
use LightnCandy\LightnCandy;
|
||||||
|
|
||||||
@@ -61,9 +60,23 @@ class Component_Builder {
|
|||||||
$this->register_default_handlebar_helpers();
|
$this->register_default_handlebar_helpers();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[NoReturn]
|
function build(): void {
|
||||||
function build() {
|
$root_path = __DIR__ . '/' . $this->module_path . '../..';
|
||||||
$file_name = $this->get_handlebars_template( __DIR__ . '/' . $this->module_path . '/../../src/' . $this->component_name . '.template.hbs' );
|
$file_name = $this->get_handlebars_template( "$root_path/src/$this->component_name.template.hbs" );
|
||||||
|
|
||||||
|
$output_folder = $root_path . '/exports/wordpress/templates';
|
||||||
|
foreach ( [ 'styles', 'scripts', 'images' ] as $dir ) {
|
||||||
|
$output_dir = "$output_folder/$dir";
|
||||||
|
if ( is_dir( $output_dir ) === false ) {
|
||||||
|
mkdir( $output_dir, 0777, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rename( $file_name, "$output_folder/$this->component_name.template.php" );
|
||||||
|
copy( "$root_path/src/styles/$this->component_name.min.css", "$output_folder/styles/$this->component_name.min.css" );
|
||||||
|
copy( "$root_path/src/scripts/$this->component_name.min.js", "$output_folder/scripts/$this->component_name.min.js" );
|
||||||
|
shell_exec( "cp -r $root_path/src/images $output_folder" );
|
||||||
|
|
||||||
echo "Generated '$file_name'.";
|
echo "Generated '$file_name'.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user