forked from ezsystems/ezplatform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-30035: Install Webpack Encore (ezsystems#345)
* Webpack Encore * change path web/js to web/assets/build * update to new approach with preloading configs from bundle * changed root_dir to project_dir * added json_manifest * changed externals * added ez entrypoint * fixed multiple configuration * renamed ez to ezplatform * keep build folders, ignore compiled files * fix extra line in gitignore * added node_modules and yarn.lock to .gitignore * EZP-30035: Install eZ Platform encore bundle from ezplatform-core * Add Node to Docker images. Cache Yarn * Use node in app-dev container * [Docker] Simply set PHP_IMAGE to Node * [Docker] Specify Node flavour where needed * moved translations to assets/translation
- Loading branch information
Showing
14 changed files
with
124 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ services: | |
- docker | ||
|
||
cache: | ||
yarn: true | ||
directories: | ||
- $HOME/.composer/cache/files | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |