const { sync } = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const AssetsManifestPlugin = require('webpack-assets-manifest');
- const CopyPlugin = require('copy-webpack-plugin');
-const extname = require('path-complete-extname');
-const { env, settings, themes, output } = require('./configuration');
+const { env, settings, core, flavours, output } = require('./configuration.js');
const rules = require('./rules');
-const localePackPaths = require('./generateLocalePacks');
+const localePacks = require('./generateLocalePacks');
+
+function reducePacks (data, into = {}) {
+ if (!data.pack) {
+ return into;
+ }
+ Object.keys(data.pack).reduce((map, entry) => {
+ const pack = data.pack[entry];
+ if (!pack) {
+ return map;
+ }
+ const packFile = typeof pack === 'string' ? pack : pack.filename;
+ if (packFile) {
+ map[data.name ? `flavours/${data.name}/${entry}` : `core/${entry}`] = resolve(data.pack_directory, packFile);
+ }
+ return map;
+ }, into);
+ if (data.name) {
+ Object.keys(data.skin).reduce((map, entry) => {
+ const skin = data.skin[entry];
+ const skinName = entry;
+ if (!skin) {
+ return map;
+ }
+ Object.keys(skin).reduce((map, entry) => {
+ const packFile = skin[entry];
+ if (!packFile) {
+ return map;
+ }
+ map[`skins/${data.name}/${skinName}/${entry}`] = resolve(packFile);
+ return map;
+ }, into);
+ return map;
+ }, into);
+ }
+ return into;
+}
+
+const entries = Object.assign(
+ { locales: resolve('app', 'javascript', 'locales') },
+ localePacks,
+ reducePacks(core),
+ Object.keys(flavours).reduce((map, entry) => reducePacks(flavours[entry], map), {})
+);
-const extensionGlob = `**/*{${settings.extensions.join(',')}}*`;
-const entryPath = join(settings.source_path, settings.source_entry_path);
-const packPaths = sync(join(entryPath, extensionGlob));
module.exports = {
- entry: Object.assign(
- packPaths.reduce((map, entry) => {
- const localMap = map;
- const namespace = relative(join(entryPath), dirname(entry));
- localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry);
- return localMap;
- }, {}),
- localePackPaths.reduce((map, entry) => {
- const localMap = map;
- localMap[basename(entry, extname(entry, extname(entry)))] = resolve(entry);
- return localMap;
- }, {}),
- Object.keys(themes).reduce((themePaths, name) => {
- themePaths[name] = resolve(join(settings.source_path, themes[name]));
- return themePaths;
- }, {}),
- ),
+ entry: entries,
output: {
filename: 'js/[name]-[chunkhash].js',
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
- fastq@^1.6.0:
- version "1.8.0"
- resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.8.0.tgz#550e1f9f59bbc65fe185cb6a9b4d95357107f481"
- integrity sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==
- dependencies:
- reusify "^1.0.4"
-
+favico.js@^0.3.10:
+ version "0.3.10"
+ resolved "https://registry.yarnpkg.com/favico.js/-/favico.js-0.3.10.tgz#80586e27a117f24a8d51c18a99bdc714d4339301"
+ integrity sha1-gFhuJ6EX8kqNUcGKmb3HFNQzkwE=
+
faye-websocket@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4"