generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from eea/develop
Release copy/paste fix
- Loading branch information
Showing
19 changed files
with
609 additions
and
72 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
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
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,49 @@ | ||
SHELL=/bin/bash | ||
|
||
DIR=$(shell basename $$(pwd)) | ||
ADDON ?= "@eeacms/volto-slate-footnote" | ||
|
||
# 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` | ||
|
||
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)" | ||
|
||
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 :)" | ||
|
||
.PHONY: test | ||
test: | ||
docker pull plone/volto-addon-ci | ||
docker run -it --rm -e GIT_NAME=volto-slate -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/volto-slate" plone/volto-addon-ci yarn test --watchAll=false | ||
|
||
.PHONY: test-update | ||
test-update: | ||
docker pull plone/volto-addon-ci | ||
docker run -it --rm -e GIT_NAME=volto-slate -e RAZZLE_JEST_CONFIG=jest-addon.config.js -v "$$(pwd):/opt/frontend/my-volto-project/src/addons/volto-slate" plone/volto-addon-ci yarn test --watchAll=false -u |
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,63 @@ | ||
import { setupBeforeEach, tearDownAfterEach } from '../support'; | ||
|
||
describe('Blocks Tests', () => { | ||
beforeEach(setupBeforeEach); | ||
afterEach(tearDownAfterEach); | ||
|
||
it('Add Block and create footnote', () => { | ||
// Change page title | ||
cy.get('.documentFirstHeading > .public-DraftStyleDefault-block') | ||
.clear() | ||
.type('My Add-on Page') | ||
.get('.documentFirstHeading span[data-text]') | ||
.contains('My Add-on Page'); | ||
|
||
cy.get('.documentFirstHeading > .public-DraftStyleDefault-block').type( | ||
'{enter}', | ||
); | ||
|
||
// Add some text with footnotes | ||
cy.get('.slate-editor [contenteditable=true]') | ||
.focus() | ||
.click() | ||
.wait(1000) | ||
.type('Colorless green ideas sleep furiously.'); | ||
|
||
cy.get('.slate-editor.selected [contenteditable=true]').setSelection( | ||
'furiously', | ||
); | ||
|
||
cy.wait(500); | ||
|
||
cy.get('.slate-inline-toolbar .button-wrapper a[title="Footnote"]').click(); | ||
cy.get('.sidebar-container [id=field-footnote]').click().type('Citation'); | ||
cy.get('.sidebar-container .form .header button:first-of-type').click(); | ||
|
||
// Add block | ||
cy.get('.slate-editor [contenteditable=true]') | ||
.focus() | ||
.click() | ||
.wait(1000) | ||
.type('{enter}'); | ||
|
||
cy.get('.ui.basic.icon.button.block-add-button').first().click(); | ||
cy.get('.blocks-chooser .title').contains('Text').click(); | ||
cy.get('.content.active.text .button.slateFootnotes') | ||
.contains('Footnotes') | ||
.click(); | ||
|
||
// Configure block | ||
cy.get('[id=sidebar-properties] [name=title]').click().type('Footnotes'); | ||
cy.get('[id=sidebar-properties] label[for=field-global]').click(); | ||
|
||
// Save | ||
cy.get('#toolbar-save').click(); | ||
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page'); | ||
|
||
// then the page view should contain our changes | ||
cy.contains('My Add-on Page'); | ||
cy.get('span.citation-item').contains('furiously'); | ||
cy.contains('Footnotes'); | ||
cy.contains('Citation'); | ||
}); | ||
}); |
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 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
Oops, something went wrong.