|
|
@ -1,13 +1,12 @@
|
|
|
|
// Note: You must restart bin/webpack-dev-server for changes to take effect
|
|
|
|
// Note: You must restart bin/webpack-dev-server for changes to take effect
|
|
|
|
|
|
|
|
|
|
|
|
const { existsSync } = require('fs');
|
|
|
|
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const { basename, dirname, join, relative, resolve } = require('path');
|
|
|
|
const { basename, dirname, join, relative, resolve } = require('path');
|
|
|
|
const { sync } = require('glob');
|
|
|
|
const { sync } = require('glob');
|
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
|
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
|
|
|
const extname = require('path-complete-extname');
|
|
|
|
const extname = require('path-complete-extname');
|
|
|
|
const { env, settings, output, loadersDir } = require('./configuration.js');
|
|
|
|
const { env, settings, themes, output, loadersDir } = require('./configuration.js');
|
|
|
|
const localePackPaths = require('./generateLocalePacks');
|
|
|
|
const localePackPaths = require('./generateLocalePacks');
|
|
|
|
|
|
|
|
|
|
|
|
const extensionGlob = `**/*{${settings.extensions.join(',')}}*`;
|
|
|
|
const extensionGlob = `**/*{${settings.extensions.join(',')}}*`;
|
|
|
@ -15,20 +14,27 @@ const entryPath = join(settings.source_path, settings.source_entry_path);
|
|
|
|
const packPaths = sync(join(entryPath, extensionGlob));
|
|
|
|
const packPaths = sync(join(entryPath, extensionGlob));
|
|
|
|
const entryPacks = [...packPaths, ...localePackPaths].filter(path => path !== join(entryPath, 'custom.js'));
|
|
|
|
const entryPacks = [...packPaths, ...localePackPaths].filter(path => path !== join(entryPath, 'custom.js'));
|
|
|
|
|
|
|
|
|
|
|
|
const customApplicationStyle = resolve(join(settings.source_path, 'styles/custom.scss'));
|
|
|
|
const themePaths = Object.keys(themes).reduce(
|
|
|
|
const originalApplicationStyle = resolve(join(settings.source_path, 'styles/application.scss'));
|
|
|
|
(themePaths, name) => {
|
|
|
|
|
|
|
|
const themeData = themes[name];
|
|
|
|
|
|
|
|
themePaths[`themes/${name}`] = resolve(themeData.pack_directory, themeData.pack);
|
|
|
|
|
|
|
|
return themePaths;
|
|
|
|
|
|
|
|
}, {}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
module.exports = {
|
|
|
|
entry: entryPacks.reduce(
|
|
|
|
entry: Object.assign(
|
|
|
|
(map, entry) => {
|
|
|
|
entryPacks.reduce(
|
|
|
|
const localMap = map;
|
|
|
|
(map, entry) => {
|
|
|
|
let namespace = relative(join(entryPath), dirname(entry));
|
|
|
|
const localMap = map;
|
|
|
|
if (namespace === join('..', '..', '..', 'tmp', 'packs')) {
|
|
|
|
let namespace = relative(join(entryPath), dirname(entry));
|
|
|
|
namespace = ''; // generated by generateLocalePacks.js
|
|
|
|
if (namespace === join('..', '..', '..', 'tmp', 'packs')) {
|
|
|
|
}
|
|
|
|
namespace = ''; // generated by generateLocalePacks.js
|
|
|
|
localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry);
|
|
|
|
}
|
|
|
|
return localMap;
|
|
|
|
localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry);
|
|
|
|
}, {}
|
|
|
|
return localMap;
|
|
|
|
|
|
|
|
}, {}
|
|
|
|
|
|
|
|
), themePaths
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
output: {
|
|
|
|
output: {
|
|
|
@ -59,10 +65,6 @@ module.exports = {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
resolve: {
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
|
|
|
|
'mastodon-application-style': existsSync(customApplicationStyle) ?
|
|
|
|
|
|
|
|
customApplicationStyle : originalApplicationStyle,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
extensions: settings.extensions,
|
|
|
|
extensions: settings.extensions,
|
|
|
|
modules: [
|
|
|
|
modules: [
|
|
|
|
resolve(settings.source_path),
|
|
|
|
resolve(settings.source_path),
|
|
|
|