Open devuri opened 7 months ago
Convert Command:
convert.json
to transform a standard WordPress setup into a specified framework structure (e.g., wpenv-framework
).convert.json
.Revert Command:
revert.json
to restore the WordPress installation to its original state before conversion.General:
convert.json
and revert.json
FilesThis is to establish the initial specifications for the convert.json
and revert.json
configuration files that will be used to guide the conversion and reversion processes in the Nino CLI tool. Please note that these specifications are considered draft and subject to change as we refine the feature.
The convert.json
and revert.json
files play a crucial role in defining how the Nino CLI tool converts between different WordPress configurations and reverts changes. Establishing clear and comprehensive specifications for these files is essential to ensure consistency and user-friendliness.
convert.json
:{
"name": "Standard to WPEnv-Framework Conversion",
"description": "Converts a standard WordPress installation to the WPEnv-Framework structure.",
"create": [
{ "directory": ".snapshot", "description": "Directory for snapshots" },
{ "directory": "public", "description": "Web server root directory" },
{ "directory": "public/app/uploads", "description": "WordPress uploads directory" },
{ "directory": "public/app/templates", "description": "Custom themes directory" },
{ "directory": "public/mu-plugins", "description": "Must-use plugins directory" },
{ "directory": "public/plugins", "description": "WordPress plugins directory" },
{ "directory": "public/wp", "description": "WordPress core files" },
{ "directory": "storage/cache", "description": "Cache directory" },
{ "directory": "storage/logs/wp-errors", "description": "WordPress error logs" },
{ "directory": "vendor", "description": "Composer dependencies" }
],
"migrate": [
{ "from": "wp-content/uploads", "to": "public/app/uploads" },
{ "from": "wp-content/themes", "to": "public/app/templates" },
{ "from": "wp-content/mu-plugins", "to": "public/mu-plugins" },
{ "from": "wp-content/plugins", "to": "public/plugins" },
{ "from": "wp-admin", "to": "public/wp/wp-admin" },
{ "from": "wp-includes", "to": "public/wp/wp-includes" }
],
"files": [
{ "name": ".env", "source": "wp-config.php", "transformation": "convert_credentials_to_env" },
{ "name": "public/.htaccess", "source": ".htaccess" },
{ "name": "public/index.php", "source": "index.php", "permissions": "444" },
{ "name": "public/wp-config.php", "source": "wp-config.php", "permissions": "444" }
],
"cleanup": [
"wp-content",
"wp-admin",
"wp-includes",
".htaccess",
"index.php",
"wp-config.php"
]
}
Name and Description:
name
: A brief but descriptive name for the configuration.description
: An informative description of the configuration's purpose and impact.Create Directories:
directory
: The path to the directory to be created.description
: A brief description of the directory's purpose.Migrate Files and Directories:
from
: The source path.to
: The destination path.description
: A brief description of the migration.File Transformations:
name
: The name of the target file.source
: The source file or data to transform from.transformation
: A reference to a transformation method or logic.description
: A brief description of the transformation.Cleanup:
revert.json
:The revert.json
should facilitate the reversion of the wpenv-framework
structure back to a standard WordPress setup. This involves moving core files and directories back to their original locations and removing wpenv-framework
specific directories.
{
"name": "WPEnv-Framework to Standard WordPress Reversion",
"description": "Reverts the WPEnv-Framework structured WordPress back to the standard setup.",
"recreate": [
{ "directory": "wp-content/uploads", "from": "public/app/uploads" },
{ "directory": "wp-content/themes", "from": "public/app/templates" },
{ "directory": "wp-content/mu-plugins", "from": "public/mu-plugins" },
{ "directory": "wp-content/plugins", "from": "public/plugins" }
],
"restore": [
{ "from": "public/wp/wp-admin", "to": "wp-admin" },
{ "from": "public/wp/wp-includes", "to": "wp-includes" }
],
"files": [
{ "name": ".htaccess", "source": "public/.htaccess" },
{ "name": "index.php", "source": "public/index.php", "permissions": "444" },
{ "name": "wp-config.php", "source": "public/wp-config.php", "permissions": "444", "transformation": "revert_env_to_wpconfig" }
],
"cleanup": [
".snapshot",
"public",
"storage",
"vendor",
".env",
"app.php",
"bootstrap.php",
"composer.json",
"config.php"
]
}
Name and Description:
name
: A brief but descriptive name for the configuration.description
: An informative description of the configuration's purpose and impact.Recreate Directories:
directory
: The path to the directory to be recreated.from
: The source path in the converted structure.description
: A brief description of the directory's purpose.Restore Files and Directories:
from
: The source path in the converted structure.to
: The destination path in the standard WordPress structure.description
: A brief description of the restoration.File Transformations:
name
: The name of the target file.source
: The source file or data to transform from.transformation
: A reference to a transformation method or logic.description
: A brief description of the transformation.Cleanup:
These specifications are in the draft stage and may evolve as the feature is developed and tested.
Draft for Feature Request
This document outlines the convert
and revert
commands for the Nino CLI tool, designed to streamline WordPress conversion management.
convert.json
and revert.json
are properly configured to reflect the desired WordPress setup and blueprint.Standard Conversion: php nino convert --standard
convert.json
for structure validation.Framework Conversion: php nino convert --framework
convert.json
..env
file.php nino revert
revert.json
, including file and directory structures.convert.json
and revert.json
before executing commands.WP_HOME
setting.
Summary
Introduce two new commands,
convert
andrevert
, to the Nino CLI tool to automate the process of transitioning WordPress installations between standard andwpenv-framework
structures, ensuring seamless backups and minimal downtime.Description
The Nino CLI tool currently lacks the capability to efficiently manage WordPress installations in various configurations. This proposal suggests adding
convert
andrevert
commands to facilitate easy transitions between a standard WordPress setup and a more structuredwpenv-framework
setup, tailored for developers and agencies managing multiple WordPress sites. These commands will leverageconvert.json
andrevert.json
configurations to guide the conversion and reversion processes, ensuring a smooth, automated workflow that includes necessary backups and validation checks.Goals
wpenv-framework
structure as defined inconvert.json
, with pre-conversion backups.wpenv-framework
structured installation back to standard WordPress, usingrevert.json
for guidance, including backup creation.convert.json
andrevert.json
, and best practices for using the new commands.Technical Considerations
Impact
This feature will significantly enhance the Nino CLI's utility for WordPress developers and site managers, offering a streamlined process for managing site configurations, reducing manual errors, and improving deployment efficiency.
Next Steps
convert.json
andrevert.json
.