Updater script for the SkyVerge WooCommerce plugin framework.
This script helps facilitate updating the framework package, which involves replacing class namespaces throughout the code base.
Include this package as a dev dependency:
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/godaddy-wordpress/wc-plugin-framework"
    },
    {
      "type": "vcs",
      "url": "https://github.com/godaddy-wordpress/wc-plugin-framework-updater"
    }
  ],
  "require" : {
    "skyverge/wc-plugin-framework": "5.15.5"
  },
  "require-dev": {
    "skyverge/wc-plugin-framework-updater": "dev-main"
  }
}
- First update the framework itself to your desired version:
composer update skyverge/wc-plugin-framework
- Then run the migration script:
./vendor/skyverge/wc-plugin-framework-updater/update.sh
Note: You will need to have the jq utility installed on your local machine to run update.sh.
You can set this up to run automatically after Composer packages are updated. Update your composer.json file like so:
{
  "scripts": {
    "post-package-update": [
      "if [ -f ./vendor/skyverge/wc-plugin-framework-updater/update.sh ]; then ./vendor/skyverge/wc-plugin-framework-updater/update.sh; fi"
    ]
  }
}Then all you have to do is update the framework:
composer update skyverge/wc-plugin-framework
The updater script will then run automatically.
NOTE: It will run after any package is updated, but will exit if it detects that the framework version has not changed.
The script does the following:
- Parses the old version from your declared FRAMEWORK_VERSIONconstant.
- Parses the new version from the framework's composer.jsonfile (which is why you must update the framework itself first!).
- Replaces all instances of v1_2_3(where1_2_3is the old version) withv_4_5_6(where4_5_6is the new version). This change is made in PHP and JS files only.- Excludes node_modules/
- Excludes vendor/
 
- Excludes 
- Updates the FRAMEWORK_VERSIONconstant number.
By default running the script will modify files in the current working directory. If you need to specify a different directory then pass it in as the first argument. Examples:
Absolute path:
./vendor/skyverge/wc-plugin-framework-updater/update.sh /path/to/your/plugin
Relative path:
./vendor/skyverge/wc-plugin-framework-updater/update.sh ./plugin/