diff --git a/.github/workflows/built-release.yml b/.github/workflows/built-release.yml new file mode 100644 index 0000000..9da461d --- /dev/null +++ b/.github/workflows/built-release.yml @@ -0,0 +1,14 @@ +name: Built Release + +on: + push: + branches: + - develop + - main + - production + +jobs: + built-release: + uses: alleyinteractive/.github/.github/workflows/built-release.yml@main + with: + node: 16 diff --git a/CHANGELOG.md b/CHANGELOG.md index caa8039..5055258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log This project adheres to [Semantic Versioning](http://semver.org/). +## 1.4.0 + +* Migrates code into the `Alley\WP\Asset_Manager` namespace. Legacy classes such + as `Asset_Manager_Scripts` and `Asset_Manager_Styles` are aliased to their new + namespace for backward compatibility. Helper functions are left un-namespaced. +* Adds a dependency on Composer autoloader. For submodules, you can track the + `production-built` branch of the plugin or any tagged release (which will be + built) to include the dependencies. + ## 1.3.6 * Adds support for running the plugin on a Windows hosting environment (#57) diff --git a/asset-manager.php b/asset-manager.php index 1b316ff..d1ab338 100644 --- a/asset-manager.php +++ b/asset-manager.php @@ -7,16 +7,6 @@ * @package AssetManager */ -/* -Plugin Name: Asset Manager -Plugin URI: https://github.com/alleyinteractive/wp-asset-manager -Description: Add more robust functionality to enqueuing static assets -Author: Alley Interactive -Version: 1.4.0 -License: GPLv2 or later -Author URI: https://www.alleyinteractive.com/ -*/ - /** * Filesystem path to AssetManager. */ @@ -28,14 +18,14 @@ } else { add_action( 'admin_notices', - function() { + function () { ?>
@@ -54,7 +44,7 @@ class_alias( \Alley\WP\Asset_Manager\Preload::class, 'Asset_Manager_Preload' ); class_alias( \Alley\WP\Asset_Manager\SVG_Sprite::class, 'Asset_Manager_SVG_Sprite' ); // Require the helpers that are used to interact with the plugin. -require_once __DIR__ . '/inc/helpers.php'; +require_once __DIR__ . '/src/helpers.php'; /** * Map plugin meta capabilities. diff --git a/composer.json b/composer.json index 2370b34..324ec2f 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "extra": { "wordpress-autoloader": { "autoload": { - "Alley\\WP\\Asset_Manager\\": "inc/" + "Alley\\WP\\Asset_Manager\\": "src/" }, "autoload-dev": { "Alley\\WP\\Asset_Manager\\Tests\\": "tests/" diff --git a/package.json b/package.json new file mode 100644 index 0000000..a99ba29 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "@alleyinteractive/wp-asset-manager", + "version": "1.4.0", + "description": "Asset Manager is a toolkit for managing front-end assets and more tightly controlling where, when, and how they're loaded.", + "scripts": { + "build": "echo 'No build step defined'", + "release": "npx @alleyinteractive/create-release@latest" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/alleyinteractive/wp-asset-manager.git" + }, + "author": "", + "license": "GPL-2.0+", + "bugs": { + "url": "https://github.com/alleyinteractive/wp-asset-manager/issues" + }, + "homepage": "https://github.com/alleyinteractive/wp-asset-manager#readme" +} diff --git a/inc/class-asset-manager.php b/src/class-asset-manager.php similarity index 100% rename from inc/class-asset-manager.php rename to src/class-asset-manager.php diff --git a/inc/class-preload.php b/src/class-preload.php similarity index 100% rename from inc/class-preload.php rename to src/class-preload.php diff --git a/inc/class-scripts.php b/src/class-scripts.php similarity index 100% rename from inc/class-scripts.php rename to src/class-scripts.php diff --git a/inc/class-styles.php b/src/class-styles.php similarity index 100% rename from inc/class-styles.php rename to src/class-styles.php diff --git a/inc/class-svg-sprite.php b/src/class-svg-sprite.php similarity index 96% rename from inc/class-svg-sprite.php rename to src/class-svg-sprite.php index 6d57b18..3e8c570 100644 --- a/inc/class-svg-sprite.php +++ b/src/class-svg-sprite.php @@ -8,7 +8,8 @@ namespace Alley\WP\Asset_Manager; use DOMDocument; - +use DOMElement; +use DOMText; /** * Asset_Manager_SVG_Sprite class. @@ -22,21 +23,21 @@ class SVG_Sprite { * * @var string */ - public static $_svg_directory; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore + public static ?string $_svg_directory; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore /** * Array for attributes to add to each symbol. * * @var array */ - public static $_global_attributes; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore + public static ?array $_global_attributes; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore /** * The sprite document. * * @var DOMDocument */ - public $sprite_document; + public DOMDocument $sprite_document; /** * The sprite document. @@ -57,14 +58,14 @@ class SVG_Sprite { * * @var array */ - public $sprite_map = []; + public array $sprite_map = []; /** * Allowed tags and attributes for echoing