diff --git a/DEVELOP.md.tpl b/DEVELOP.md.tpl deleted file mode 100644 index cf7da06..0000000 --- a/DEVELOP.md.tpl +++ /dev/null @@ -1,51 +0,0 @@ -# <%= name %> - -## Develop - -Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/) - -1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer` - - npm install -g yo @plone/generator-volto mrs-developer - -1. Create new volto app - - yo @plone/volto my-volto-project --addon <%= addonName %> --skip-install - cd my-volto-project - -1. Add the following to `mrs.developer.json`: - - { - "<%= name %>": { - "url": "https://github.com/eea/<%= name %>.git", - "package": "<%= addonName %>", - "branch": "develop", - "path": "src" - } - } - -1. Install - - yarn develop - yarn - -1. Start backend - - docker pull plone - docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone - - ...wait for backend to setup and start - `Ready to handle requests`: - - docker logs -f plone - - ...you can also check http://localhost:8080/Plone - -1. Start frontend - - yarn start - -1. Go to http://localhost:3000 - -1. Happy hacking! - - cd src/addons/<%= name %>/ diff --git a/Jenkinsfile b/Jenkinsfile index fdda77a..24210e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any environment { - GIT_NAME = "volto-addon-template" + GIT_NAME = "volto-forests-theme" NAMESPACE = "@eeacms" SONARQUBE_TAGS = "volto.eea.europa.eu" DEPENDENCIES = "" diff --git a/Jenkinsfile.tpl b/Jenkinsfile.tpl deleted file mode 100644 index c6d1bcb..0000000 --- a/Jenkinsfile.tpl +++ /dev/null @@ -1,209 +0,0 @@ -pipeline { - agent any - - environment { - GIT_NAME = "<%= name %>" - NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu" - DEPENDENCIES = "" - } - - stages { - - stage('Code') { - steps { - parallel( - - "ES lint": { - node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci eslint''' - } - }, - - "Style lint": { - node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci stylelint''' - } - }, - - "Prettier": { - node(label: 'docker') { - sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci prettier''' - } - } - ) - } - } - - stage('Tests') { - steps { - parallel( - - "Volto": { - node(label: 'docker') { - script { - try { - sh '''docker pull plone/volto-addon-ci''' - sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci''' - sh '''rm -rf xunit-reports''' - sh '''mkdir -p xunit-reports''' - sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/''' - sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/junit.xml xunit-reports/''' - sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/unit_tests_log.txt xunit-reports/''' - stash name: "xunit-reports", includes: "xunit-reports/**" - archiveArtifacts artifacts: "xunit-reports/unit_tests_log.txt", fingerprint: true - publishHTML (target : [ - allowMissing: false, - alwaysLinkToLastBuild: true, - keepAll: true, - reportDir: 'xunit-reports/coverage/lcov-report', - reportFiles: 'index.html', - reportName: 'UTCoverage', - reportTitles: 'Unit Tests Code Coverage' - ]) - } finally { - catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { - junit testResults: 'xunit-reports/junit.xml', allowEmptyResults: true - } - sh script: '''docker rm -v $BUILD_TAG-volto''', returnStatus: true - } - } - } - } - ) - } - } - - stage('Integration tests') { - steps { - parallel( - - "Cypress": { - node(label: 'docker') { - script { - try { - sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg''' - sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress''' - } finally { - try { - sh '''rm -rf cypress-reports cypress-results cypress-coverage''' - sh '''mkdir -p cypress-reports cypress-results cypress-coverage''' - sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/''' - sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/''' - coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true - if ( coverage == 0 ) { - publishHTML (target : [allowMissing: false, - alwaysLinkToLastBuild: true, - keepAll: true, - reportDir: 'cypress-coverage/coverage/lcov-report', - reportFiles: 'index.html', - reportName: 'CypressCoverage', - reportTitles: 'Integration Tests Code Coverage']) - } - archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true - stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true - } - finally { - catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { - junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true - } - sh script: "docker stop $BUILD_TAG-plone", returnStatus: true - sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true - sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true - - } - } - } - } - } - - ) - } - } - - stage('Report to SonarQube') { - // Exclude Pull-Requests - when { - allOf { - environment name: 'CHANGE_ID', value: '' - } - } - steps { - node(label: 'swarm') { - script{ - checkout scm - unstash "xunit-reports" - unstash "cypress-coverage" - def scannerHome = tool 'SonarQubeScanner'; - def nodeJS = tool 'NodeJS11'; - withSonarQubeEnv('Sonarqube') { - sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info''' - sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER" - sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done''' - } - } - } - } - } - - stage('Pull Request') { - when { - not { - environment name: 'CHANGE_ID', value: '' - } - environment name: 'CHANGE_TARGET', value: 'master' - } - steps { - node(label: 'docker') { - script { - if ( env.CHANGE_BRANCH != "develop" && !( env.CHANGE_BRANCH.startsWith("hotfix")) ) { - error "Pipeline aborted due to PR not made from develop or hotfix branch" - } - withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) { - sh '''docker pull eeacms/gitflow''' - sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-pr" -e GIT_CHANGE_TARGET="$CHANGE_TARGET" -e GIT_CHANGE_BRANCH="$CHANGE_BRANCH" -e GIT_CHANGE_AUTHOR="$CHANGE_AUTHOR" -e GIT_CHANGE_TITLE="$CHANGE_TITLE" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" -e LANGUAGE=javascript eeacms/gitflow''' - } - } - } - } - } - - stage('Release') { - when { - allOf { - environment name: 'CHANGE_ID', value: '' - branch 'master' - } - } - steps { - node(label: 'docker') { - withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) { - sh '''docker pull eeacms/gitflow''' - sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow''' - } - } - } - } - - } - - post { - always { - cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, deleteDirs: true) - } - changed { - script { - def details = """

${env.JOB_NAME} - Build #${env.BUILD_NUMBER} - ${currentBuild.currentResult}

-

Check console output at ${env.JOB_BASE_NAME} - #${env.BUILD_NUMBER}

- """ - emailext( - subject: '$DEFAULT_SUBJECT', - body: details, - attachLog: true, - compressLog: true, - recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'CulpritsRecipientProvider']] - ) - } - } - } -} diff --git a/Makefile b/Makefile index 3dd20b6..a259c2a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ SHELL=/bin/bash DIR=$(shell basename $$(pwd)) -ADDON ?= "@eeacms/volto-addon-template" +ADDON ?= "@eeacms/volto-forests-theme" # We like colors # From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects @@ -37,3 +37,4 @@ start-backend-docker: ## Starts a Docker-based backend .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 :)" + diff --git a/Makefile.tpl b/Makefile.tpl deleted file mode 100644 index 23ba5d9..0000000 --- a/Makefile.tpl +++ /dev/null @@ -1,39 +0,0 @@ -SHELL=/bin/bash - -DIR=$(shell basename $$(pwd)) -ADDON ?= "<%= addonName %>" - -# 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 :)" diff --git a/README.md.tpl b/README.md.tpl deleted file mode 100644 index b914d15..0000000 --- a/README.md.tpl +++ /dev/null @@ -1,86 +0,0 @@ -# <%= name %> -[![Releases](https://img.shields.io/github/v/release/eea/<%= name %>)](https://github.com/eea/<%= name %>/releases) -[![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2F<%= name %>%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/<%= name %>/job/master/display/redirect) -[![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2F<%= name %>%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/<%= name %>/job/develop/display/redirect) - -[Volto](https://github.com/plone/volto) add-on - -## Features - -Demo GIF - -## Getting started - -### Try <%= name %> with Docker - -1. Get the latest Docker images - - ``` - docker pull plone - docker pull plone/volto - ``` - -1. Start Plone backend - ``` - docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone - ``` - -1. Start Volto frontend - - ``` - docker run -it --rm -p 3000:3000 --link plone -e ADDONS="<%= addonName %>" plone/volto - ``` - -1. Go to http://localhost:3000 - -### Add <%= name %> to your Volto project - -1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone - -1. Start Volto frontend - -* If you already have a volto project, just update `package.json`: - - ```JSON - "addons": [ - "<%= addonName %>" - ], - - "dependencies": { - "<%= addonName %>": "^1.0.0" - } - ``` - -* If not, create one: - - ``` - npm install -g yo @plone/generator-volto - yo @plone/volto my-volto-project --addon <%= addonName %> - cd my-volto-project - ``` - -1. Install new add-ons and restart Volto: - - ``` - yarn - yarn start - ``` - -1. Go to http://localhost:3000 - -1. Happy editing! - -## How to contribute - -See [DEVELOP.md](https://github.com/eea/<%= name %>/blob/master/DEVELOP.md). - -## Copyright and license - -The Initial Owner of the Original Code is European Environment Agency (EEA). -All Rights Reserved. - -See [LICENSE.md](https://github.com/eea/<%= name %>/blob/master/LICENSE.md) for details. - -## Funding - -[European Environment Agency (EU)](http://eea.europa.eu) diff --git a/package.json b/package.json index 6fbb542..9d545e5 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "@eeacms/volto-addon-template", + "name": "@eeacms/volto-forests-theme", "version": "0.1.0", - "description": "@eeacms/volto-addon-template: Volto add-on", + "description": "@eeacms/volto-forests-theme: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", "license": "MIT", - "homepage": "https://github.com/eea/volto-addon-template", + "homepage": "https://github.com/eea/volto-forests-theme", "keywords": [ "volto-addon", "volto", @@ -14,7 +14,7 @@ ], "repository": { "type": "git", - "url": "git@github.com:eea/volto-addon-template.git" + "url": "git@github.com:eea/volto-forests-theme.git" }, "dependencies": { }, diff --git a/package.json.tpl b/package.json.tpl deleted file mode 100644 index 338bc74..0000000 --- a/package.json.tpl +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "<%= addonName %>", - "version": "0.1.0", - "description": "<%= addonName %>: Volto add-on", - "main": "src/index.js", - "author": "European Environment Agency: IDM2 A-Team", - "license": "MIT", - "homepage": "https://github.com/eea/<%= name %>", - "keywords": [ - "volto-addon", - "volto", - "plone", - "react" - ], - "repository": { - "type": "git", - "url": "git@github.com:eea/<%= name %>.git" - }, - "dependencies": { - }, - "devDependencies": { - "@cypress/code-coverage": "^3.9.5", - "babel-plugin-transform-class-properties": "^6.24.1" - }, - "scripts": { - "release": "release-it", - "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap", - "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'", - "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'", - "stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix", - "prettier": "../../../node_modules/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'", - "prettier:fix": "../../../node_modules/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'", - "lint": "../../../node_modules/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'", - "lint:fix": "../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'", - "cypress:run": "../../../node_modules/cypress/bin/cypress run", - "cypress:open": "../../../node_modules/cypress/bin/cypress open" - } -}