Skip to content

Commit

Permalink
Merge pull request #6 from eea/upgrade-latest-volto
Browse files Browse the repository at this point in the history
upgrade to latest volto and adapt to new Blocks/extensibility system
  • Loading branch information
valentinab25 authored Mar 16, 2021
2 parents e0e5a4a + b478ed3 commit a1c03ba
Show file tree
Hide file tree
Showing 56 changed files with 22,810 additions and 30,780 deletions.
75 changes: 0 additions & 75 deletions .eslintrc

This file was deleted.

41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const jsConfig = require('./jsconfig').compilerOptions;
const path = require('path');
const projectRootPath = __dirname;
const packageJson = require(path.join(projectRootPath, 'package.json'));

const pathsConfig = jsConfig.paths;
let voltoPath = './node_modules/@plone/volto';
Object.keys(pathsConfig).forEach(pkg => {
if (pkg === '@plone/volto') {
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
}
});

const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
const reg = new AddonConfigurationRegistry(__dirname);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
const addonAliases = Object.keys(reg.packages).map(o => [
o,
reg.packages[o].modulePath,
]);

module.exports = {
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', '@plone/volto/src'],
...addonAliases,
['@package', `${__dirname}/src`],
['~', `${__dirname}/src`],
],
extensions: ['.js', '.jsx', '.json'],
},
'babel-plugin-root-import': {
rootPathSuffix: 'src',
},
},
},
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ data
src/develop
src/addons
npm-cache
omelette
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.vscode/
logs
*.log
npm-debug.log*
.DS_Store

coverage
node_modules
build
.env.local
.env.development.local
.env.test.local
.env.production.local

data
omelette
74 changes: 11 additions & 63 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,74 +1,22 @@
# Based on https://github.com/plone/volto/blob/master/entrypoint.sh
FROM node:12-stretch-slim

FROM node:10-jessie as build

ARG NPM_CONFIG_REGISTRY
ARG MAX_OLD_SPACE_SIZE=8192

ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE

RUN apt-get update -y \
&& apt-get install -y git bsdmainutils vim-nox mc \
RUN runDeps="openssl ca-certificates patch" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $runDeps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN npm i -g mrs-developer
COPY . /opt/frontend/
RUN chown -R node /opt/frontend/

WORKDIR /opt/frontend/

COPY . .
# RUN chmod +x optimize_node_modules.sh

RUN mkdir -p /opt/frontend/src/develop

RUN chown -R node /opt/frontend

USER node

RUN echo "prefix = \"/home/node\"\n" > /home/node/.npmrc
RUN rm -rf node_modules .git package-lock.json

# RUN npm install mr-developer

#RUN node_modules/.bin/mrdeveloper --config=jsconfig.json --no-config --output=addons
RUN missdev

RUN make activate-all

# RUN NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY npm ci
RUN NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY npm install

# RUN ./optimize_node_modules.sh
# RUN make clean-addons
# RUN rm -f package-lock.json

RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build

# Second stage build
FROM node:10-jessie

RUN apt-get update -y \
&& apt-get install -y git bsdmainutils vim-nox mc \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt/frontend/

COPY entrypoint-prod.sh /opt/frontend/entrypoint.sh
RUN chmod +x entrypoint.sh

COPY package.json .
COPY package-lock.json .

COPY --from=build /opt/frontend/public ./public
COPY --from=build /opt/frontend/build ./build

RUN chown -R node /opt/frontend

USER node

RUN rm -rf package-lock.json
RUN NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY npm install --production
RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn \
&& RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build \
&& rm -rf /home/node/.cache

EXPOSE 3000 3001 4000 4001

ENTRYPOINT ["/opt/frontend/entrypoint-prod.sh"]
CMD ["yarn", "start:prod"]
CMD ["yarn", "start:prod"]
14 changes: 1 addition & 13 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
const baseCfg = require('@plone/volto/babel');
// "react-loadable/babel"

module.exports = function(api) {
const voltoConfig = baseCfg(api);
const presets = voltoConfig.presets;
const plugins = [...voltoConfig.plugins];
return {
plugins,
presets,
sourceType: 'unambiguous',
};
};
module.exports = require('@plone/volto/babel');
24 changes: 24 additions & 0 deletions create-sentry-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
PARAM=$1
if [ -z $PARAM ]; then
PARAM='not forced'
fi
if [ ! -z "$SENTRY_AUTH_TOKEN" ] && [ ! -z "$SENTRY_URL" ] && [ ! -z "$SENTRY_ORG" ] && [ ! -z "$SENTRY_PROJECT" ] && [ ! -z "$SENTRY_RELEASE" ]; then
CREATE=1
if [[ ! $PARAM = '--force' ]]; then
if ./node_modules/@sentry/cli/sentry-cli releases info $SENTRY_RELEASE | grep -q $SENTRY_RELEASE; then
CREATE=0
fi
fi
if [ $CREATE = 1 ]; then
./node_modules/@sentry/cli/sentry-cli releases new $SENTRY_RELEASE
./node_modules/@sentry/cli/sentry-cli releases files $SENTRY_RELEASE upload ./build/public/static/ --url-prefix "~/static"
./node_modules/@sentry/cli/sentry-cli releases finalize $SENTRY_RELEASE
fi
if [ $CREATE = 0 ]; then
echo "Release $SENTRY_RELEASE already exists"
echo "Use --force if you still want to upload the source maps"
fi
else
echo "SENTRY is not configured"
fi
2 changes: 1 addition & 1 deletion entrypoint-prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ -z "$TIMEOUT" ]; then
fi

if [ -z "$RAZZLE_API_PATH" ]; then
RAZZLE_API_PATH="http://plone:8080/Plone"
RAZZLE_API_PATH="http://plone:8080/energy"
fi

if [ -z "$CYPRESS_API_PATH" ]; then
Expand Down
50 changes: 4 additions & 46 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,6 @@
{
"addons": [
"volto-addons",
"volto-blocks",
"volto-ckeditor",
"volto-corsproxy",
"volto-datablocks",
"volto-drafteditor",
"volto-mosaic",
"volto-plotlycharts",
"volto-sidebar"
],
"compilerOptions": {
"baseUrl": "src",
"paths": {
"volto-addons": [
"develop/volto-addons/src"
],
"volto-base": [
"develop/volto-base/src"
],
"volto-blocks": [
"develop/volto-blocks/src"
],
"volto-ckeditor": [
"develop/volto-ckeditor/src"
],
"volto-datablocks": [
"develop/volto-datablocks/src"
],
"volto-drafteditor": [
"develop/volto-drafteditor/src"
],
"volto-embed": [
"develop/volto-embed/src"
],
"volto-mosaic": [
"develop/volto-mosaic/src"
],
"volto-plotlycharts": [
"develop/volto-plotlycharts/src"
],
"volto-sidebar": [
"develop/volto-sidebar/src"
]
}
}
"compilerOptions": {
"paths": {},
"baseUrl": "src"
}
}
Loading

0 comments on commit a1c03ba

Please sign in to comment.