Skip to content

Commit

Permalink
Merge branch 'release/4.0.1' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Oct 7, 2024
2 parents c1bcfd1 + 12395cc commit 0dfeb87
Show file tree
Hide file tree
Showing 39 changed files with 6,441 additions and 2,259 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-and-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Build and Deploy Docs
env:
DOCS_DEST_DIR: /disqus/
DOCS_DEST_DIR: /disqus/v4/
on:
push:
branches:
- v1
- v4
paths:
- 'docs/**'
pull_request:
branches:
- v1
- v4
paths:
- 'docs/**'
workflow_dispatch:
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 All @@ -35,7 +35,7 @@ jobs:
- name: rsync deployments
uses: burnett01/[email protected]
with:
switches: -avzr --delete
switches: -avzr
path: ./dist/
remote_path: ${{ secrets.NYS_DOCS_ROOT }}${{ env.DOCS_DEST_DIR }}
remote_host: ${{ secrets.NYS_DEPLOY_REMOTE_HOST }}
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/code-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- develop-v4
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 }}
80 changes: 12 additions & 68 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Disqus Changelog

## 4.0.1 - 2024.10.06
### Added
* Added a **Lazy Load Disqus** settings option, so you can control whether the Disqus JavaScript is lazily loaded or not ([#8](https://github.com/nystudio107/craft-disqus/issues/8))
* Added the ability to pass in additional attributes that will be added to the rendered Disqus `<script>` tag ([#28](https://github.com/nystudio107/craft-disqus/issues/28))
* Added the ability to use environment variables / aliases for the additional settings ([#15](https://github.com/nystudio107/craft-disqus/pull/15/))
* Add `phpstan` and `ecs` code linting
* Add `code-analysis.yaml` GitHub action

### Fixed
* Fixed an issue where avatars wouldn't display ([#37](https://github.com/nystudio107/craft-disqus/issues/37))
* Fixed an issue where incorrect headers were sent if the API key was an environment variable or alias ([#15](https://github.com/nystudio107/craft-disqus/pull/15/))

## 4.0.0 - 2022.06.01
### Added
* Initial Craft CMS 4 release
Expand All @@ -13,73 +25,5 @@
* Fixed an issue where the Disqus tag was not output as HTML, but rather a plain text

## 4.0.0-beta.1 - 2022.03.25

### Added

* Initial Craft CMS 4 compatibility

## 1.1.3 - 2021.04.20
### Added
* Added Dockerfile & Makefile for building docs

### Changed
* Move settings from the `composer.json` “extra” to the plugin main class

### Fixed
* Fixed an issue where an error was thrown if a `null` value was returned from `json_encode`

## 1.1.2 - 2019.08.15
### Added
* Fixed a regression that could cause an exception to be thrown when editing the plugin settings

## 1.1.1 - 2019.08.10
### Added
* `disqusPublicKey` and `disqusSecretKey` can now be environmental variables

### Changed
* Fixed a deprecation error for `craft.config.get()`

## 1.1.0 - 2019.01.04
### Added
* Disqus JavaScript is now lazy loaded, only when the comments scroll into the viewport

## 1.0.7 - 2018.02.01
### Added
* Renamed the composer package name to `craft-disqus`

## 1.0.6 - 2018.01.12
### Added
* Added the `disqusCount()` and `craft.disqus.disqusCount()` for getting the number of comments for a given Disqus thread

### Changed
* Cleaned up the code, added try/catch wrappers

## 1.0.5 - 2017.12.06
### Changed
* Updated to require craftcms/cms `^3.0.0-RC1`
* Switched to `Craft::$app->view->registerTwigExtension` to register the Twig extension

## 1.0.4 - 2017.08.05
### Changed
* Craft 3 beta 23 compatibility

## 1.0.3 - 2017.07.12
### Changed
* Craft 3 beta 20 compatibility

## 1.0.2 - 2017.03.24
### Changed
* `hasSettings` -> `hasCpSettings` for Craft 3 beta 8 compatibility
* Added Craft 3 beta 8 compatible settings
* Modified config service calls for Craft 3 beta 8

## 1.0.1 - 2017.03.20
### Changed
* Fixed broken SSO implementation by moving it all to one template
* Deprecated the separate `outputSSOTag()` functions
* Removed errant (and unneeded) `|escape('js')` filters
* Updated `README.md`

## 1.0.0 - 2017.03.18
### Added
* Initial release
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 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:

Expand Down
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
MAJOR_VERSION?=4
PLUGINDEV_PROJECT_DIR?=/Users/andrew/webdev/sites/plugindev/cms_v${MAJOR_VERSION}/
VENDOR?=nystudio107
PROJECT_PATH?=${VENDOR}/$(shell basename $(CURDIR))

.PHONY: dev docs release

# Start up the buildchain dev server
dev:
# Start up the docs dev server
docs:
${MAKE} -C docs/ dev
# Run code quality tools, tests, and build the buildchain & docs in preparation for a release
release: --code-quality --code-tests --buildchain-clean-build --docs-clean-build
# The internal targets used by the dev & release targets
--buildchain-clean-build:
--code-quality:
${MAKE} -C ${PLUGINDEV_PROJECT_DIR} -- ecs check vendor/${PROJECT_PATH}/src --fix
${MAKE} -C ${PLUGINDEV_PROJECT_DIR} -- phpstan analyze -c vendor/${PROJECT_PATH}/phpstan.neon
--code-tests:
--docs-clean-build:
${MAKE} -C docs/ clean
${MAKE} -C docs/ image-build
${MAKE} -C docs/ fix
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/quality-score.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/?branch=v1) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/coverage.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/?branch=v1) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/build.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/build-status/v1) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/code-intelligence.svg?b=v1)](https://scrutinizer-ci.com/code-intelligence)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/quality-score.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/?branch=v4) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/coverage.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/?branch=v4) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/build.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/build-status/v4) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-disqus/badges/code-intelligence.svg?b=v4)](https://scrutinizer-ci.com/code-intelligence)

# Disqus plugin for Craft CMS 4.x

Integrates the Disqus commenting system into Craft CMS websites, including Single Sign On (SSO) and custom login/logout URLs

![Screenshot](./docs/docs/resources/img/plugin-logo.png)

Related: [Disqus for Craft 2.x](https://github.com/nystudio107/disqus)

## Requirements

This plugin requires Craft CMS 4.0.0 or later.
Expand Down
22 changes: 20 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "nystudio107/craft-disqus",
"description": "Integrates the Disqus commenting system into Craft 3 websites, including Single Sign On (SSO) and custom login/logout URLs",
"description": "Integrates the Disqus commenting system into Craft CMS websites, including Single Sign On (SSO) and custom login/logout URLs",
"type": "craft-plugin",
"version": "4.0.0",
"version": "4.0.1",
"keywords": [
"craft",
"cms",
Expand All @@ -25,6 +25,24 @@
"require": {
"craftcms/cms": "^4.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
},
"optimize-autoloader": true,
"sort-packages": true
},
"autoload": {
"psr-4": {
"nystudio107\\disqus\\": "src/"
Expand Down
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
76 changes: 39 additions & 37 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/disqus
MAJOR_VERSION?=4
TAG?=20-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-docs
DOCS_DEV_PORT?=400${MAJOR_VERSION}
DOCS_DEST?=../../../sites/nystudio107/web/docs/disqus/v4
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: 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
# 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 0dfeb87

Please sign in to comment.