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