? NPM Resource Changed PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
14 Apr 2023

Summary of Changes

Add a posibility to mark asset as Deprecated, with optional description
See joomla/schemas#15

Testing Instructions

Apply patch.
Edit media/system/joomla.asset.json, add to "core" asset:

"deprecated": true,
"deprecatedMsg": "The deprecation testing"

Enable Debug, and deprecation loging.
Open any page, and check the logs.

Actual result BEFORE applying this Pull Request

Nothing

Expected result AFTER applying this Pull Request

There should be an message of deprecated asset "core"

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed
avatar joomla-cms-bot joomla-cms-bot - change - 14 Apr 2023
Category Libraries
avatar Fedik Fedik - open - 14 Apr 2023
avatar Fedik Fedik - change - 14 Apr 2023
Status New Pending
avatar wilsonge
wilsonge - comment - 14 Apr 2023

Just checking that this shows up in the debug plugin - as we're already in the renderer.

avatar Fedik
Fedik - comment - 14 Apr 2023

Should be there, at least was in my test :)
All data in debug plugin is collected onAfterRespond.

avatar richard67
richard67 - comment - 17 Apr 2023

We already have a use case for this PR. When it will be merged, we would have to add the deprecated flag and string to the 2 assets here: https://github.com/joomla/joomla-cms/blob/4.3-dev/build/media_source/com_templates/joomla.asset.json#L8-L31

They had been restored with my PR #39431 in the 4.3-dev branch, and in 5.0-dev they have will deleted when my PR #40302 gets merged, so the deprecation message would be for 5.0, or for 6.0 if my PR gets postponed until 6.0.

Maybe it would make sense to add that deprecation for the 2 assets to this PR here, so it can be tested with that use case?

avatar joomla-cms-bot joomla-cms-bot - change - 17 Apr 2023
Category Libraries Repository NPM Change Libraries
avatar Fedik Fedik - change - 17 Apr 2023
Labels Added: ? PR-4.4-dev
avatar Fedik
Fedik - comment - 17 Apr 2023

Added :)

avatar richard67
richard67 - comment - 17 Apr 2023

@Fedik A question regarding dependencies: Does the "dependencies": ["com_templates.admin-template-compare.es5"], of the "com_templates.admin-template-compare" asset mean that the "com_templates.admin-template-compare.es5" depends on the "com_templates.admin-template-compare"? In this case your last change would be right. Or does it mean that the "com_templates.admin-template-compare" depends on "com_templates.admin-template-compare.es5"? In this case you maybe should have added the deprecation to the "es5". Or am I completely wrong?

avatar Fedik
Fedik - comment - 17 Apr 2023

Ignore that dependency. In this case all .es5 scripts is a fallbacks for older browsers, they all will gone on Joomla 5 #39618

avatar richard67
richard67 - comment - 17 Apr 2023

@Fedik But just for my understanding: Which one depends on which other one in that case?

avatar Fedik
Fedik - comment - 17 Apr 2023

of the "com_templates.admin-template-compare" asset mean that the "com_templates.admin-template-compare.es5" depends on the "com_templates.admin-template-compare"?

It is vice versa, com_templates.admin-template-compare depend from com_templates.admin-template-compare.es5

But, in current case they work each "stand alone", no real dependency.

The depndency here means when User use com_templates.admin-template-compare then the AssetManager will also load com_templates.admin-template-compare.es5.
Then in modern Browser will be executed only com_templates.admin-template-compare script,
and in old only com_templates.admin-template-compare.es5 script.

avatar richard67
richard67 - comment - 17 Apr 2023

@Fedik So with your change users of old and new browsers both will cause the deprecated message in the log?

avatar Fedik
Fedik - comment - 17 Apr 2023

Only com_templates.admin-template-compare will cause the deprecated message in the log.
Because com_templates.admin-template-compare.es5 should not be used as stand alone asset.

When we delete blabla-script, we also delete blabla-script.es5 (if there any). No reason to spam deprecation log, it is already huge ;)

But yes, both users wil see that message.

avatar richard67 richard67 - test_item - 17 Apr 2023 - Tested successfully
avatar richard67
richard67 - comment - 17 Apr 2023

I have tested this item successfully on 37c8839

I've successfully tested this PR as follows:

I've created an override in the Atum template for the "administrator/components/com_templates/tmpl/template/default.php" file.

Then I have added a line ->useScript('com_templates.admin-template-compare') before line 32 of the override file "administrator/templates/atum/html/com_templates/template/default.php".

Then with the PR applied I have verified that whenever I open the file editor view of the template manager, the deprecated message added by this PR to the asset is correctly logged in the "administrator/logs/deprecated.php" and also shown in the "Deprecated" tab of the debug bar if debug is enabled.

Finally I have verified that the new deprecated log does not happen when "Log deprecated" is switched off.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40385.

avatar laoneo laoneo - change - 24 Apr 2023
Labels Added: NPM Resource Changed
avatar laoneo laoneo - change - 28 Apr 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-04-28 10:55:18
Closed_By laoneo
avatar laoneo laoneo - close - 28 Apr 2023
avatar laoneo laoneo - merge - 28 Apr 2023
avatar laoneo
laoneo - comment - 28 Apr 2023

Thanks!

Add a Comment

Login with GitHub to post a comment