Skip to content

Commit

Permalink
Merge branch 'release/1.0.2' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Apr 27, 2024
2 parents 0432c41 + 0651650 commit e0a83c4
Show file tree
Hide file tree
Showing 38 changed files with 4,838 additions and 1,901 deletions.
1 change: 0 additions & 1 deletion .craftplugin

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/build-and-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build and Deploy Docs
env:
DOCS_DEST_DIR: /twig-profiler/
DOCS_DEST_DIR: /twig-profiler/v1/
on:
push:
branches:
Expand All @@ -22,11 +22,11 @@ jobs:
strategy:
fail-fast: true
matrix:
node-version: [ 14.x ]
node-version: [ 20.x ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/code-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- develop
workflow_dispatch:
permissions:
contents: read
jobs:
code_analysis:
strategy:
fail-fast: false
matrix:
actions:
- name: 'PHPStan'
run: composer phpstan
- name: 'Coding Standards'
run: composer fix-cs
name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: 'ctype,curl,dom,iconv,imagick,intl,json,mbstring,openssl,pcre,pdo,reflection,spl,zip'
ini-values: post_max_size=256M, max_execution_time=180, memory_limit=512M
tools: composer:v2
- name: Install Composer dependencies
run: composer install --no-interaction --no-ansi --no-progress
- run: ${{ matrix.actions.run }}
21 changes: 21 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create Release
run-name: Create release for ${{ github.event.client_payload.version }}

on:
repository_dispatch:
types:
- craftcms/new-release

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: ncipollo/release-action@v1
with:
body: ${{ github.event.client_payload.notes }}
makeLatest: ${{ github.event.client_payload.latest }}
name: ${{ github.event.client_payload.version }}
prerelease: ${{ github.event.client_payload.prerelease }}
tag: ${{ github.event.client_payload.tag }}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file.

## 1.0.2 - 2024.04.27
### Added
* Added `ServicesTrait` for the plugin service component registration
* Add `phpstan` and `ecs` code linting
* Add `code-analysis.yaml` GitHub action

### Changed
* Updated docs to use node 20 & a new sitemap plugin
* PHPstan code cleanup
* ECS code cleanup

## 1.0.1 - 2018-06-12
### Changed
* Fixed an issue where profiling blocks couldn't be nested
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The MIT License (MIT)

Copyright (c) 2018 nystudio107
Copyright (c) nystudio107

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.
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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To install the plugin, follow these instructions.

3. Install the plugin via `./craft install/plugin twig-profiler` via the CLI, or in the Control Panel, go to Settings → Plugins and click the “Install” button for Twig Profiler.

Or you can install the plugin via the **Plugin Store** in the Craft CMS 3 Control Panel.
Or you can install the plugin via the **Plugin Store** in the Craft CMS Control Panel.

## Documentation

Expand Down
96 changes: 57 additions & 39 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,62 @@
{
"name": "nystudio107/craft-twigprofiler",
"description": "Twig Profiler allows you to profile sections of your Twig templates, and see the resulting timings in the Yii2 Debug Toolbar",
"type": "craft-plugin",
"version": "1.0.1",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"twig profiler"
],
"support": {
"docs": "https://nystudio107.com/plugins/twig-profiler/documentation",
"issues": "https://nystudio107.com/plugins/twig-profiler/support"
},
"license": "MIT",
"authors": [
{
"name": "nystudio107",
"homepage": "https://nystudio107.com/"
}
],
"require": {
"craftcms/cms": "^3.0.0"
},
"autoload": {
"psr-4": {
"nystudio107\\twigprofiler\\": "src/"
}
"name": "nystudio107/craft-twigprofiler",
"description": "Twig Profiler allows you to profile sections of your Twig templates, and see the resulting timings in the Yii2 Debug Toolbar",
"type": "craft-plugin",
"version": "1.0.2",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"twig profiler"
],
"support": {
"docs": "https://nystudio107.com/plugins/twig-profiler/documentation",
"issues": "https://nystudio107.com/plugins/twig-profiler/support"
},
"license": "MIT",
"authors": [
{
"name": "nystudio107",
"homepage": "https://nystudio107.com/"
}
],
"require": {
"craftcms/cms": "^3.0.0"
},
"require-dev": {
"craftcms/ecs": "dev-main",
"craftcms/phpstan": "dev-main",
"craftcms/rector": "dev-main"
},
"scripts": {
"phpstan": "phpstan --ansi --memory-limit=1G",
"check-cs": "ecs check --ansi",
"fix-cs": "ecs check --fix --ansi"
},
"config": {
"allow-plugins": {
"craftcms/plugin-installer": true,
"yiisoft/yii2-composer": true
},
"extra": {
"name": "Twig Profiler",
"handle": "twig-profiler",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/nystudio107/craft-twigprofiler/master/CHANGELOG.md",
"components": {
"profile": "nystudio107\\twigprofiler\\services\\Profile"
},
"class": "nystudio107\\twigprofiler\\TwigProfiler"
"optimize-autoloader": true,
"sort-packages": true
},
"autoload": {
"psr-4": {
"nystudio107\\twigprofiler\\": "src/"
}
},
"extra": {
"name": "Twig Profiler",
"handle": "twig-profiler",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/nystudio107/craft-twigprofiler/master/CHANGELOG.md",
"components": {
"profile": "nystudio107\\twigprofiler\\services\\Profile"
},
"class": "nystudio107\\twigprofiler\\TwigProfiler"
}
}

2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/vendor
/node_modules
/docs/.vitepress/dist
/docs/.vitepress/cache
6 changes: 4 additions & 2 deletions 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
ARG TAG=20-alpine
FROM node:$TAG

RUN npm install -g npm@^10.0.0

WORKDIR /app/

Expand Down
78 changes: 40 additions & 38 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
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/twig-profiler
MAJOR_VERSION?=1
TAG?=20-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-docs
DOCS_DEV_PORT?=400${MAJOR_VERSION}
DOCS_DEST?=../../../sites/nystudio107/web/docs/twig-profiler/v1
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

docker:
docker build \
. \
-t ${CONTAINER}:${TAG} \
--build-arg TAG=${TAG} \
--no-cache
build: clean docker install
${DOCKERRUN} \
run docs:build
rm -rf ${DOCSDEST}
mv ./docs/.vitepress/dist ${DOCSDEST}
dev: docker install
${DOCKERRUN} \
run docs:dev
fix: docker install
${DOCKERRUN} \
run docs:fix
install: docker
${DOCKERRUN} \
install
lint: docker install
${DOCKERRUN} \
run docs:lint
clean: docker
# 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
npm: docker
${DOCKERRUN} \
$(filter-out $@,$(MAKECMDGOALS))
# 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: 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
Loading

0 comments on commit e0a83c4

Please sign in to comment.