From 9cbc5ea5f147c0f4b2c61c22d02e866404d152da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Tr=C3=A4nklein?= Date: Mon, 19 Oct 2020 14:10:45 +0200 Subject: [PATCH] chore(): add deprecations (#322) --- assets/scripts/ExternalScriptLoader/index.js | 1 + build-config.js | 4 ++++ gulpfile.js | 5 +++++ lib/Defaults.php | 2 +- lib/Utils/ArrayHelpers.php | 2 ++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/assets/scripts/ExternalScriptLoader/index.js b/assets/scripts/ExternalScriptLoader/index.js index f4c8e2929..eafe1b48f 100644 --- a/assets/scripts/ExternalScriptLoader/index.js +++ b/assets/scripts/ExternalScriptLoader/index.js @@ -12,6 +12,7 @@ let instance class ExternalScriptLoader { constructor () { + console.warn('ExternalScriptLoader is deprecated since version %%NEXT_VERSION%% with no alternative available.') if (!instance) { instance = this } diff --git a/build-config.js b/build-config.js index 06984d497..790fd9b32 100644 --- a/build-config.js +++ b/build-config.js @@ -88,6 +88,10 @@ module.exports = { php: { files: '!(node_modules|dist)/**/*.php', from: '%%NEXT_VERSION%%' + }, + js: { + files: '!(node_modules|dist)/**/*.js', + from: '%%NEXT_VERSION%%' } } } diff --git a/gulpfile.js b/gulpfile.js index 88eb96609..5eae3cd15 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,6 +16,11 @@ function replaceVersion (config) { for (const file of changedFilesPhp) { log(`Updated ${file}`) } + log(`Replacing ${config.replaceVersion.js.from} with ${config.replaceVersion.js.to} in all JS files.`) + const changedFilesJs = replace.sync(config.replaceVersion.js) + for (const file of changedFilesJs) { + log(`Updated ${file}`) + } // replace WordPress theme version in style.css log('Updating WordPress theme version.') diff --git a/lib/Defaults.php b/lib/Defaults.php index c86ef2659..836e189df 100644 --- a/lib/Defaults.php +++ b/lib/Defaults.php @@ -22,7 +22,6 @@ public static function renderComponent($output, $componentName, $componentData) return $output; } - // this action needs to be removed by the user if they want to overwrite this functionality public static function loadFunctionsFile($componentName) { $componentManager = ComponentManager::getInstance(); @@ -34,6 +33,7 @@ public static function loadFunctionsFile($componentName) protected static function renderFile($componentData, $filePath) { + _deprecated_function(__METHOD__, '%%NEXT_VERSION%%'); if (!is_file($filePath)) { trigger_error("Template not found: {$filePath}", E_USER_WARNING); return ''; diff --git a/lib/Utils/ArrayHelpers.php b/lib/Utils/ArrayHelpers.php index 1d1e5bad4..3b2a0ec5a 100644 --- a/lib/Utils/ArrayHelpers.php +++ b/lib/Utils/ArrayHelpers.php @@ -15,6 +15,7 @@ class ArrayHelpers */ public static function isAssoc(array $array) { + _deprecated_function(__METHOD__, '%%NEXT_VERSION%%'); // Keys of the array $keys = array_keys($array); @@ -34,6 +35,7 @@ public static function isAssoc(array $array) */ public static function indexedValuesToAssocKeys(array $array) { + _deprecated_function(__METHOD__, '%%NEXT_VERSION%%'); $values = array_map(function ($value) { return is_array($value) ? $value : []; }, $array);