PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar LadySolveig
LadySolveig
18 May 2026

Pull Request resolves #46879 (comment) .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Add method to copy the CodeMirror license file to the builder. This ensures that the required license file is included in the build output if specified in the build settings.

Build process improvements:

  • Added a copy method to CodemirrorModuleBuilder that copies the CodeMirror license file to the target location if specified in the build settings (settings.json). This method first calls the parent copy method, then checks for the license filename in the build settings, resolves its path, and copies it to the build output directory.

Testing Instructions

run npm ci

Issues are currently occurring on Windows - for testing this PR with Windows you have to wait that this PR #47793 is merged before, or apply the patch manually.
To validate the test results, please specify the operating system on which the tests were executed.

Actual result BEFORE applying this Pull Request

No LICENSE file in `media/plg_editors_codemirror

Expected result AFTER applying this Pull Request

media/plg_editors_codemirror/LICENSE is availbale in the media folder after build

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar LadySolveig LadySolveig - open - 18 May 2026
avatar LadySolveig LadySolveig - change - 18 May 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 May 2026
Category JavaScript
avatar LadySolveig LadySolveig - change - 18 May 2026
Title
fix: Add method to copy Codemirror license file to builder
[6.2] Fix: Add method to copy Codemirror license file to builder
avatar LadySolveig LadySolveig - edited - 18 May 2026
avatar LadySolveig
LadySolveig - comment - 18 May 2026

It would be great if you could take another look at this as well @dgrammatiko

avatar richard67 richard67 - test_item - 18 May 2026 - Tested successfully
avatar richard67
richard67 - comment - 18 May 2026

I have tested this item ✅ successfully on 732952d

I've successfully verified that the media/plg_editors_codemirror/LICENSE file is present after a build with this PR, which is not the case without this PR, and that there are no unexpected other differences compared to a build with the current 6.2-dev branch.


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

avatar richard67
richard67 - comment - 18 May 2026

I have tested this item ✅ successfully on 732952d

I've successfully verified that the media/plg_editors_codemirror/LICENSE file is present after a build with this PR, which is not the case without this PR, and that there are no unexpected other differences compared to a build with the current 6.2-dev branch.


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

avatar richard67
richard67 - comment - 18 May 2026

I have tested this item ✅ successfully on 732952d

I've successfully verified that the media/plg_editors_codemirror/LICENSE file is present after a build with this PR, which is not the case without this PR, and that there are no unexpected other differences compared to a build with the current 6.2-dev branch. I've tested on Linux.


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

avatar richard67
richard67 - comment - 18 May 2026

The failing system tests are not related to this PR.

avatar LadySolveig LadySolveig - change - 18 May 2026
The description was changed
avatar LadySolveig LadySolveig - edited - 18 May 2026
avatar brianteeman
brianteeman - comment - 18 May 2026

why do we need a specific method for inclufing the licence for codemirror but not for all other packages? Surely this is a bandage and not a fix to why the code that works for all other packages doesnt work for codemirror. Or is there something specific about codemirror causing this break? Its important to understand the reason so that when we introduce a new package from a new vendor in the future we know if we need to create a specific code for the licence or not

avatar richard67
richard67 - comment - 18 May 2026

why do we need a specific method for inclufing the licence for codemirror but not for all other packages? Surely this is a bandage and not a fix to why the code that works for all other packages doesnt work for codemirror. Or is there something specific about codemirror causing this break? Its important to understand the reason so that when we introduce a new package from a new vendor in the future we know if we need to create a specific code for the licence or not

@brianteeman The reason why codemirror is special here is because in our composer.json we do not have one dependency for codemirror but several, and there is no master dependency above it, so we have several source folders in node_modules but onmly one target folder in media/vendor. That's why it needs that special treatment.

avatar richard67
richard67 - comment - 18 May 2026

why do we need a specific method for inclufing the licence for codemirror but not for all other packages? Surely this is a bandage and not a fix to why the code that works for all other packages doesnt work for codemirror. Or is there something specific about codemirror causing this break? Its important to understand the reason so that when we introduce a new package from a new vendor in the future we know if we need to create a specific code for the licence or not

@brianteeman The reason why codemirror is special here is because in our package.json we do not have one dependency for codemirror but several, and there is no master dependency above it, so we have several source folders in node_modules but onmly one target folder in media/vendor. That's why it needs that special treatment.

avatar richard67
richard67 - comment - 18 May 2026

why do we need a specific method for inclufing the licence for codemirror but not for all other packages? Surely this is a bandage and not a fix to why the code that works for all other packages doesnt work for codemirror. Or is there something specific about codemirror causing this break? Its important to understand the reason so that when we introduce a new package from a new vendor in the future we know if we need to create a specific code for the licence or not

@brianteeman The reason why codemirror is special here is because in our package.json we do not have one dependency for codemirror but several, and there is no master dependency above it, so we have several source folders in node_modules but onmly one target folder in media/vendor. That's why it needs that special treatment.

See https://github.com/joomla/joomla-cms/blob/6.2-dev/package.json#L37-L51 .

avatar richard67
richard67 - comment - 18 May 2026

why do we need a specific method for inclufing the licence for codemirror but not for all other packages? Surely this is a bandage and not a fix to why the code that works for all other packages doesnt work for codemirror. Or is there something specific about codemirror causing this break? Its important to understand the reason so that when we introduce a new package from a new vendor in the future we know if we need to create a specific code for the licence or not

@brianteeman The reason why codemirror is special here is because in our package.json we do not have one dependency for codemirror but several, and there is no master dependency above it, so we have several source folders in node_modules but onmly one target folder in media/vendor. That's why it needs that special treatment.

See https://github.com/joomla/joomla-cms/blob/6.2-dev/package.json#L37-L51 .

P.S.: The LICENSE file is the same for all of these.

avatar brianteeman
brianteeman - comment - 18 May 2026

Thank you for the explanation

avatar richard67 richard67 - change - 18 May 2026
Labels Added: PR-6.2-dev
avatar richard67 richard67 - alter_testresult - 18 May 2026 - richard67: Tested successfully
avatar dgrammatiko
dgrammatiko - comment - 18 May 2026

LGTM

avatar heelc29
heelc29 - comment - 22 May 2026

Wouldn't it be sufficient to align these two?

const destBasePath = 'media/vendor/codemirror/js';

const vendorPath = 'media/vendor/codemirror';

avatar brianteeman
brianteeman - comment - 22 May 2026

is this code redundant now?

"@codemirror/view": {
"name": "codemirror",
"licenseFilename": "LICENSE"
},

avatar LadySolveig
LadySolveig - comment - 22 May 2026

I've experimented a bit with your idea. It's possible, but what benefit do we gain from it? @heelc29

Wouldn't it be sufficient to align these two?
If I remove /js from that line, I have to manually re-add it to every call in the compileCodemirror function.

const destBasePath = 'media/vendor/codemirror/js';

If I add /jsadditionally here, I never get a clean starting point again, and the media/vendor/codemirror folder always remains present after the first build.

const vendorPath = 'media/vendor/codemirror';

In this specific builder we are handling two different resources: plg_edtior_codemirror and vendor\codemirror. The first folder is cleanly removed through the parent call await super.clear();, and then we remove the vendor\codemirror additionally.

avatar LadySolveig
LadySolveig - comment - 22 May 2026

I've experimented a bit with your idea. It's possible, but what benefit do we gain from it? @heelc29

Wouldn't it be sufficient to align these two?
If I remove /js from that line, I have to manually re-add it to every call in the compileCodemirror function.

const destBasePath = 'media/vendor/codemirror/js';

If I add /jsadditionally here, I never get a clean starting point again, and the media/vendor/codemirror folder always remains present after the first build.

const vendorPath = 'media/vendor/codemirror';

In this specific builder we are handling two different resources: plg_edtior_codemirror and vendor/codemirror. The first folder is cleanly removed through the parent call await super.clear();, and then we remove the vendor/codemirror additionally.

avatar LadySolveig
LadySolveig - comment - 22 May 2026

I've experimented a bit with your idea. It's possible, but what benefit do we gain from it? @heelc29
If I remove /js from that line, I have to manually re-add it to every call in the compileCodemirror function.

Wouldn't it be sufficient to align these two?

const destBasePath = 'media/vendor/codemirror/js';

If I add /jsadditionally here, I never get a clean starting point again, and the media/vendor/codemirror folder always remains present after the first build.

const vendorPath = 'media/vendor/codemirror';

In this specific builder we are handling two different resources: plg_edtior_codemirror and vendor/codemirror. The first folder is cleanly removed through the parent call await super.clear();, and then we remove the vendor/codemirror additionally.

avatar LadySolveig
LadySolveig - comment - 22 May 2026

I've experimented a bit with your idea. It's possible, but what benefit do we gain from it? @heelc29
If I remove /js from that line, I have to manually re-add it to every call in the compileCodemirror function.

Wouldn't it be sufficient to align these two?

const destBasePath = 'media/vendor/codemirror/js';

If I add /jsadditionally here, I never get a clean starting point again, and the media/vendor/codemirror folder always remains present after the first build.

const vendorPath = 'media/vendor/codemirror';

In this specific builder we are handling two different resources: plg_edtitors_codemirror and vendor/codemirror. The first folder is cleanly removed through the parent call await super.clear();, and then we remove the vendor/codemirror additionally.

avatar LadySolveig
LadySolveig - comment - 22 May 2026

is this code redundant now?

"@codemirror/view": {
"name": "codemirror",
"licenseFilename": "LICENSE"
},

@brianteeman No, see my description of the PR

Added a copy method to CodemirrorModuleBuilder that copies the CodeMirror license file to the target location if specified in the build settings (settings.json).

avatar LadySolveig
LadySolveig - comment - 22 May 2026

is this code redundant now?

"@codemirror/view": {
"name": "codemirror",
"licenseFilename": "LICENSE"
},

@brianteeman No, see my description of the PR

Added a copy method to CodemirrorModuleBuilder that copies the CodeMirror license file to the target location if specified in the build settings (settings.json).

We could specify the path here, but since this would be the only instance in the entire build process not to define the license file in the global settings, it would likely create maintenance friction in the long run.

avatar LadySolveig
LadySolveig - comment - 22 May 2026

is this code redundant now?

"@codemirror/view": {
"name": "codemirror",
"licenseFilename": "LICENSE"
},

@brianteeman No, see my description of the PR

Added a copy method to CodemirrorModuleBuilder that copies the CodeMirror license file to the target location if specified in the build settings (settings.json).

We could specify the path directly in the method, but since this would be the only instance in the entire build process not to define the license file in the global settings, it would likely create maintenance friction in the long run.

avatar brianteeman
brianteeman - comment - 22 May 2026

we could say this is the only licence that needs special handling outside of the global settings but I get your point ;)

avatar heelc29
heelc29 - comment - 22 May 2026

I've experimented a bit with your idea. It's possible, but what benefit do we gain from it? @heelc29 If I remove /js from that line, I have to manually re-add it to every call in the compileCodemirror function.

If I add /jsadditionally here, I never get a clean starting point again, and the media/vendor/codemirror folder always remains present after the first build.

const vendorPath = 'media/vendor/codemirror';

In this specific builder we are handling two different resources: plg_edtitors_codemirror and vendor/codemirror. The first folder is cleanly removed through the parent call await super.clear();, and then we remove the vendor/codemirror additionally.

@LadySolveig The advantage would be that you would only need to adjust this line, rather than having to extend the copy method.

The CodemirrorModuleBuilder writes only in the js subfolder of media/vendor/codemirror so it should be enough to clear this folder.

The VendorModuleBuilder already ensures a clean starting point for media/vendor/*.

avatar LadySolveig
LadySolveig - comment - 23 May 2026

@heelc29 I see, you mean that since the entire vendor folder is deleted anyway...IF I run a complete new build with all. However, it will only be cleared up completely then when you run npm run -- --all. Not when you run the individual builder with npm run -- -n plg_editors_codemirror. Or am I missing something?

avatar LadySolveig
LadySolveig - comment - 23 May 2026

@heelc29 I see, you mean that since the entire vendor folder is deleted anyway...IF I run a complete new build with all. However, it will only be cleared up completely then when you run npm run -- --all. Not when you run the individual builder with npm run -- -n plg_editors_codemirror. And also only copied with build all. Or am I missing something?

avatar LadySolveig
LadySolveig - comment - 23 May 2026

@heelc29 I see, you mean that since the entire vendor folder is deleted anyway...IF I run a complete new build with all. However, it will only be cleared up completely then when you run npm run -- --all. Not when you run the individual builder with npm run -- -n plg_editors_codemirror. And also only copied with build all. Or am I missing something?

To be honest, I'm quite pragmatic about this. We can also align the paths like you suggested if we're willing to accept the little inconsistency in that specific case.

avatar LadySolveig
LadySolveig - comment - 23 May 2026

The more I think about it, the more I find your solution to be really clean. If other files need to be added in the future, we'll need to touch the builder anyway. Your suggestion of aligning the paths only removes what the specific builder creates, sounds straight forward.

avatar LadySolveig
LadySolveig - comment - 23 May 2026

The more I think about it, the more I find your solution to be really clean. If other files need to be added in the future, we'll need to touch the builder anyway. Your suggestion of aligning the paths only removes what the specific builder creates, sounds straight forward.

avatar MacJoom MacJoom - change - 23 May 2026
The description was changed
avatar MacJoom MacJoom - edited - 23 May 2026
avatar MacJoom MacJoom - change - 23 May 2026
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2026-05-23 20:47:40
Closed_By MacJoom
avatar MacJoom MacJoom - close - 23 May 2026
avatar MacJoom MacJoom - merge - 23 May 2026
avatar MacJoom
MacJoom - comment - 23 May 2026

Thank you very much!

avatar richard67
richard67 - comment - 24 May 2026

Weird ... I had successfully tested this PR, and after that were no changes except of clean branch updates, but now after it has been merged into 6.2-dev it does not work anymore for me on a current 6.2-dev branch which includes this PR on the same environment (Linux) as used for my successful test. The media/vendor/codemirror/LICENSE file does not exist after composer installand npm ci. Same for packages built with build/build.php, the file is not in the package.

Can it be that the Windows fix from the other PR has changed something here? From code reading I would not expect that, but I don't have any other idea now.

avatar richard67
richard67 - comment - 24 May 2026

Weird ... I had successfully tested this PR, and after that were no changes except of clean branch updates, but now after it has been merged into 6.2-dev it does not work anymore for me on a current 6.2-dev branch which includes this PR on the same environment (Linux) as used for my successful test. The media/vendor/codemirror/LICENSE file does not exist after composer installand npm ci. Same for packages built with build/build-php, the file is not in the package.

avatar richard67
richard67 - comment - 24 May 2026

Weird ... I had successfully tested this PR, and after that were no changes except of clean branch updates, but now after it has been merged into 6.2-dev it does not work anymore for me on a current 6.2-dev branch which includes this PR on the same environment (Linux) as used for my successful test. The media/vendor/codemirror/LICENSE file does not exist after composer installand npm ci. Same for packages built with build/build-php, the file is not in the package.

Can it be that the Windows fix from the other PR has changed something here? From code reading I would not expect that, but I don't have any other idea now.

avatar brianteeman
brianteeman - comment - 24 May 2026

same problem here after a cvlean checkout followed by composer install npm install and i am on windows

avatar MacJoom
MacJoom - comment - 24 May 2026

I have just tested it again on windows and LICENSE is placed into media/plg_editors_codemirror...
Screenshot 2026-05-24 132309

avatar richard67
richard67 - comment - 24 May 2026

Ah .. I see .. it's copied to a different place, not the media/vendor/codemirror like it was before but the media/plg_editors_codemirror. Of course that's fine and a better place than before, I think. So the old place is not a false alarm when I run my deleted files check.

avatar richard67
richard67 - comment - 24 May 2026

Ah .. I see .. it's copied to a different place, not the media/vendor/codemirror like it was before but the media/plg_editors_codemirror. So the old place is not a false alarm when I run my deleted files check.

avatar richard67
richard67 - comment - 24 May 2026

Hmm, but e.g. for TinyMCE, the file license.md is still placed in the media/vendor/tinymce folder and not in the media/plg_editors_tinymce/ folder.

But for Codemirror it is now media/plg_editors_codemirror/ and not media/vendor/codemirror.

That seems inconsistent to me.

avatar brianteeman
brianteeman - comment - 24 May 2026

yes I see that - its definitely in the wrong place. the licence must be in the vendor/codemirror folder

avatar richard67
richard67 - comment - 24 May 2026

@brianteeman Could you test PR #47823 ? For me it fixes the issue witht eh LICENSE file without causing any other differences.

Add a Comment

Login with GitHub to post a comment