Skip to content

Commit b8fd8a0

Browse files
committed
[FEAT] add watch option
The new `--watch` flag on the run command will help documentation writers to have a "live" rerendering of their documentation. The command will run the normal rendering once, then changes to existing files are detected and will trigger a rerender of the changed file. To speed up the rendering only the changed file is compiled, this might cause issues in the menu. But that should not be an issue as the final result is always based on a full render.
1 parent 5e7f4d4 commit b8fd8a0

File tree

7 files changed

+3256
-2488
lines changed

7 files changed

+3256
-2488
lines changed

.dockerignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ tools/
55
vendor/
66
Dockerfile
77
*.rst
8-
build
8+
.Build
9+
Documentation*
10+
.phpdoc
11+
.cache

.github/workflows/main.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
with:
3232
coverage: "none"
3333
php-version: "${{ matrix.php }}"
34+
extensions: 'inotify, pcntl'
3435

3536
- name: "Install dependencies with Composer"
3637
uses: "ramsey/composer-install@v2"
@@ -55,6 +56,7 @@ jobs:
5556
with:
5657
coverage: "none"
5758
php-version: "${{ env.DEFAULT_PHP_VERSION }}"
59+
extensions: 'inotify, pcntl'
5860

5961
- name: "Install dependencies with Composer"
6062
uses: "ramsey/composer-install@v2"
@@ -91,6 +93,7 @@ jobs:
9193
with:
9294
coverage: "none"
9395
php-version: "${{ env.DEFAULT_PHP_VERSION }}"
96+
extensions: 'inotify, pcntl'
9497

9598
- name: "Install dependencies with Composer"
9699
uses: "ramsey/composer-install@v2"

Dockerfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
FROM composer:2 AS builder
1+
FROM php:8.1-cli-alpine AS builder
2+
3+
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
4+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
5+
6+
RUN apk add --update $PHPIZE_DEPS
7+
RUN pie install arnaud-lb/inotify && docker-php-ext-install pcntl
28

39
WORKDIR /opt/guides
410
COPY . /opt/guides
@@ -7,6 +13,13 @@ RUN composer install --no-dev --no-interaction --no-progress \
713
--no-suggest --optimize-autoloader --classmap-authoritative
814

915
FROM php:8.1-cli-alpine
16+
17+
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
18+
RUN apk add --update $PHPIZE_DEPS
19+
RUN pie install arnaud-lb/inotify && docker-php-ext-install pcntl
20+
21+
RUN apk del $PHPIZE_DEPS && rm -rf /var/cache/apk/* /tmp/* /usr/share/php/* /usr/local/lib/php/doc/* /usr/local/lib/php/test/*
22+
1023
COPY . /opt/guides
1124
WORKDIR /opt/guides
1225

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PHP_BIN ?= docker run -i --rm --user $$(id -u):$$(id -g) -v${PWD}:/opt/project -
77

88
## Docker wrapper to use for a typo3-docs:local container.
99
## This container provides a runtime for the `guides` project
10-
PHP_PROJECT_BIN ?= docker run -i --rm --user $$(id -u):$$(id -g) -v${PWD}:/project typo3-docs:local
10+
PHP_PROJECT_BIN ?= docker run -i --rm --user $$(id -u):$$(id -g) -v${PWD}:/project --entrypoint=/project/vendor/bin/guides -p 1337:1337 typo3-docs:local
1111

1212
## Docker wrapper to use for a typo3-docs:local container.
1313
## This container provides a composer-runtime; mounts project on /app
@@ -128,7 +128,7 @@ test: test-integration test-unit test-xml test-docs test-rendertest ## Runs all
128128
.PHONY: test-docs
129129
test-docs: ## Runs project generation tests
130130
@echo "$(ENV_INFO)"
131-
$(PHP_BIN) vendor/bin/guides --no-progress Documentation --output="/tmp/test" --config=Documentation --minimal-test
131+
$(PHP_PROJECT_BIN) --no-progress Documentation --config=Documentation --minimal-test
132132

133133
.PHONY: test-rendertest
134134
test-rendertest: ## Runs rendering with Documentation-rendertest

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"ext-libxml": "*",
1010
"brotkrueml/twig-codehighlight": "^1.0",
1111
"league/flysystem": "^1.1.10",
12+
"phpdocumentor/dev-server": "^1.9",
1213
"phpdocumentor/filesystem": "^1.9",
1314
"phpdocumentor/guides": "^1.9",
1415
"phpdocumentor/guides-cli": "^1.9",
@@ -17,9 +18,11 @@
1718
"phpdocumentor/guides-restructured-text": "^1.9",
1819
"phpdocumentor/guides-theme-bootstrap": "^1.7",
1920
"phpdocumentor/guides-theme-rst": "^1.7",
21+
"psr/http-message": "^1.1",
2022
"symfony/clock": "^6.4",
2123
"symfony/finder": "^6.4",
2224
"symfony/http-client": "^6.4",
25+
"symfony/polyfill-php84": "^1.33",
2326
"symfony/yaml": "^6.4",
2427
"t3docs/console-command": "^0.2.0",
2528
"t3docs/guides-php-domain": "^1.0",

0 commit comments

Comments
 (0)