-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/init command #14
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactor code to pass command line arguments to getConfig This change better organizes command line argument handling, by moving it from 'lib/utils.js' to 'lib/index.js'. This allows us to remove the dependence of the 'lib/utils.js' module on the 'yargs' package. This transition to explicitly pass command line arguments to the getConfig function enhances modularity and the cleanliness of our codebase. Moreover, similar changes were made to tests to reflect this change. Furthermore, we started to export WordPressInstaller using module.exports for consistency.
Added new file `dump.js` for creating and saving a JSON dump of a WordPress configuration. This includes information about the WordPress version, installed themes and plugins. The dumped configuration is saved in a `wp-package.json` file in the root directory. This feature enables the user to easily retrieve and check the details of their WordPress configuration.
Refactored the `init.js` file for a simplified setup process of WordPress projects. Renamed `init` class to `Initialize` and replaced `installer` parameter with `options` to allow custom configuration during construction. Modified `init` method to `generateConfig` to better reflect its functionality. Also added default WordPress configuration options and added error handling for pre-existing configuration files. This change provides more flexibility in project setup, easier adaptation for different environments, and a standardized way to setup WordPress configuration.
Introduced new module fs.js with multiple utility functions to handle file system operations such as creating directories, renaming folders, downloading files, and extracting zip files. These operations are essential for various process like setting up environments, downloading dependencies or cleaning up temporary files.
Modified file structures as the 'utils.js' and 'fs.js' files both contained functions related to file system operations, causing confusion. Moved all the file system related functions into 'fs.js', making the roles of 'utils.js' (holding the utility functions) and 'fs.js' (handling the filesystem operations) distinct. Additionally, renamed 'WordPressConfigInitializer' to 'Initialize' and added new function 'printTimePassed' for reusable time logging. Also replaced the 'init' function with 'dump' and 'initialize' functions to make the code more understandable and manage specific tasks separately.
The diff represents several updates across the codebase. Reorganized 'scripts' in 'package.json' for better readability and further separation of concerns by adding the 'docs' command. Introduced a 'postInstall' property in 'wp-package.json'. Refactored 'lib/index.js' by wrapping actions within an object, which allows selection of the appropriate action based on the provided argv key. It improves code readability and maintainability whilst keeping the intent of the original code. In 'lib/package.js', reorganization of the 'require' statements was made. Reordered them to better reflect their execution sequence. 'Rename' command used to better align with the language used in rest of the code. The renaming of 'lib/init.js' to 'lib/initialize.js' helps in achieving consistency across the codebase.
gardenboi
approved these changes
Dec 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey team,
I hope this message finds you well. I wanted to bring your attention to the latest set of commits that have significantly improved our WordPress project setup and configuration processes.
I was initially thinking of just doing a command that initialized the configuration but then @gardenboi got me thinking that, like npm init, it would be nice to have a command to do the same with the wp-package.json file
--dump
for creating and saving a JSON dump of a WordPress configuration. This includes information about the WordPress version, installed themes and plugins. The dumped configuration is saved in awp-package.json
file in the root directory. This feature enables the user to easily retrieve and check the details of their WordPress configuration.--init
for a simplified setup process of WordPress projects. Renamedinit
class toInitialize
and replacedinstaller
parameter withoptions
to allow custom configuration during construction. Modifiedinit
method togenerateConfig
to better reflect its functionality. Also added default WordPress configuration options and added error handling for pre-existing configuration files. This change provides more flexibility in project setup, easier adaptation for different environments, and a standardized way to setup WordPress configuration.Here's a brief overview of the recent changes:
Init command
getConfig
in 'lib/index.js'.WordPressInstaller
usingmodule.exports
for consistency.WordPress Configuration Dump Tool
dump.js
, to create and save a JSON dump of a WordPress configuration.wp-package.json
file in the root directory.Refactoring init.js for WordPress Setup Configuration
init
class toInitialize
for clarity.installer
parameter withoptions
for custom configuration during construction.init
method togenerateConfig
for better functionality representation.New Utility Functions for File System Operations
fs.js
, with utility functions for various file system operations.Code Readability and Function Arrangement Improvements
close #6