Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* volto-guillotina, initial commit * Integrate Cypress infrastructure with it * Add support for customizations in testing addons * Volto logo in Guillotina * Backport ongoing actions override for sharing * Changelog
- Loading branch information
Showing
15 changed files
with
308 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.vscode/ | ||
.history | ||
logs | ||
*.log | ||
npm-debug.log* | ||
.DS_Store | ||
*.swp | ||
yarn-error.log | ||
|
||
node_modules | ||
build | ||
dist | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const projectRootPath = fs.realpathSync('./project'); // __dirname | ||
const packageJson = require(path.join(projectRootPath, 'package.json')); | ||
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions; | ||
|
||
const pathsConfig = jsConfig.paths; | ||
|
||
let voltoPath = path.join(projectRootPath, '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(projectRootPath); | ||
|
||
// 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', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Yeoman Volto App development | ||
|
||
### Defensive settings for make: | ||
# https://tech.davis-hansson.com/p/make/ | ||
SHELL:=bash | ||
.ONESHELL: | ||
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c | ||
.SILENT: | ||
.DELETE_ON_ERROR: | ||
MAKEFLAGS+=--warn-undefined-variables | ||
MAKEFLAGS+=--no-builtin-rules | ||
|
||
# Project settings | ||
|
||
DIR=$(shell basename $$(pwd)) | ||
ADDON ?= "@plone/volto-guillotina" | ||
|
||
# Recipe snippets for reuse | ||
|
||
# We like colors | ||
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects | ||
RED=`tput setaf 1` | ||
GREEN=`tput setaf 2` | ||
RESET=`tput sgr0` | ||
YELLOW=`tput setaf 3` | ||
|
||
|
||
# Top-level targets | ||
|
||
.PHONY: project | ||
project: | ||
npm install -g yo | ||
npm install -g @plone/generator-volto | ||
npm install -g mrs-developer | ||
yo @plone/volto project --addon ${ADDON} --workspace "src/addons/${DIR}" --no-interactive | ||
ln -sf $$(pwd) project/src/addons/ | ||
cp .project.eslintrc.js .eslintrc.js | ||
cd project && yarn | ||
@echo "-------------------" | ||
@echo "$(GREEN)Volto project is ready!$(RESET)" | ||
@echo "$(RED)Now run: cd project && yarn start$(RESET)" | ||
|
||
.PHONY: all | ||
all: project | ||
|
||
.PHONY: start-test-backend | ||
start-test-backend: ## Start Test Plone Backend | ||
@echo "$(GREEN)==> Start Test Plone Backend$(RESET)" | ||
docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e SITE=plone -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING | ||
|
||
.PHONY: start-backend-docker | ||
start-backend-docker: ## Starts a Docker-based backend | ||
@echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)" | ||
docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="kitconcept.volto" -e ZCML="kitconcept.volto.cors" plone | ||
|
||
.PHONY: help | ||
help: ## Show this help. | ||
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = function (api) { | ||
api.cache(true); | ||
const presets = ['razzle/babel']; | ||
const plugins = [ | ||
[ | ||
'react-intl', // React Intl extractor, required for the whole i18n infrastructure to work | ||
{ | ||
messagesDir: './build/messages/', | ||
}, | ||
], | ||
]; | ||
|
||
return { | ||
plugins, | ||
presets, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Plone\n" | ||
"POT-Creation-Date: 2021-01-29T12:34:47.097Z\n" | ||
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n" | ||
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=1; plural=0;\n" | ||
"Language-Code: en\n" | ||
"Language-Name: English\n" | ||
"Preferred-Encodings: utf-8\n" | ||
"Domain: volto\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@plone/volto-guillotina", | ||
"version": "0.1.0", | ||
"description": "volto-guillotina: Volto add-on", | ||
"main": "src/index.js", | ||
"license": "MIT", | ||
"keywords": [ | ||
"volto-addon", | ||
"volto", | ||
"plone", | ||
"react" | ||
], | ||
"scripts": { | ||
"i18n": "rm -rf build/messages && NODE_ENV=production i18n --addon" | ||
}, | ||
"dependencies": { | ||
"@plone/scripts": "*" | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
packages/volto-guillotina/src/customizations/volto/actions/sharing/sharing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Sharing actions. | ||
* @module actions/sharing/sharing | ||
*/ | ||
|
||
import { | ||
UPDATE_SHARING, | ||
GET_SHARING, | ||
} from '@plone/volto/constants/ActionTypes'; | ||
|
||
/** | ||
* Update sharing function. | ||
* @function updateSharing | ||
* @param {string} url Content url. | ||
* @param {Object} sharing Sharing data. | ||
* @returns {Object} Update sharing action. | ||
*/ | ||
export function updateSharing(url, sharing) { | ||
return { | ||
type: UPDATE_SHARING, | ||
request: { | ||
op: 'post', | ||
path: `${url}/@grant`, | ||
data: sharing, | ||
}, | ||
}; | ||
} | ||
|
||
/** | ||
* Get sharing function. | ||
* @function getSharing | ||
* @param {string} url Content url. | ||
* @param {string} search Search value. | ||
* @returns {Object} Get sharing action. | ||
*/ | ||
export function getSharing(url, search = '') { | ||
return { | ||
type: GET_SHARING, | ||
request: { | ||
op: 'get', | ||
path: `${url}/@grant${search !== '' ? `?search=${search}` : ''}`, | ||
}, | ||
}; | ||
} |
41 changes: 41 additions & 0 deletions
41
packages/volto-guillotina/src/customizations/volto/actions/sharing/sharing.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { updateSharing, getSharing } from './sharing'; | ||
import { | ||
UPDATE_SHARING, | ||
GET_SHARING, | ||
} from '@plone/volto/constants/ActionTypes'; | ||
|
||
describe('Sharing action', () => { | ||
describe('updateSharing', () => { | ||
it('should create an action to update sharing', () => { | ||
const url = 'http://localhost'; | ||
const sharing = 'Hello World!'; | ||
const action = updateSharing(url, sharing); | ||
|
||
expect(action.type).toEqual(UPDATE_SHARING); | ||
expect(action.request.op).toEqual('post'); | ||
expect(action.request.path).toEqual(`${url}/@sharing`); | ||
expect(action.request.data).toEqual(sharing); | ||
}); | ||
}); | ||
|
||
describe('getSharing', () => { | ||
it('should create an action to get sharing', () => { | ||
const url = 'http://localhost'; | ||
const action = getSharing(url); | ||
|
||
expect(action.type).toEqual(GET_SHARING); | ||
expect(action.request.op).toEqual('get'); | ||
expect(action.request.path).toEqual(`${url}/@sharing`); | ||
}); | ||
|
||
it('should create an action to get sharing with search param', () => { | ||
const url = 'http://localhost'; | ||
const search = 'admin'; | ||
const action = getSharing(url, search); | ||
|
||
expect(action.type).toEqual(GET_SHARING); | ||
expect(action.request.op).toEqual('get'); | ||
expect(action.request.path).toEqual(`${url}/@sharing?search=${search}`); | ||
}); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/volto-guillotina/src/customizations/volto/components/theme/Logo/Logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const applyConfig = (config) => { | ||
return config; | ||
}; | ||
|
||
export default applyConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters