Skip to content

Commit

Permalink
Merge branch 'release/4.0.5' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Feb 21, 2023
2 parents 833ffd0 + b9f37ba commit 6ddf807
Show file tree
Hide file tree
Showing 14 changed files with 1,473 additions and 1,280 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Recipe Changelog

## 4.0.5 - 2023.02.21
### Changed
* Refactored the docs buildchain to use a dynamic docker container setup
* Updated the docs to include instructions on how to do Multi-Component recipes

### Fixed
* Allow Recipe fields to work properly if they are embedded in a Matrix block ([#63](https://github.com/nystudio107/craft-recipe/issues/63))

## 4.0.4 - 2022.12.04
### Changed
* Fix the display of the Recipe icon logo on the Welcome screen
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-recipe",
"description": "A comprehensive recipe FieldType for Craft CMS that includes metric/imperial conversion, portion calculation, and JSON-LD microdata support",
"type": "craft-plugin",
"version": "4.0.4",
"version": "4.0.5",
"keywords": [
"craft",
"cms",
Expand Down
3 changes: 2 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor
/node_modules
docs/.vitepress/dist
/docs/.vitepress/dist
/docs/.vitepress/cache
4 changes: 3 additions & 1 deletion docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG TAG=14-alpine
FROM nystudio107/node-dev-base:$TAG
FROM node:$TAG

USER node

WORKDIR /app/

Expand Down
80 changes: 37 additions & 43 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
MAJOR_VERSION?=4
TAG?=14-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-docs
DOCKERRUN=docker container run \
--name ${CONTAINER} \
--rm \
-p 3002:3002 \
-t \
-v `pwd`:/app \
${CONTAINER}:${TAG}
DOCSDEST?=../../../sites/nystudio107/web/docs/recipe
CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-docs
DOCS_DEV_PORT?=400${MAJOR_VERSION}
DOCS_DEST?=../../../sites/nystudio107/web/docs/recipe
IMAGE_INFO=$(shell docker image inspect $(CONTAINER):$(TAG))
IMAGE_NAME=${CONTAINER}:${TAG}
DOCKER_RUN=docker container run --rm -it -v "${CURDIR}":/app

.PHONY: docker build dev fix install lint clean npm
.PHONY: build clean dev fix image-build image-check lint npm ssh

# Start the Docker container
docker:
docker build \
. \
-t ${CONTAINER}:${TAG} \
--build-arg TAG=${TAG} \
--no-cache
# Build the production docs
build: docker install
${DOCKERRUN} \
run docs:build
rm -rf ${DOCSDEST}
mv ./docs/.vitepress/dist ${DOCSDEST}
# Start up the dev server
dev: docker install
${DOCKERRUN} \
run docs:dev
# Fix the docs via textlint
fix: docker install
${DOCKERRUN} \
run docs:fix
# Run an npm install
install: docker
${DOCKERRUN} \
install
# Lint the docs via textlint
lint: docker install
${DOCKERRUN} \
run docs:lint
# Remove node_modules/* & package-lock.json
# Perform a dist build via npm run docs:build
build: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run docs:build
rm -rf ${DOCS_DEST}
mv ./docs/.vitepress/dist ${DOCS_DEST}
# Remove node_modules/ & package-lock.json
clean:
rm -rf node_modules/
rm -f package-lock.json
# Run the development server via npm run docs:dev
dev: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ -e DOCS_DEV_PORT="${DOCS_DEV_PORT}" -p ${DOCS_DEV_PORT}:${DOCS_DEV_PORT} ${IMAGE_NAME} run docs:dev
# Fix the docs with textlint via npm run docs:fix
fix: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run docs:fix
# Build the Docker image & run npm install
image-build:
docker build . -t ${IMAGE_NAME} --build-arg TAG=${TAG} --no-cache
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} install
# Ensure the image has been created
image-check:
ifeq ($(IMAGE_INFO), [])
image-check: image-build
endif
# Lint the docs with textlint via npm run docs:lint
lint: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run docs:lint
# Run the passed in npm command
npm: docker
${DOCKERRUN} \
$(filter-out $@,$(MAKECMDGOALS))
npm: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS)
# Open a shell inside of the container
ssh: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ --entrypoint=/bin/sh ${IMAGE_NAME}
%:
@:
# ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line
2 changes: 1 addition & 1 deletion docs/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defineConfig} from 'vitepress'
import {defineConfig} from 'vitepress';

export default defineConfig({
title: 'Recipe Plugin',
Expand Down
24 changes: 20 additions & 4 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-recipe/badges/quality-score.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-recipe/?branch=v1) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-recipe/badges/coverage.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-recipe/?branch=v1) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-recipe/badges/build.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-recipe/build-status/v1) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-recipe/badges/code-intelligence.svg?b=v1)](https://scrutinizer-ci.com/code-intelligence)

# Recipe plugin for Craft CMS 3.x
# Recipe plugin for Craft CMS

A comprehensive recipe FieldType for Craft CMS that includes metric/imperial conversion, portion calculation, and JSON-LD microdata support

Expand All @@ -10,7 +10,7 @@ Related: [Recipe for Craft 2.x](https://github.com/nystudio107/recipe)

## Requirements

This plugin requires Craft CMS 3.0.0 or later.
This plugin requires Craft CMS 3.0.0 or later or Craft CMS 4.0.0 or later.

## Installation

Expand All @@ -21,8 +21,6 @@ To install Recipe, follow these steps:

You can also install Recipe via the **Plugin Store** in the Craft AdminCP.

Recipe works on Craft 3.x.

## Recipe Overview

![Screenshot](./resources/screenshots/recipe01.png)
Expand Down Expand Up @@ -167,6 +165,24 @@ To do any further manipulation of the Recipe Image (perhaps a transform) you can

* `entry.someRecipe.imageId` - the Asset ID of the image for the recipe

## Multi-Component Recipes

The Recipe field conceptually encompasses a single recipe. However, if you require multiple components in a recipe you can still use Recipe.

An example of a multiple component recipe might be a dish that requires a sauce that's prepared separately from the main dish.

What you can do is create a Matrix field that contains a Recipe field.

![Screenshot](./resources/screenshots/component-recipe-field.png)

Then the content author can create as many separate recipe components as they like, each with their own separate recipe in it.

![Screenshot](./resources/screenshots/component-recipe-content.png)

You can also add whatever other Craft fields you might like to the Matrix field that apply to all of the recipe components.

For example, you might have a Recipe Name field that is the aggregate name of the whole recipe.

## Rendering Recipe JSON-LD Microdata

### Using SEOmatic
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions docs/docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {defineConfig} from 'vite'
import SitemapPlugin from 'rollup-plugin-sitemap'
import VitePressConfig from './.vitepress/config'
import {defineConfig} from 'vite';
import SitemapPlugin from 'rollup-plugin-sitemap';
import VitePressConfig from './.vitepress/config';

const docsSiteBaseUrl = 'https://nystudio107.com'
const docsBaseUrl = new URL(VitePressConfig.base!, docsSiteBaseUrl).href.replace(/\/$/, '') + '/'
const docsSiteBaseUrl = 'https://nystudio107.com';
const docsBaseUrl = new URL(VitePressConfig.base!, docsSiteBaseUrl).href.replace(/\/$/, '') + '/';
const siteMapRoutes = [{
path: '',
name: VitePressConfig.title
}]
}];

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -20,7 +20,7 @@ export default defineConfig({
],
server: {
host: '0.0.0.0',
port: 3002,
port: parseInt(process.env.DOCS_DEV_PORT ?? '4000'),
strictPort: true,
}
});
Loading

0 comments on commit 6ddf807

Please sign in to comment.