Skip to content

Commit 6b8196b

Browse files
TatevikGrtatevikg1
andauthored
release: dev → main (add frontend build system) (#110)
New Features Modern frontend build and bundling setup with Node/Yarn support and asset compilation CORS support enabled for API compatibility Chores Updated build tooling and runtime dependencies; added image processing support in the runtime environment Docker and compose improvements for build steps and persistent logs/cache; adjusted ignore rules Tests Added test bootstrap and improved server-error assertion in endpoint tests Documentation Added instructions to build and publish frontend assets --------- Co-authored-by: Tatevik <tatevikg1@gmail.com>
1 parent 864e17f commit 6b8196b

14 files changed

Lines changed: 6537 additions & 500 deletions

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
.vscode
77
node_modules
88
npm-debug.log
9-
yarn.lock
109
composer.phar
1110
var/cache
1211
var/logs
12+
var/log
1313
var/sessions
1414
.env
1515
Dockerfile*
1616
docker-compose*.yml
1717
**/.DS_Store
1818
**/Thumbs.db
1919
vendor/
20+
public/build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/public/
1313
/var/
1414
/vendor/
15+
/node_modules/
1516
.DS_Store
1617
.vagrant
1718
.phpunit.result.cache

Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ RUN apt-get update \
1111
&& apt-get install -y --no-install-recommends \
1212
git unzip libzip-dev libicu-dev libpng-dev libonig-dev libxml2-dev \
1313
libc-client2007e-dev libkrb5-dev libssl-dev libpq-dev \
14+
libfreetype6-dev libjpeg62-turbo-dev \
1415
&& docker-php-ext-configure intl \
1516
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
17+
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
1618
&& docker-php-ext-install -j"$(nproc)" \
17-
pdo pdo_mysql pdo_pgsql zip intl imap \
19+
pdo pdo_mysql pdo_pgsql zip intl imap gd \
1820
&& rm -rf /var/lib/apt/lists/*
1921

22+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
23+
&& apt install -y nodejs \
24+
&& npm install -g yarn
25+
2026
# Enable Apache modules and set DocumentRoot to /public
2127
RUN a2enmod rewrite headers \
2228
&& sed -ri 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf \
@@ -25,7 +31,7 @@ RUN a2enmod rewrite headers \
2531
&& a2enconf phplist
2632

2733
# Copy composer definition first and install dependencies
28-
COPY composer.json composer.lock ./
34+
COPY composer.json composer.lock package.json yarn.lock ./
2935

3036
# Install Composer
3137
ENV COMPOSER_ALLOW_SUPERUSER=1 \
@@ -53,6 +59,9 @@ RUN chown -R www-data:www-data var public \
5359
&& find var -type d -exec chmod 775 {} \; \
5460
&& find var -type f -exec chmod 664 {} \;
5561

62+
# Build frontend assets once, during image build
63+
RUN composer run-script build-web-frontend-assets
64+
5665
# Expose port and run Apache
5766
EXPOSE 80
5867
CMD ["apache2-foreground"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ You can get a list of all installed phpList modules with this command:
151151
composer run-script list-modules
152152
```
153153

154+
To compile and publish the `phplist/web-frontend` assets into
155+
`public/build` (used by the web frontend Twig templates),
156+
run:
157+
158+
```bash
159+
composer run-script build-web-frontend-assets
160+
```
161+
154162

155163
## Creating a .tar.gz package of this distribution
156164

composer.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@
4848
"phplist/rest-api": "dev-main",
4949
"phplist/web-frontend": "dev-main",
5050
"doctrine/orm": "^3.3",
51-
"tatevikgr/rest-api-client": "dev-ISSUE-357",
52-
"tatevikgr/rss-feed": "dev-main as 0.1.0"
51+
"tatevikgr/rest-api-client": "dev-main",
52+
"tatevikgr/rss-feed": "dev-main as 0.1.0",
53+
"nelmio/cors-bundle": "^2.6"
5354
},
5455
"require-dev": {
5556
"phpunit/phpunit": "^9.6.33",
@@ -90,6 +91,10 @@
9091
"php bin/console cache:clear",
9192
"php bin/console cache:warmup"
9293
],
94+
"build-web-frontend-assets": [
95+
"yarn install",
96+
"yarn build:web-frontend"
97+
],
9398
"post-install-cmd": [
9499
"@create-directories",
95100
"@update-configuration"
@@ -104,6 +109,11 @@
104109
]
105110
},
106111
"extra": {
112+
"phplist/core": {
113+
"bundles": [
114+
"Nelmio\\CorsBundle\\NelmioCorsBundle"
115+
]
116+
},
107117
"symfony-app-dir": "bin",
108118
"symfony-bin-dir": "bin",
109119
"symfony-var-dir": "var",

0 commit comments

Comments
 (0)