Skip to content

Commit

Permalink
[TASK] Add init command to setup documentation (#850)
Browse files Browse the repository at this point in the history
First version of an init command that will setup the Documentation
directory. This includes a very basic guides.xml. Therefor the user has
to answer a number of questions that will fill in the defaults.

---------

Co-authored-by: Lina Wolf <48202465+linawolf@users.noreply.github.com>
Co-authored-by: Garvin Hicking <blog@garv.in>
Co-authored-by: lina.wolf <lwolf@w-commerce.de>
Co-authored-by: Stefan Frömken <123929835+sfroemkenjw@users.noreply.github.com>
  • Loading branch information
5 people authored Dec 16, 2024
1 parent 9aa3bb1 commit 01ef2cf
Show file tree
Hide file tree
Showing 19 changed files with 625 additions and 20 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ WORKDIR /opt/guides

COPY --from=builder /opt/guides/vendor /opt/guides/vendor
RUN echo "memory_limit=4G" >> /usr/local/etc/php/conf.d/typo3.ini
RUN echo "error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT" >> /usr/local/etc/php/conf.d/typo3.ini

ARG TYPO3AZUREEDGEURIVERSION
ENV TYPO3AZUREEDGEURIVERSION=$TYPO3AZUREEDGEURIVERSION
Expand Down
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ ENTRYPOINT_SYMFONY_COMMANDS="/opt/guides/packages/typo3-guides-cli/bin/typo3-gui
if [ "$1" = "migrate" ]; then
ENTRYPOINT="${ENTRYPOINT_SYMFONY_COMMANDS} migrate"
shift
elif [ "$1" = "init" ]; then
ENTRYPOINT="${ENTRYPOINT_SYMFONY_COMMANDS} init"
shift
elif [ "$1" = "lint-guides-xml" ]; then
ENTRYPOINT="${ENTRYPOINT_SYMFONY_COMMANDS} lint-guides-xml"
shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use phpDocumentor\Guides\RestructuredText\Parser\Productions\DirectiveContentRule;
use phpDocumentor\Guides\RestructuredText\Parser\Productions\DocumentRule;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use T3Docs\VersionHandling\Packagist\PackagistService;
use T3Docs\Typo3DocsTheme\Api\Typo3ApiService;
use T3Docs\Typo3DocsTheme\Compiler\NodeTransformers\CollectPrefixLinkTargetsTransformer;
use T3Docs\Typo3DocsTheme\Compiler\NodeTransformers\ConfvalMenuNodeTransformer;
Expand All @@ -41,7 +42,6 @@
use T3Docs\Typo3DocsTheme\EventListeners\OriginalFileNameSetter;
use T3Docs\Typo3DocsTheme\EventListeners\TestingModeActivator;
use T3Docs\Typo3DocsTheme\Inventory\Typo3InventoryRepository;
use T3Docs\Typo3DocsTheme\Packagist\PackagistService;
use T3Docs\Typo3DocsTheme\Inventory\Typo3VersionService;
use T3Docs\Typo3DocsTheme\Parser\ExtendedInterlinkParser;
use T3Docs\Typo3DocsTheme\Parser\Productions\FieldList\EditOnGitHubFieldListItemRule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace T3Docs\Typo3DocsTheme\Nodes\Inline;

use phpDocumentor\Guides\Nodes\Inline\InlineNode;
use T3Docs\Typo3DocsTheme\Packagist\ComposerPackage;
use T3Docs\VersionHandling\Packagist\ComposerPackage;

final class ComposerInlineNode extends InlineNode
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use phpDocumentor\Guides\RestructuredText\TextRoles\TextRole;
use Psr\Log\LoggerInterface;
use T3Docs\Typo3DocsTheme\Nodes\Inline\ComposerInlineNode;
use T3Docs\Typo3DocsTheme\Packagist\PackagistService;
use T3Docs\VersionHandling\Packagist\PackagistService;

final class ComposerTextRole implements TextRole
{
Expand Down
2 changes: 2 additions & 0 deletions packages/typo3-guides-cli/bin/typo3-guides
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare(strict_types=1);

namespace T3Docs\GuidesCli;

use T3Docs\GuidesCli\Command\InitCommand;
use T3Docs\GuidesCli\Command\MigrateSettingsCommand;
use T3Docs\GuidesCli\Command\ConfigureCommand;
use T3Docs\GuidesCli\Command\LintGuidesXmlCommand;
Expand Down Expand Up @@ -35,6 +36,7 @@ if (file_exists($autoloadDirectory)){
$application = new Application('typo3-guides');

$application->add(new MigrateSettingsCommand());
$application->add(new InitCommand());
$application->add(new ConfigureCommand());
$application->add(new LintGuidesXmlCommand());

Expand Down
48 changes: 48 additions & 0 deletions packages/typo3-guides-cli/resources/templates/Index.md.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# {{ projectName }}

{{ description | default('No description provided.') }}

## Installation

Install the extension via Composer:

```
composer req {{ composerName }}
```

{% if projectHomePage %}
Or download the extension from {{ projectHomePage }} and install it in
the Extension Manager.
{% endif %}

See also [Installing extensions, TYPO3 Getting started](https://docs.typo3.org/permalink/t3start:installing-extensions)

## Configuration


{% if siteSet %}

### Include the site set

This extension comes with a site set called `{{ siteSet }}`. To use it include
this set in your site configuration via

```
base: 'https://example.com/'
rootPageId: 1
dependencies:
- {{ siteSet }}
```

See also: `TYPO3 Explained, Using a site set as dependency in a site <https://docs.typo3.org/permalink/t3coreapi:site-sets-usage>`_.
{% else %}
Describe how to configure the extension.
{% endif %}

## Report issues

{% if issuesUrl %}
You can report issues at {{ issuesUrl }}.
{% else %}
Explain, how to report issues.
{% endif %}
34 changes: 34 additions & 0 deletions packages/typo3-guides-cli/resources/templates/guides.xml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<guides
xmlns="https://www.phpdoc.org/guides"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.phpdoc.org/guides vendor/phpdocumentor/guides-cli/resources/schema/guides.xsd"
input-format="{{ format }}"
{% if useMd -%}
index-name="Index"
automatic-menu="true"
{% endif -%}
>
<project
title="{{ projectName }}"
copyright="The contributors"
/>
<extension
class="\T3Docs\Typo3DocsTheme\DependencyInjection\Typo3DocsThemeExtension"
{% if editOnGitHub -%}
edit-on-github="{{ editOnGitHub }}"
edit-on-github-branch="main"
{% endif -%}
interlink-shortcode="{{ composerName }}"
{% if projectHomePage -%}
project-home="{{ projectHomePage }}"
{% endif -%}
{% if issuesUrl -%}
project-issues="{{ issuesUrl }}"
{% endif -%}
{% if repositoryUrl -%}
project-repository="{{ repositoryUrl }}"
{% endif -%}
typo3-core-preferred="{{ typo3CoreVersion }}"
/>
</guides>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
:navigation-title: Configuration
.. _configuration:

=============
Configuration
=============

{% if siteSet %}
.. _site-set:

Include the site set
====================

This extension comes with a site set called `{{ siteSet }}`. To use it include
this set in your site configuration via

.. code-block:: diff
:caption: config/sites/my-site/config.yaml (diff)

base: 'https://example.com/'
rootPageId: 1
+dependencies:
+ - {{ siteSet }}

See also: `TYPO3 Explained, Using a site set as dependency in a site <https://docs.typo3.org/permalink/t3coreapi:site-sets-usage>`_.

{% if siteSetDefinition %}
.. _site-set-settings:

Use the settings to configure the extension
-------------------------------------------

.. typo3:site-set-settings:: PROJECT:/
:name: main-set
:type:
:Label: max=30
:default: max=10
{% endif %}

{% else %}
Describe how to configure the extension.
{% endif %}
29 changes: 29 additions & 0 deletions packages/typo3-guides-cli/resources/templates/rst/Faq.rst.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
:navigation-title: FAQ

.. _faq:

================================
Frequently Asked Questions (FAQ)
================================

.. accordion::
:name: faq

.. accordion-item:: How can I install this extension?
:name: installation
:header-level: 2
:show:

See chapter :ref:`installation`.

.. accordion-item:: How to can I include the TypoScript?
:name: configuration
:header-level: 2

See chapter :ref:`configuration`.

.. accordion-item:: Where to get help?
:name: help
:header-level: 2

See chapter :ref:`help`.
22 changes: 22 additions & 0 deletions packages/typo3-guides-cli/resources/templates/rst/GetHelp.rst.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:navigation-title: Get Help

.. _help:

=================
Where to get help
=================

You can get help in the TYPO3 Slack https://typo3.org/community/meet/chat-slack,
Ask a question in the official TYPO3 forum, https://talk.typo3.org/c/typo3-questions/19
or contact the extension author.

.. _report-issues:

Report Issues
=============

{% if issuesUrl %}
You can report issues at `{{ issuesUrl }} <{{ issuesUrl }}>`_.
{% else %}
No issue tracker is currently available.
{% endif %}
47 changes: 47 additions & 0 deletions packages/typo3-guides-cli/resources/templates/rst/Index.rst.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. _start:

{{ '='|repeat(projectName|length) }}
{{ projectName }}
{{ '='|repeat(projectName|length) }}

{{ description | default('No description provided.') }}

.. toctree::
:glob:
:titlesonly:
:hidden:

*/Index
Installation
Configuration
GetHelp
*

.. card-grid::
:columns: 1
:columns-md: 2
:gap: 4
:class: pb-4
:card-height: 100

.. card:: :ref:`Installation <installation>`

Explains how to install this extension in Composer-based and Classic
TYPO3 installations.

.. card:: :ref:`Configuration <configuration>`

{% if siteSet %}
Learn how to include the site set `{{ siteSet }}` and how to use settings
to configure this extension.
{% else %}
Learn how to configure this extension.
{% endif %}

.. card:: :ref:`Frequently Asked Questions (FAQ) <faq>`

These questions have been frequently asked.

.. card:: :ref:`How to get help <help>`

Learn where to get help and how to report issues you found.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
:navigation-title: Installation

.. _installation:

============
Installation
============

.. _installation-composer:

Install {{ projectName }} with Composer
=======================================

Install the extension via Composer:

.. code-block:: bash

composer req {{ composerName }}

See also `Installing extensions, TYPO3 Getting started <https://docs.typo3.org/permalink/t3start:installing-extensions>`_.

.. _installation-classic:

Install {{ projectName }} in Classic Mode
=========================================

{% if projectHomePage %}
Or download the extension from `{{ projectHomePage }} <{{ projectHomePage }}>`_ and install it in
the Extension Manager.
{% else %}
Or download the extension from the `TER <https://extensions.typo3.org/>`_ and install it in
the Extension Manager.
{% endif %}
Loading

0 comments on commit 01ef2cf

Please sign in to comment.