Project

General

Profile

Actions

Bug #100468

closed

Missing assets folder when creating public folder after installation

Added by Daniel Siepmann over 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
composer
Target version:
-
Start date:
2023-04-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Given that:

  1. I've created a TYPO3 extension as composer package
  2. That extension does not have a Public/ folder yet
  3. The extension is installed
  4. A new Public/ folder is created within that extension
  5. The folder does not show up within _assets/ folder

That might happen during setting up an extension, e.g. a sitepackage.

Workaround:

  1. composer dumpautoload after the Resources/Public folders are added

Maybe we can ease that somehow? Provide a command or maybe "fix" that by a proper 404 handling within TYPO3 itself? I fear that many people will run into that issue when starting with v12.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #103898: Existing "_assets" subdirectories not being a symlink prevents installationClosed2024-05-24

Actions
Actions #1

Updated by Daniel Siepmann over 1 year ago

I previously reported at https://github.com/TYPO3/CmsComposerInstallers/issues/142 but got told the corresponding code belongs to the core instead.

Actions #2

Updated by Daniel Siepmann over 1 year ago

  • Assignee set to Helmut Hummel
Actions #3

Updated by Helmut Hummel over 1 year ago

  • Description updated (diff)
Actions #4

Updated by Helmut Hummel over 1 year ago

  • Status changed from New to Needs Feedback

Daniel Siepmann wrote:

Maybe we can ease that somehow?

Other than what you have written, any further idea when exactly should happen what?

Provide a command

The command currently is composer dumpautoload (or any other composer command that updates the autoload information)
Would it help to document what TYPO3 does in this process? Or maybe even more verbosely output that on command line when running composer commands?

I was in the process of creating a asset:publish typo3 command, but then was asking myself, what the expectation is, when this command is not executed at all. Should the publishing still happen on composer commands? Should the assets:publish command be executed then?

or maybe "fix" that by a proper 404 handling within TYPO3 itself?

How could this be fixed? Any conceptual ideas?

I fear that many people will run into that issue when starting with v12.

Actions #5

Updated by Helmut Hummel over 1 year ago

Another option would be to document, that an extension is only complete with at lease a composer.json AND a Resources/Public/Icons/Extension.[png|svg] file

Actions #6

Updated by Daniel Siepmann over 1 year ago

Other than what you have written, any further idea when exactly should happen what?

Sorry, but I've no good idea.

Would it help to document what TYPO3 does in this process? Or maybe even more verbosely output that on command line when running composer commands?

Yeah, that would help. I guess documenting it somewhere would probably not help, but an more verbose output would help.

How could this be fixed? Any conceptual ideas?

I guess TYPO3 will index.php will be called if an asset is requested that doesn't exist. TYPO3 could check the URL and compare the asset and hash and output an Exception with instructions to check that the folder exists within the extension, and that one needs to trigger dumpautoload.

Another option would be to document, that an extension is only complete with at lease a composer.json AND a Resources/Public/Icons/Extension.[png|svg] file

That sounds like the easiest and best approach. How would that look like? Would composer prevent installing / enabling the extension and output an error instead? Maybe a warning at the moment in order to stay compatible and not breaking?

Actions #7

Updated by Chris Müller over 1 year ago

I created a PR for the docs about how to proceed when adding the Resources/Public folder after installation:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/2838

Actions #8

Updated by Chris Müller over 1 year ago

I don't like the idea that an Extension.[svg|png] file must exist as it has only "decorative" character in the extension manager. For a Composer-based installation the extension manager is not really necessary, so why insist to have an extension icon file?

In fact, I am thinking to remove it in my project-specific extensions as it adds no value to the extension and project and is just overhead.

Actions #9

Updated by Dan Kleine (Untenzu) over 1 year ago

Some suggestions, since you asked for feedback :)

Another option would be to document, that an extension is only complete with at lease a composer.json AND a Resources/Public/Icons/Extension.[png|svg] file

Veto. Extension don't need public resources. This would force developers to add files they dont need. And it would create a bunch of `_assets` symlinks for extension which don't need them at all.

How could this be fixed? Any conceptual ideas?

This only happens when a public directory is expected to exist, but it does not. Typical use case for an exception.

→ Check if the requested ressource was expected to have a symlink in _assets → throw a custom exception → add a documentation for the exception number with possible reasons and solutions.

more verbosely output [the asset symlink creation process] on command line when running composer commands?

Agree. It would help to notify cli users what happens here - something like „TYPO3 created a symlink in /_assets/ for all existing /Resources/Public/ subdirectories in all packages“.

Workarounds for build systems which generate the public folder after the composer command?

Several possible solutions:

1. Switch the build order - build assets first and therefore create the /Resource/Public/ directory, then run your composer build afterwards
2. Trigger the asset build script - Run `composer dumpautoload` oder `composer install` yet again as final buildstep. This wont change the app, already fetched packages are not fetched again, this will basically only trigger all related scripts like the _assets-symlink-builder.
3. Add an empty /Resources/Public/ directory to your VCS - for example with a `.gitkeep` file

Actions #10

Updated by Garvin Hicking 6 months ago

  • Related to Bug #103898: Existing "_assets" subdirectories not being a symlink prevents installation added
Actions #11

Updated by Garvin Hicking 5 months ago

  • Status changed from Needs Feedback to Closed

I would like to close the issue, it is now both better documented that Resources/Public is a requirement, as well as with https://review.typo3.org/c/Packages/TYPO3.CMS/+/84383 there is now a verbose information when a package is not symlinked.

I hope this is alright with you; let me know if you feel there is something specific left to improve the situation.

Actions

Also available in: Atom PDF