Skip to content
Snippets Groups Projects
Unverified Commit 4d891a60 authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #3414 from ProjectMirador/cbeer-patch-2

Update dev dependencies
parents a1652fe9 3f8803f8
Branches
Tags
No related merge requests found
const path = require('path');
const fs = require('fs');
const url = require('url');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebook/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
/**
*
* @param relativePath
* @returns {string}
*/
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
const envPublicUrl = process.env.PUBLIC_URL;
/**
*
* @param inputPath
* @param needsSlash
* @returns {*}
*/
function ensureSlash(inputPath, needsSlash) {
const hasSlash = inputPath.endsWith('/');
if (hasSlash && !needsSlash) {
return inputPath.substr(0, inputPath.length - 1);
} else if (!hasSlash && needsSlash) {
return `${inputPath}/`;
} else {
return inputPath;
}
}
/**
*
* @param appPackageJson
* @returns {string | *}
*/
const getPublicUrl = appPackageJson => envPublicUrl || require(appPackageJson).homepage;
/**
*
* @param appPackageJson
* @returns {*}
*/
function getServedPath(appPackageJson) {
const publicUrl = getPublicUrl(appPackageJson);
const servedUrl =
envPublicUrl || (publicUrl ? url.parse(publicUrl).pathname : '/');
return ensureSlash(servedUrl, true);
}
const moduleFileExtensions = [
'web.mjs',
'mjs',
'web.js',
'js',
'web.ts',
'ts',
'web.tsx',
'tsx',
'json',
'web.jsx',
'jsx',
];
/**
*
* @param resolveFn
* @param filePath
* @returns {*}
*/
const resolveModule = (resolveFn, filePath) => {
const extension = moduleFileExtensions.find(extension => fs.existsSync(resolveFn(`${filePath}.${extension}`)));
if (extension) {
return resolveFn(`${filePath}.${extension}`);
}
return resolveFn(`${filePath}.js`);
};
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp('build'),
appDist: resolveApp('dist'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
appNodeModules: resolveApp('node_modules'),
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json')),
};
module.exports.moduleFileExtensions = moduleFileExtensions;
......@@ -16,7 +16,7 @@ export default function PluginProvider(props) {
const connectedPlugins = connectPluginsToStore(plugins);
addPluginsToCompanionWindowsRegistry(connectedPlugins);
setPluginMap(createTargetToPluginMapping(connectedPlugins));
}, []);
}, [plugins]);
return (
<PluginContext.Provider value={pluginMap}>
......
......@@ -14,8 +14,10 @@ import sr from './locales/sr/translation.json';
import lt from './locales/lt/translation.json';
import vi from './locales/vi/translation.json';
export default () => {
// Load translations for each language
/**
* Load translations for each language
*/
function createI18nInstance() {
const resources = {
ar,
de,
......@@ -43,4 +45,6 @@ export default () => {
});
return instance;
};
}
export default createI18nInstance;
......@@ -18,9 +18,11 @@ const mirador2 = {
ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em', 'ul', 'ol', 'li'],
};
export default {
const htmlRules = {
iiif,
liberal,
mirador2,
noHtml,
};
export default htmlRules;
......@@ -14,7 +14,7 @@ import settings from '../config/settings';
/**
* Configure Store
*/
export default function (pluginReducers, pluginSagas = []) {
function configureStore(pluginReducers, pluginSagas = []) {
const miradorReducer = createRootReducer(pluginReducers);
const rootReducer = settings.state.slice
......@@ -38,3 +38,5 @@ export default function (pluginReducers, pluginSagas = []) {
return store;
}
export default configureStore;
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const paths = require('./config/paths');
/** */
const baseConfig = mode => ({
......@@ -10,7 +10,7 @@ const baseConfig = mode => ({
module: {
rules: [
{
include: paths.appPath, // CRL
include: path.resolve(fs.realpathSync(process.cwd()), '.'), // CRL
loader: require.resolve('babel-loader'),
options: {
// Save disk space when time isn't as important
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment