Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First refactor to use new setup and VLT #180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ trim_trailing_whitespace = true
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
Expand Down
6 changes: 2 additions & 4 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
*.log
build
cache
cypress
node_modules
omelette
Dockerfile
.yarn/cache
*.log
node_modules
36 changes: 0 additions & 36 deletions frontend/.editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/.eslintignore

This file was deleted.

53 changes: 23 additions & 30 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,42 @@
const fs = require('fs');
const path = require('path');
const projectRootPath = __dirname;
const packageJson = require(path.join(projectRootPath, 'package.json'));
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');

let voltoPath = './node_modules/@plone/volto';
let coreLocation;
if (fs.existsSync(`${projectRootPath}/core`))
coreLocation = `${projectRootPath}/core`;
else if (fs.existsSync(`${projectRootPath}/../../core`))
coreLocation = `${projectRootPath}/../../core`;

let configFile;
if (fs.existsSync(`${this.projectRootPath}/tsconfig.json`))
configFile = `${this.projectRootPath}/tsconfig.json`;
else if (fs.existsSync(`${this.projectRootPath}/jsconfig.json`))
configFile = `${this.projectRootPath}/jsconfig.json`;

if (configFile) {
const jsConfig = require(configFile).compilerOptions;
const pathsConfig = jsConfig.paths;
if (pathsConfig['@plone/volto'])
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
}

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

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

module.exports = {
extends: `${voltoPath}/.eslintrc`,
extends: `${coreLocation}/packages/volto/.eslintrc`,
rules: {
'import/no-unresolved': 1,
},
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', '@plone/volto/src'],
['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
['@plone/volto', `${coreLocation}/packages/volto/src`],
[
'@plone/volto-slate',
`${coreLocation}/core/packages/volto-slate/src`,
],
['@plone/registry', `${coreLocation}/packages/registry/src`],
['volto-plone-org', './packages/volto-plone-org/src'],
...addonAliases,
['@package', `${__dirname}/src`],
['@root', `${__dirname}/src`],
['~', `${__dirname}/src`],
],
extensions: ['.js', '.jsx', '.json'],
},
'babel-plugin-root-import': {
rootPathSuffix: 'src',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
},
},
Expand Down
102 changes: 11 additions & 91 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,92 +1,12 @@
logs
*.log
npm-debug.log*
.DS_Store

coverage

# Node
node_modules
coverage
jsdoc
webpack-assets.json
webpack-stats.json
npm-debug.log
dist
junit.xml
eslint.xml
yarn-error.log
build

# Other
.DS_Store
.idea
lighthouse-report.html
.#*
.*project
.settings/
.vscode
*~

# Python
/api/.installed.cfg
/api/.mr.developer.cfg
/api/bin/
/api/develop-eggs/
/api/eggs/
/api/include/
/api/lib/
/api/lib64/
/api/notebook/env/
/api/parts/
/api/share/python-wheels/
/api/src/
/api/var/
/api/venv/
/bin/
/lib/
.Python
include
pip-selfcheck.json
pyvenv.cfg
share

# locales
locales/*.json

# Tests
/tests/bin
/tests/develop-eggs
/tests/parts
/tests/.installed.cfg
*.pyc
geckodriver.log
log.html
output.xml
report.html
selenium-screenshot-*.png
/selenium/
cypress/videos/
cypress/screenshots

# Local environment setup
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# generic
data
omelette

# build
public/critical.css
src/addons/*
/cache

# yarn 3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
acceptance/cypress/videos/
acceptance/node_modules
.storybook-build
build
core
node_modules
results
yarn.lock
16 changes: 16 additions & 0 deletions frontend/.npmignore
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
dockerfiles
acceptance
build
dist
yarn.lock
.storybook
6 changes: 6 additions & 0 deletions frontend/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*stylelint*
public-hoist-pattern[]=*cypress*
public-hoist-pattern[]=*process*
public-hoist-pattern[]=*parcel*
27 changes: 27 additions & 0 deletions frontend/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: local
hooks:
- id: prettier
name: prettier
entry: pnpm exec prettier --write
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
- id: eslint
name: eslint
entry: pnpm exec eslint --max-warnings=0 --fix
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
- id: stylelint
name: stylelint
entry: pnpm exec stylelint --fix
language: system
files: '^packages/.*/src/.*/?.*.(css|scss|less)$'
types: [file]
- id: i18n
name: i18n
entry: make ci-i18n
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
5 changes: 3 additions & 2 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
src/**/CHANGELOG.md
src/**/README.md
.storybook
CHANGELOG.md
README.md
12 changes: 12 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"trailingComma": "all",
"singleQuote": true,
"overrides": [
{
"files": "*.overrides",
"options": {
"parser": "less"
}
}
]
}
Loading
Loading