Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brookinsconsulting committed Feb 22, 2019
2 parents cb1dac7 + f3e8801 commit 007b582
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Expand Up @@ -34,6 +34,12 @@
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
/web/assets/translations/*
/web/assets/build/*
!web/assets/build/.gitkeep
/web/assets/ezplatform/build/*
!/web/assets/ezplatform/build/.gitkeep
/node_modules/

.php~

Expand All @@ -57,6 +63,7 @@ web/fonts/

composer.phar
composer.lock
yarn.lock
.buildpath
.project
.settings/
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,7 @@ services:
- docker

cache:
yarn: true
directories:
- $HOME/.composer/cache/files

Expand Down
2 changes: 2 additions & 0 deletions app/AppKernel.php
Expand Up @@ -15,6 +15,7 @@ public function registerBundles()
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Symfony\WebpackEncoreBundle\WebpackEncoreBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
// Dependencies
Expand Down Expand Up @@ -45,6 +46,7 @@ public function registerBundles()
new EzSystems\EzPlatformAdminUiModulesBundle\EzPlatformAdminUiModulesBundle(),
new EzSystems\EzPlatformAdminUiAssetsBundle\EzPlatformAdminUiAssetsBundle(),
new EzSystems\EzPlatformCronBundle\EzPlatformCronBundle(),
new EzSystems\EzPlatformEncoreBundle\EzSystemsEzPlatformEncoreBundle(),
// Application
new AppBundle\AppBundle(),
];
Expand Down
11 changes: 10 additions & 1 deletion app/config/config.yml
Expand Up @@ -72,7 +72,10 @@ framework:
# Further reading on sessions: http://doc.ezplatform.com/en/latest/guide/sessions/
fragments: ~
http_method_override: true
assets: true
assets:
packages:
ezplatform:
json_manifest_path: '%kernel.project_dir%/web/assets/ezplatform/build/manifest.json'
php_errors:
log: true

Expand All @@ -93,6 +96,12 @@ assetic:
formatter: 'Leafo\ScssPhp\Formatter\Crunched'
import_paths: ['%kernel.project_dir%/web/']

# Webpack Encore Configuration
webpack_encore:
output_path: "%kernel.project_dir%/web/assets/build"
builds:
ezplatform: "%kernel.project_dir%/web/assets/ezplatform/build"

# Swiftmailer Configuration
swiftmailer:
transport: '%mailer_transport%'
Expand Down
3 changes: 3 additions & 0 deletions behat.yml.dist
Expand Up @@ -30,8 +30,11 @@ default:
active_image_drivers: cloudinary
image_drivers:
cloudinary:
screenshot_directory: /tmp/behat-screenshot/
cloud_name: ezplatformtravis
preset: ezplatform
mode: normal
limit: 10

suites: ~

Expand Down
12 changes: 8 additions & 4 deletions composer.json
Expand Up @@ -29,8 +29,9 @@
"doctrine/orm": "^2.6.3",
"ezsystems/ez-support-tools": "^0.2@dev",
"ezsystems/ezplatform-admin-ui": "^1.5@dev",
"ezsystems/ezplatform-admin-ui-assets": "^3.1@dev",
"ezsystems/ezplatform-admin-ui-assets": "^4.0",
"ezsystems/ezplatform-admin-ui-modules": "^1.5@dev",
"ezsystems/ezplatform-core": "^1.0@dev",
"ezsystems/ezplatform-cron": "^2.0@dev",
"ezsystems/ezplatform-design-engine": "^2.0@dev",
"ezsystems/ezplatform-http-cache": "~0.8@dev",
Expand All @@ -50,6 +51,7 @@
"symfony/swiftmailer-bundle": "^3.2.4",
"symfony/symfony": "^3.4.18",
"symfony/thanks": "^1.1.0",
"symfony/webpack-encore-bundle": "^1.0.0",
"twig/extensions": "^1.5.3",
"twig/twig": "^2.5",
"white-october/pagerfanta-bundle": "^1.2.2",
Expand All @@ -62,7 +64,7 @@
"behat/mink-selenium2-driver": "^1.3.1",
"behat/symfony2-extension": "^2.1.5",
"bex/behat-screenshot": "^1.2.7",
"ezsystems/behat-screenshot-image-driver-cloudinary": "^1.0.0@dev",
"ezsystems/behat-screenshot-image-driver-cloudinary": "^1.1.0@dev",
"ezsystems/behatbundle": "^6.5.4@dev",
"phpunit/phpunit": "^6.5.13",
"sensio/generator-bundle": "^3.1.7",
Expand All @@ -79,9 +81,11 @@
"eZ\\Bundle\\EzPublishCoreBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"@php bin/console bazinga:js-translation:dump --merge-domains",
"@php bin/console bazinga:js-translation:dump 'web/assets' --merge-domains",
"@php bin/console assetic:dump",
"@php bin/security-checker security:check"
"@php bin/security-checker security:check",
"yarn install",
"yarn encore dev"
],
"post-install-cmd": [
"@symfony-scripts"
Expand Down
2 changes: 1 addition & 1 deletion doc/docker/Dockerfile-app
@@ -1,5 +1,5 @@
ARG PHP_IMAGE=ezsystems/php:7.2-v1
FROM ${PHP_IMAGE} as builder
FROM ${PHP_IMAGE}-node as builder

# This is prod image (for dev use just mount your application as host volume into php image we extend here)
ENV SYMFONY_ENV=prod
Expand Down
2 changes: 1 addition & 1 deletion doc/docker/Dockerfile-nginx
@@ -1,5 +1,5 @@
ARG PHP_IMAGE=ezsystems/php:7.2-v1
FROM ${PHP_IMAGE} as web-build
FROM ${PHP_IMAGE}-node as web-build

ENV SYMFONY_ENV=prod

Expand Down
2 changes: 1 addition & 1 deletion doc/docker/base-dev.yml
Expand Up @@ -3,7 +3,7 @@ version: '3.3'

services:
app:
image: ${PHP_IMAGE}
image: ${PHP_IMAGE}-node
volumes:
- ${COMPOSE_DIR}/../../:/var/www:cached
- ${COMPOSER_HOME}:/root/.composer:cached
Expand Down
31 changes: 31 additions & 0 deletions ez.webpack.config.js
@@ -0,0 +1,31 @@
const path = require('path');
const bundles = require('./var/encore/ez.config.js');

module.exports = (Encore) => {
Encore.setOutputPath('web/assets/ezplatform/build')
.setPublicPath('/assets/ezplatform/build')
.addExternals({
react: 'React',
'react-dom': 'ReactDOM',
jquery: 'jQuery',
moment: 'moment',
'popper.js': 'Popper',
alloyeditor: 'AlloyEditor',
'prop-types': 'PropTypes',
})
.enableSassLoader()
.enableReactPreset()
.enableSingleRuntimeChunk();

bundles.forEach((configPath) => {
const addEntries = require(configPath);

addEntries(Encore);
});

const eZConfig = Encore.getWebpackConfig();

eZConfig.name = 'ezplatform';

return eZConfig;
};
35 changes: 35 additions & 0 deletions ez.webpack.config.manager.js
@@ -0,0 +1,35 @@
const findItems = (eZConfig, entryName) => {
const items = eZConfig.entry[entryName];

if (!items) {
throw new Error(`Couldn't find entry with name: "${entryName}". Please check if there is a typo in the name.`);
}

return items;
};
const replace = ({ eZConfig, entryName, itemToReplace, newItem }) => {
const items = findItems(eZConfig, entryName);
const indexToReplace = items.indexOf(itemToReplace);

if (indexToReplace < 0) {
throw new Error(`Couldn't find item "${itemToReplace}" in entry "${entryName}". Please check if there is a typo in the name.`);
}

items[indexToReplace] = newItem;
};
const remove = ({ eZConfig, entryName, itemsToRemove }) => {
const items = findItems(eZConfig, entryName);

eZConfig.entry[entryName] = items.filter((item) => !itemsToRemove.includes(item));
};
const add = ({ eZConfig, entryName, newItems }) => {
const items = findItems(eZConfig, entryName);

eZConfig.entry[entryName] = [...items, ...newItems];
};

module.exports = {
replace,
remove,
add
};
8 changes: 8 additions & 0 deletions package.json
@@ -0,0 +1,8 @@
{
"devDependencies": {
"@babel/preset-react": "^7.0.0",
"@symfony/webpack-encore": "^0.22.4",
"node-sass": "^4.11.0",
"sass-loader": "^7.0.1"
}
}
Empty file added web/assets/build/.gitkeep
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions webpack.config.js
@@ -0,0 +1,21 @@
const Encore = require('@symfony/webpack-encore');
const path = require('path');
const getEzConfig = require('./ez.webpack.config.js');
const eZConfigManager = require('./ez.webpack.config.manager.js');
const eZConfig = getEzConfig(Encore);

Encore.reset();
Encore.setOutputPath('web/assets/build')
.setPublicPath('/assets/build')
.enableSassLoader()
.enableReactPreset()
.enableSingleRuntimeChunk();

// Put your config here.

// uncomment the two lines below, if you have your own Encore configuration for your project
// const projectConfig = Encore.getWebpackConfig();
// module.exports = [ eZConfig, projectConfig ];

// comment-out this line if you've uncommented the above lines
module.exports = eZConfig;

0 comments on commit 007b582

Please sign in to comment.