Skip to content

Commit

Permalink
chore(Merge branch 'master' into theme-istex-for-istex-corpus): upgra…
Browse files Browse the repository at this point in the history
…de branch
  • Loading branch information
HeleneCreusot committed Sep 5, 2024
2 parents 9de834e + 82b974e commit fc91339
Show file tree
Hide file tree
Showing 40 changed files with 533 additions and 709 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ build:
## Deploy =================================================================

publish: build ## publish version to docker hub
docker build -t cnrsinist/lodex:14.0.59 --build-arg http_proxy --build-arg https_proxy .
docker push cnrsinist/lodex:14.0.59
docker build -t cnrsinist/lodex:14.0.60 --build-arg http_proxy --build-arg https_proxy .
docker push cnrsinist/lodex:14.0.60

## Development =================================================================

Expand Down
184 changes: 94 additions & 90 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"node": ">= 16"
},
"name": "lodex",
"version": "14.0.59",
"version": "14.0.60",
"description": "",
"main": "src/api/index.js",
"browser": {
Expand Down Expand Up @@ -275,7 +275,7 @@
"nodemon": "3.0.3",
"prettier": "^3.2.5",
"sleepjs": "4.0.3",
"webpack": "5.90.3",
"webpack": "5.94.0",
"webpack-bundle-analyzer": "4.10.1",
"webpack-cli": "5.1.4",
"webpack-dev-server": "5.0.2"
Expand Down
8 changes: 4 additions & 4 deletions packages/transformers/src/operations/ARRAY.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { transformer } from './transformer';
import { rawTransformerWithoutArg } from './transformer';

export const valueToArray = value => {
export const valueToArray = (value) => {
const arr = Array.isArray(value) ? value : [value];
return arr.filter(x => x);
return arr.filter((x) => x);
};

const transformation = () => value => transformer(valueToArray, value);
const transformation = () => (value) => rawTransformerWithoutArg(valueToArray, value);

transformation.getMetas = () => ({
name: 'ARRAY',
Expand Down
27 changes: 14 additions & 13 deletions packages/transformers/src/operations/transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const transformer = (func, value) =>
});

export const transformerWithArg = (func, name, value, args) => {
const arg = args.find(a => a.name === name);
const arg = args.find((a) => a.name === name);

if (!arg) {
throw new Error(`Invalid Argument for ${name}`);
Expand All @@ -21,7 +21,7 @@ export const transformerWithArg = (func, name, value, args) => {
return new Promise((resolve, reject) => {
try {
if (Array.isArray(value)) {
resolve(value.map(val => func(val, arg.value)));
resolve(value.map((val) => func(val, arg.value)));
} else {
resolve(func(value, arg.value));
}
Expand All @@ -32,8 +32,8 @@ export const transformerWithArg = (func, name, value, args) => {
};

export const transformerWithTwoArgs = (func, name1, name2, value, args) => {
const arg1 = args.find(a => a.name === name1);
const arg2 = args.find(a => a.name === name2);
const arg1 = args.find((a) => a.name === name1);
const arg2 = args.find((a) => a.name === name2);

if (!arg1 || !arg2) {
throw new Error(`Invalid Argument for ${name1} or ${name2}`);
Expand All @@ -42,7 +42,7 @@ export const transformerWithTwoArgs = (func, name1, name2, value, args) => {
return new Promise((resolve, reject) => {
try {
if (Array.isArray(value)) {
resolve(value.map(val => func(val, arg1.value, arg2.value)));
resolve(value.map((val) => func(val, arg1.value, arg2.value)));
} else {
resolve(func(value, arg1.value, arg2.value));
}
Expand All @@ -53,7 +53,7 @@ export const transformerWithTwoArgs = (func, name1, name2, value, args) => {
};

export const rawTransformerWithArg = (func, name, value, args) => {
const arg = args.find(a => a.name === name);
const arg = args.find((a) => a.name === name);

if (!arg) {
throw new Error(`Invalid Argument for ${name}`);
Expand All @@ -68,10 +68,11 @@ export const rawTransformerWithArg = (func, name, value, args) => {
});
};

export const rawTransformerWithoutArg = (func, value) => new Promise((resolve, reject) => {
try {
resolve(func(value));
} catch (error) {
reject(error);
}
});
export const rawTransformerWithoutArg = (func, value) =>
new Promise((resolve, reject) => {
try {
resolve(func(value));
} catch (error) {
reject(error);
}
});
8 changes: 4 additions & 4 deletions src/api/models/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import config from '../../../config.json';
import path from 'path';
import getLogger from '../services/logger';
import defaultMuiTheme from '../../app/custom/themes/default/defaultTheme';
import deepClone from 'lodash/cloneDeep';
import { cloneDeep, merge } from 'lodash';

import fs from 'fs/promises';

// --- Global variable for the Theme system
export const THEMES_VERSION = '6';
export const THEMES_VERSION = '7';
export const THEMES_FOLDER = '../../app/custom/themes';

// --- Global function for the Theme system
Expand Down Expand Up @@ -155,7 +155,7 @@ const init = async () => {
}
}

let muiTheme = deepClone(defaultMuiTheme);
let muiTheme = cloneDeep(defaultMuiTheme);
if (themeConfig?.configuration?.files?.palette) {
const unVerifiedMuiTheme = getThemeFile(
theme,
Expand All @@ -164,7 +164,7 @@ const init = async () => {

try {
await fs.access(unVerifiedMuiTheme, fs.constants.R_OK);
Object.assign(
muiTheme = merge(
muiTheme,
(await import(unVerifiedMuiTheme)).default,
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/custom/themes/default/lodex-theme.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "6",
"version": "7",
"licence": "CeCILL",
"name": {
"fr": "Système",
Expand Down
Loading

0 comments on commit fc91339

Please sign in to comment.