Skip to content

Commit

Permalink
add Makefile and update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed Dec 23, 2022
1 parent dc58cfd commit baf6eac
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 9 deletions.
88 changes: 83 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,98 @@ logs
*.log
npm-debug.log*
.DS_Store
cache
.nyc_output/

coverage
cypress/videos
cypress/reports

# 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
.vscode/
backend
.#*
*~

# 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

*.old
*~
src/addons
src/develop
npm-cache
backend

# build
public/critical.css
/cache

# yarn 3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Yeoman Volto App development

### Defensive settings for make:
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules

# Project settings

DIR=$(shell basename $$(pwd))
ADDON ?= "marine-frontend"

# Recipe snippets for reuse

# 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`


# Top-level targets
.PHONY: all
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 VERSIONS="plone.restapi=8.17.0 plone.rest=2.0.0a1 plone.app.vocabularies=4.3.0" -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi plone.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 VERSIONS="plone.restapi=8.17.0 plone.rest=2.0.0a1 plone.app.vocabularies=4.3.0" -e SITE=Plone -e ADDONS="plone.volto" -e ZCML="plone.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: install
install: ## Install the frontend
@echo "Install frontend"
$(MAKE) omelette
$(MAKE) preinstall
yarn install

.PHONY: preinstall
preinstall: ## Preinstall task, checks if missdev (mrs-developer) is present and runs it
if [ -f $$(pwd)/mrs.developer.json ]; then make develop; fi

.PHONY: develop
develop: ## Runs missdev in the local project (mrs.developer.json should be present)
npx -p mrs-developer missdev --config=jsconfig.json --output=addons --fetch-https

.PHONY: omelette
omelette: ## Creates the omelette folder that contains a link to the installed version of Volto (a softlink pointing to node_modules/@plone/volto)
if [ ! -d omelette ]; then ln -sf node_modules/@plone/volto omelette; fi

.PHONY: patches
patches:
/bin/bash patches/patchit.sh > /dev/null 2>&1 ||true
1 change: 0 additions & 1 deletion omelette

This file was deleted.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
],
"scripts": {
"start": "razzle start",
"postinstall": "yarn omelette && yarn patches",
"omelette": "if [ ! -d omelette ]; then ln -sf node_modules/@plone/volto omelette; fi",
"patches": "/bin/bash patches/patchit.sh > /dev/null 2>&1 ||true",
"build": "razzle build --noninteractive",
"lint": "./node_modules/eslint/bin/eslint.js 'src/**/*.{js,jsx}'",
"lint:fix": "./node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'",
Expand Down

0 comments on commit baf6eac

Please sign in to comment.