-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #126358 added initial commit for freshwater-frontend
- based on bise-frontend which volto project will track the use of the volto addon
- Loading branch information
0 parents
commit d6bbf88
Showing
45 changed files
with
24,584 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/node_modules | ||
npm-cache |
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 @@ | ||
const jsConfig = require('./jsconfig').compilerOptions; | ||
const path = require('path'); | ||
const projectRootPath = __dirname; | ||
const packageJson = require(path.join(projectRootPath, 'package.json')); | ||
|
||
const pathsConfig = jsConfig.paths; | ||
let voltoPath = './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(__dirname); | ||
|
||
// 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,77 @@ | ||
.vscode/ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.DS_Store | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next | ||
|
||
build | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
data | ||
omelette | ||
*.old | ||
*~ | ||
src/addons | ||
src/develop | ||
npm-cache |
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 @@ | ||
{ | ||
"extends": ["stylelint-config-idiomatic-order"], | ||
"plugins": ["stylelint-prettier"], | ||
"rules": { | ||
"prettier/prettier": true, | ||
"single-quote": true, | ||
"trailing-comma": "all", | ||
"rule-empty-line-before": [ | ||
"always-multi-line", | ||
{ | ||
"except": ["first-nested"], | ||
"ignore": ["after-comment"] | ||
} | ||
] | ||
}, | ||
"ignoreFiles": "theme/themes/default/**/*.overrides" | ||
} |
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 @@ | ||
save-prefix "" |
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,101 @@ | ||
# Based on https://github.com/plone/volto/blob/master/entrypoint.sh | ||
|
||
# FROM node:10-jessie as build | ||
# | ||
# ARG NPM_CONFIG_REGISTRY | ||
# ARG MAX_OLD_SPACE_SIZE=8192 | ||
# | ||
# ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE | ||
# | ||
# RUN apt-get update -y \ | ||
# && apt-get install -y git bsdmainutils vim-nox mc \ | ||
# && rm -rf /var/lib/apt/lists/* | ||
# | ||
# RUN npm i -g mrs-developer | ||
# | ||
# WORKDIR /opt/frontend/ | ||
# | ||
# COPY docker-image.txt / | ||
# COPY . . | ||
# # RUN chmod +x optimize_node_modules.sh | ||
# | ||
# RUN mkdir -p /opt/frontend/src/develop | ||
# | ||
# RUN chown -R node /opt/frontend | ||
# | ||
# USER node | ||
# | ||
# RUN echo "prefix = \"/home/node\"\n" > /home/node/.npmrc | ||
# RUN rm -rf node_modules .git package-lock.json | ||
# | ||
# # RUN npm install mr-developer | ||
# | ||
# #RUN node_modules/.bin/mrdeveloper --config=jsconfig.json --no-config --output=addons | ||
# RUN missdev | ||
# | ||
# RUN make activate-all | ||
# | ||
# # RUN NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY npm ci | ||
# RUN NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY npm install | ||
# | ||
# # RUN ./optimize_node_modules.sh | ||
# # RUN make clean-addons | ||
# # RUN rm -f package-lock.json | ||
# | ||
# RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build | ||
# | ||
# # Second stage build | ||
# FROM node:10-jessie | ||
# | ||
# RUN apt-get update -y \ | ||
# && apt-get install -y git bsdmainutils vim-nox mc \ | ||
# && rm -rf /var/lib/apt/lists/* | ||
# | ||
# WORKDIR /opt/frontend/ | ||
# | ||
# COPY entrypoint-prod.sh /opt/frontend/entrypoint.sh | ||
# RUN chmod +x entrypoint.sh | ||
# | ||
# COPY package.json . | ||
# COPY package-lock.json . | ||
# | ||
# COPY --from=build /opt/frontend/public ./public | ||
# COPY --from=build /opt/frontend/build ./build | ||
# | ||
# RUN chown -R node /opt/frontend | ||
# | ||
# USER node | ||
# | ||
# RUN rm -rf package-lock.json | ||
# RUN NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY npm install --production | ||
# | ||
# ENTRYPOINT ["/opt/frontend/entrypoint.sh"] | ||
# | ||
# EXPOSE 3000 3001 4000 4001 | ||
# | ||
# CMD yarn start:prod | ||
|
||
|
||
|
||
FROM node:12-stretch-slim | ||
|
||
RUN apt-get update && apt-get install -y git | ||
|
||
COPY . /opt/frontend/ | ||
RUN chown -R node /opt/frontend/ | ||
|
||
WORKDIR /opt/frontend/ | ||
USER node | ||
|
||
ARG MAX_OLD_SPACE_SIZE=8192 | ||
ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE | ||
|
||
RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn \ | ||
&& RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build \ | ||
&& rm -rf /home/node/.cache | ||
|
||
EXPOSE 3000 3001 4000 4001 | ||
|
||
ENTRYPOINT ["/opt/frontend/entrypoint-prod.sh"] | ||
CMD ["yarn", "start:prod"] | ||
USER root |
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,139 @@ | ||
image-name-split = $(word $2,$(subst :, ,$1)) | ||
|
||
SHELL=/bin/bash | ||
DOCKERIMAGE_FILE="docker-image.txt" | ||
NAME := $(call image-name-split,$(shell cat $(DOCKERIMAGE_FILE)), 1) | ||
IMAGE=$(shell cat $(DOCKERIMAGE_FILE)) | ||
|
||
# VOLTO_ADDONS=$(shell ./scripts/pkg_helper.py list) | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
.PHONY: activate | ||
activate: ## Activate an addon package for development | ||
set -e; \ | ||
if [[ -z "${pkg}" ]]; then\ | ||
echo "You need to specify package name in make command";\ | ||
echo "Ex: make activate pkg=volto-datablocks";\ | ||
else \ | ||
./scripts/pkg_helper.py --target=${pkg} activate;\ | ||
echo "Running npm install in src/develop/${pkg}";\ | ||
cd "src/addons/$${pkg}";\ | ||
npm install;\ | ||
cd ../..;\ | ||
echo "Cleaning up after npm install";\ | ||
export VOLTO_ADDONS=`./scripts/pkg_helper.py list`;\ | ||
read -ra ADDR <<< "$${VOLTO_ADDONS}"; \ | ||
for pkg in "$${ADDR[@]}"; do \ | ||
echo "removing node_modules/$${pkg}"; \ | ||
rm -rf "./node_modules/$${pkg}";\ | ||
done; \ | ||
echo "Done.";\ | ||
fi | ||
|
||
PHONY: clean-addons | ||
clean-addons: | ||
set -e; \ | ||
echo "Cleaning up after npm install";\ | ||
export VOLTO_ADDONS=`./scripts/pkg_helper.py list`;\ | ||
read -ra ADDR <<< "$${VOLTO_ADDONS}"; \ | ||
for pkg in "$${ADDR[@]}"; do \ | ||
echo "removing node_modules/$${pkg}"; \ | ||
rm -rf "./node_modules/$${pkg}";\ | ||
done; \ | ||
|
||
.PHONY: activate-all | ||
activate-all: ## Automatically activates all addons from mr.developer.json | ||
@echo "Activating all addon packages" | ||
./scripts/pkg_helper.py activate-all | ||
|
||
.PHONY: deactivate | ||
deactivate: ## Deactivate an addon package for development | ||
@if [[ -z "${pkg}" ]]; then\ | ||
echo "You need to specify package name in make command";\ | ||
echo "Ex: make deactivate pkg=volto-datablocks";\ | ||
else \ | ||
exec ./scripts/pkg_helper.py --target=${pkg} deactivate;\ | ||
rm -rf node_modules/${pkg};\ | ||
echo "Deactivated ${pkg}";\ | ||
fi | ||
|
||
.PHONY: all | ||
all: clean build ## (Inside container) build a production version of resources | ||
@echo "Built production files" | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf build/ | ||
|
||
.PHONY: build | ||
build: | ||
echo "";\ | ||
echo "Make sure that you have the npm cache (Verdaccio) running!";\ | ||
echo "";\ | ||
DEBUG= \ | ||
NODE_OPTIONS=--max_old_space_size=4096 \ | ||
RAZZLE_API_PATH=VOLTO_API_PATH \ | ||
RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH \ | ||
yarn build; \ | ||
./entrypoint-prod.sh | ||
|
||
.PHONY: start | ||
start: ## (Inside container) starts production mode frontend server | ||
npm run start:prod | ||
|
||
.PHONY: analyze | ||
analyze: ## (Inside container) build production resources and start bundle analyzer HTTP server | ||
DEBUG= \ | ||
BUNDLE_ANALYZE=true \ | ||
NODE_OPTIONS=--max_old_space_size=4096 \ | ||
RAZZLE_API_PATH=VOLTO_API_PATH \ | ||
RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH \ | ||
yarn build; \ | ||
npm run analyze | ||
|
||
.PHONY: release | ||
release: bump build-image push ## (Host side) release a new version of frontend docker image | ||
|
||
.PHONY: bump | ||
bump: | ||
echo "Bumping version..."; | ||
python ./../scripts/version_bump.py $(DOCKERIMAGE_FILE); | ||
|
||
.PHONY: build-image | ||
build-image: | ||
@echo "Building new docker image: $(IMAGE)"; | ||
docker build . --network=host --build-arg MAX_OLD_SPACE_SIZE=4096 --build-arg NPM_CONFIG_REGISTRY=http://127.0.0.1:4873 -t "$(IMAGE)"; | ||
@echo "Image built." | ||
|
||
.PHONY: push | ||
push: | ||
docker push $(IMAGE) | ||
docker tag $(IMAGE) $(NAME):latest | ||
docker push $(NAME):latest | ||
|
||
.PHONY: init-submodules | ||
init-submodules: ## Initialize the git submodules | ||
git submodule update --init --recursive | ||
|
||
.PHONY: develop | ||
develop: ## Runs "git pull" in all addons | ||
./scripts/pkg_helper.py develop | ||
|
||
.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: build-production | ||
try-production: ## Build production bundle | ||
NODE_OPTIONS=--max_old_space_size=4096 \ | ||
BUNDLE_ANALYZE=true \ | ||
RAZZLE_API_PATH=VOLTO_API_PATH \ | ||
RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH \ | ||
yarn build | ||
./entrypoint-dev.sh | ||
echo "Now run: node build/server.js" | ||
|
||
.PHONY: sync | ||
sync: ## Sync repo with eea/volto-starter-kit Github template | ||
npx git-upstream-template https://github.com/eea/volto-starter-kit.git |
Oops, something went wrong.