Skip to content

Commit

Permalink
fix: import releaselog without try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Nov 9, 2023
1 parent ba25d47 commit b93b92c
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/components/ReleaseLog/ReleaseLog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,21 @@ import {
} from 'design-react-kit';
import { Helmet } from '@plone/volto/helpers';
import { marked } from 'marked';

import config from '@plone/volto/registry';
import './ReleaseLog.css';

const ReleaseLog = () => {
let ReleaseDCPT = null;
let ReleaseIoCittadino = null;
let ReleaseIoPrenoto = null;
try {
ReleaseDCPT = require('design-comuni-plone-theme/../RELEASE.md');
} catch {
console.log("design-comuni-plone-theme/../RELEASE.md doesn't exists");
}
try {
ReleaseIoCittadino = require('@redturtle/volto-io-cittadino/../RELEASE.md');
} catch {
console.log("@redturtle/volto-io-cittadino/../RELEASE.md doesn't exists");
}
try {
ReleaseIoPrenoto = require('@redturtle/volto-io-prenoto/../RELEASE.md');
} catch {
console.log("@redturtle/volto-io-prenoto/../RELEASE.md doesn't exists");
}
const { addonsInfo } = config.settings;
const addons = addonsInfo.map((addon) => addon.name);
const ReleaseDCPT = addons.includes('design-comuni-plone-theme')
? require('design-comuni-plone-theme/../RELEASE.md')
: null;
const ReleaseIoCittadino = addons.includes('@redturtle/volto-io-cittadino')
? require('@redturtle/volto-io-cittadino/../RELEASE.md')
: null;
const ReleaseIoPrenoto = addons.includes('@redturtle/volto-io-prenoto')
? require('@redturtle/volto-io-prenoto/../RELEASE.md')
: null;

const LOGS_TO_VIEW = [
{ name: 'io-Comune', file: ReleaseDCPT },
Expand Down

0 comments on commit b93b92c

Please sign in to comment.