From f61d09219fd5cdc91fc675d3e22305fe5b02ebf3 Mon Sep 17 00:00:00 2001 From: Beda Schmid Date: Wed, 29 May 2024 17:52:08 +0700 Subject: [PATCH] Add Local Build Script, Update README and CHANGELOG ### Added - New local build script for creating a zip of the project. - Instructions in README for handling placeholder strings and potential permission errors. ### Changed - Updated CHANGELOG to include the addition of the new build script. --- CHANGELOG.md | 16 +--------------- README.md | 7 +++++-- bin/local_build.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 17 deletions(-) create mode 100755 bin/local_build.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index ede5ef5..827fdaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,21 +4,6 @@ All notable changes to _this project_ will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 2024-05-29 -- [Added]: New paths in the release workflow file -- [Added]: Additional properties and methods to Base_Metabox class for better flexibility -- [Changed]: Updated minimum PHP version requirement to 8.0.0 -- [Changed]: Updated minimum WordPress version requirement to 4.0 -- [Changed]: Refactored how metaboxes are registered and saved, improving code clarity -- [Changed]: Renamed keys for shortcodes, taxonomies, and custom post types using a configurable slug -- [Changed]: Replaced specific metabox class with a more generic example -- [Fixed]: Incorrect author information in several files -- [Removed]: Unused function imports across multiple files - -## ## 2024-05-26 -- [Fixed] Properly initialise WP_Filesystem -- [Fixed] Use HTML file extension for resouurce files - This is NOT the changelog of the WordPress Plugin you ultimately develop! ## [v5-alpha] - 2024-05-29 @@ -26,6 +11,7 @@ This is NOT the changelog of the WordPress Plugin you ultimately develop! ### Added - New paths in the release workflow file. - Additional properties and methods to Base_Metabox class for better flexibility. +- New .sh script to build local release. ### Changed - Updated minimum PHP version requirement to 8.0.0. diff --git a/README.md b/README.md index 61568fd..8f03294 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ For detailed documentation on the Plugin usage and Development processes, please _Until Wiki is online_ - to manage and release a plugin with this repo/clone of - clone/fork this entire repo. Make sure to give the repo the exact name you will want for your _plugin_ (such as `my-awesome-plugin`). The release workflows will use that to zip up your built releases. + - src/replace all strings that are placeholders - your _plugin_ will be whatever is inside the root `src` folder. The rest of the root content is NOT part of your plugin, but part of your dev env and workflow - develop your plugin by making changes to anything inside the root `src` folder - if you need other dependencies add them to the composer file, remove composer lock, and run `composer install` @@ -50,10 +51,12 @@ _Until Wiki is online_ ==> IF you run autoloader manually locally to maybe test your plugin, keep in mind to search-replace the `/src/src/` > `/src/` in the `/src/vendor/composer` files to guarantee no errors. _This step is done for you if you use the release workflow_. - Of course, if this is all too much for you, feel free to just extract `src` contents and use that as your repo, this is entirely up to you. -==> `/bin` includes other helpful scripts to generate documentation of your _plugin_ as well as convert documents from a to another format +==> `/bin` includes other helpful scripts to generate documentation of your _plugin_ as well as convert documents from a to another format or build a local copy of the plugin (useful for testing ;) + +==> If running into 403 errors when releasing, make sure workflows have write permission on your repo +==> if you .sh files return a permission error, run `chmod +x {FILE}.sh` # Credits diff --git a/bin/local_build.sh b/bin/local_build.sh new file mode 100755 index 0000000..6e4f583 --- /dev/null +++ b/bin/local_build.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Navigate to the parent directory to ensure we are at the project root +cd .. + +# Get the name of the current directory (which should be the repository name) +REPO_NAME=$(basename "$(pwd)") + +# Install dependencies and dump autoload +composer install --no-dev --optimize-autoloader + +# Make replacements in composer autoload files +sed -i '' 's|src/src|src|g' src/vendor/composer/autoload_classmap.php +sed -i '' 's|src/src|src|g' src/vendor/composer/autoload_static.php +sed -i '' 's|\.\./\.\./\.\.|../..|g' src/vendor/composer/autoload_static.php + +# Prompt for output directory +read -p "Enter the output directory for the built zip: " OUTPUT_DIR +mkdir -p "../$OUTPUT_DIR" # Create the directory if it does not exist + +# Create the zip +cd src # Change to src directory to zip its contents +zip -r "$OUTPUT_DIR/$REPO_NAME.zip" ./* # Zip all contents of src directly +cd .. # Go back to the root directory + +# Confirmation of build +echo "Build complete. Zip file located at: $OUTPUT_DIR/$REPO_NAME.zip" + +# Navigate back to the bin directory to maintain the initial script execution state +cd bin \ No newline at end of file