Skip to content

Commit 7e4e2d4

Browse files
committed
Initial commit
0 parents  commit 7e4e2d4

26 files changed

+1033
-0
lines changed

.coverage.babel.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const defaultBabel = require('@plone/volto/babel');
2+
3+
function applyDefault(api) {
4+
const voltoBabel = defaultBabel(api);
5+
voltoBabel.plugins.push('@babel/plugin-transform-modules-commonjs', 'transform-class-properties', 'istanbul');
6+
return voltoBabel;
7+
}
8+
9+
module.exports = applyDefault;

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules

.github/workflows/tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
name: Run test suite
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Build container
18+
run: docker-compose -f docker-compose.yml build
19+
20+
- name: Run tests
21+
run: docker-compose -f docker-compose.yml run ci

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.vscode/
2+
.history
3+
.eslintrc.js
4+
project
5+
logs
6+
*.log
7+
npm-debug.log*
8+
.DS_Store
9+
*.sw?
10+
yarn-error.log
11+
yarn.lock
12+
package-lock.json
13+
14+
node_modules
15+
build
16+
dist
17+
cypress/videos
18+
cypress/reports
19+
screenshots
20+
videos
21+
.env.local
22+
.env.development.local
23+
.env.test.local
24+
.env.production.local
25+
*~

.npmignore

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# https://docs.npmjs.com/using-npm/developers.html#keeping-files-out-of-your-package
2+
3+
# Directories
4+
api/
5+
bin/
6+
build/
7+
lib/
8+
g-api/
9+
tests/
10+
11+
# Docs
12+
docs/
13+
14+
# Cypress
15+
cypress/
16+
17+
# Tests
18+
__tests__/
19+
*.snap
20+
21+
# Files
22+
.travis.yml
23+
requirements-docs.txt
24+
requirements-tests.txt
25+
yarn.lock
26+
.dockerignore
27+
.gitattributes
28+
.yarnrc
29+
.nvmrc
30+
changelogupdater.js
31+
pip-selfcheck.json
32+
Dockerfile
33+
CNAME
34+
entrypoint.sh
35+
Jenkinsfile
36+
Makefile
37+
38+
# Logs
39+
logs
40+
*.log
41+
npm-debug.log*
42+
yarn-debug.log*
43+
yarn-error.log*
44+
45+
# Runtime data
46+
pids
47+
*.pid
48+
*.seed
49+
*.pid.lock
50+
51+
# Directory for instrumented libs generated by jscoverage/JSCover
52+
lib-cov
53+
54+
# Coverage directory used by tools like istanbul
55+
coverage
56+
57+
# nyc test coverage
58+
.nyc_output
59+
60+
# node-waf configuration
61+
.lock-wscript
62+
63+
# Compiled binary addons (https://nodejs.org/api/addons.html)
64+
build/Release
65+
66+
# Dependency directories
67+
node_modules/
68+
jspm_packages/
69+
70+
# TypeScript v1 declaration files
71+
typings/
72+
73+
# Optional npm cache directory
74+
.npm
75+
76+
# Optional eslint cache
77+
.eslintcache
78+
79+
# Optional REPL history
80+
.node_repl_history
81+
82+
# Output of 'npm pack'
83+
*.tgz
84+
85+
# Yarn Integrity file
86+
.yarn-integrity
87+
88+
# dotenv environment variables file
89+
.env
90+
91+
# next.js build output
92+
.next
93+
94+
styleguide.config
95+
.vscode
96+
packages

.project.eslintrc.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const projectRootPath = fs.realpathSync('./project'); // __dirname
5+
const packageJson = require(path.join(projectRootPath, 'package.json'));
6+
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
7+
8+
const pathsConfig = jsConfig.paths;
9+
10+
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
11+
12+
Object.keys(pathsConfig).forEach(pkg => {
13+
if (pkg === '@plone/volto') {
14+
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
15+
}
16+
});
17+
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
18+
const reg = new AddonConfigurationRegistry(projectRootPath);
19+
20+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
21+
const addonAliases = Object.keys(reg.packages).map(o => [
22+
o,
23+
reg.packages[o].modulePath,
24+
]);
25+
26+
27+
module.exports = {
28+
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
29+
settings: {
30+
'import/resolver': {
31+
alias: {
32+
map: [
33+
['@plone/volto', '@plone/volto/src'],
34+
...addonAliases,
35+
['@package', `${__dirname}/src`],
36+
['~', `${__dirname}/src`],
37+
],
38+
extensions: ['.js', '.jsx', '.json'],
39+
},
40+
'babel-plugin-root-import': {
41+
rootPathSuffix: 'src',
42+
},
43+
},
44+
},
45+
};
46+

.release-it.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"npm": {
3+
"publish": false
4+
},
5+
"git": {
6+
"changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs",
7+
"tagName": "${version}"
8+
},
9+
"github": {
10+
"release": true,
11+
"releaseName": "${version}",
12+
"releaseNotes": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
13+
},
14+
"hooks": {
15+
"after:bump": "npx auto-changelog --commit-limit false -p"
16+
}
17+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 0.1.0
4+
5+
- Initial release

DEVELOP.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# volto-addon-template
2+
3+
## Develop
4+
5+
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
6+
7+
1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
8+
9+
npm install -g yo @plone/generator-volto mrs-developer
10+
11+
1. Create new volto app
12+
13+
yo @plone/volto my-volto-project --addon volto-middleware-rejectanonymous --skip-install
14+
cd my-volto-project
15+
16+
1. Add the following to `mrs.developer.json`:
17+
18+
{
19+
"volto-addon-template": {
20+
"url": "https://github.com/collective/volto-middleware-rejectanonymous.git",
21+
"package": "volto-middleware-rejectanonymous",
22+
"branch": "main",
23+
"path": "src"
24+
}
25+
}
26+
27+
1. Install
28+
29+
yarn develop
30+
yarn
31+
32+
1. Start backend
33+
34+
docker pull plone
35+
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
36+
37+
...wait for backend to setup and start - `Ready to handle requests`:
38+
39+
docker logs -f plone
40+
41+
...you can also check http://localhost:8080/Plone
42+
43+
1. Start frontend
44+
45+
yarn start
46+
47+
1. Go to http://localhost:3000
48+
49+
1. Happy hacking!
50+
51+
cd src/addons/volto-addon-template/

LICENSE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MIT License
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)