Skip to content

Commit

Permalink
Merge branch 'release/4.0.0' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Apr 6, 2024
2 parents ef13b43 + b47d93e commit 210f0f3
Show file tree
Hide file tree
Showing 34 changed files with 4,037 additions and 2,104 deletions.
1 change: 0 additions & 1 deletion .craftplugin

This file was deleted.

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: /twigpack/
DOCS_DEST_DIR: /twigpack/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/rsync-deployments@4.1
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
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-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 }}
214 changes: 11 additions & 203 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Twigpack Changelog

## 4.0.0 - 2024.04.05
### Added
* Add Craft Cloud compatibility
* 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

## 4.0.0-beta.4 - 2022.04.26
### Changed
* Don't log the full exception on a Guzzle error, just log the message
Expand All @@ -19,206 +30,3 @@
### Added

* Initial Craft CMS 4 compatibility

## 1.2.15 - 2021.07.11
### Changed
* Wrap calls to `is_file()` with try/catch, to handle open_basedir restrictions that cause exceptions to be thrown (https://github.com/nystudio107/craft-twigpack/issues/73)
* Switched documentation system to VitePress

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

### Fixed
* Fix `DOCSDEST` path
* No longer invalidate caches immediately in local dev, and instead rely on the 1s cache (https://github.com/nystudio107/craft-twigpack/issues/67)

## 1.2.13 - 2021.04.13
### Added
* Added buildchain for docs

### Fixed
* Fixed a malformed `User-Agent` header in a request to `mix-manifest.json` (https://github.com/nystudio107/craft-twigpack/issues/62)

## 1.2.12 - 2021.04.05
### Changed
* Catch all errors thrown by Guzzle

### Fixed
* Add a `100ms` delay when requesting the manifest file if using it in hot mode, as a hack to avoid a `webpack-dev-server` / Tailwind CSS JIT race condition (https://github.com/nystudio107/craft/issues/55)

## 1.2.11 - 2021.03.21
### Changed
* Use Guzzle for remote file fetches rather than `curl`, for improved performance

## 1.2.10 - 2021-02-24
### Added
* Added a `FileDependency` cache dependency for files loaded from a local path, so things like the `manifest.json` will auto-cache bust if the file changes

### Changed
* Default `devServerBuildType` reverted to `modern`

## 1.2.9 - 2021-01-12
### Changed
* Default devServerBuildType to `combined`

### Fixed
* Ensure that `getHttpResponseCode()` returns a 404 on error

## 1.2.8 - 2021-01-12
### Fixed
* Fixed an issue where `includeFileFromManifest()` wouldn't properly fall back on non-hot files if the URL returned a 404 with HTML content

## 1.2.7 - 2020-12-11
### Fixed
* Fixed the `craft.twigpack.includeFileFromManifest()` so that it will use the internal `devServer.publicPath` setting for HMR

## 1.2.6 - 2020-09-16
### Changed
* Ensure that a string is always passed to `Template::raw()`
* Updated the docs

## 1.2.5 - 2020-08-14
### Changed
* Fixed a regression from the `styles.js` error suppression that would cause it to throw an exception if you attempted to load it

## 1.2.4 - 2020-08-12
### Changed
* Suppress errors for `styles.js` modules (which is a work-around to a webpack bug)

## 1.2.3 - 2020-06-24
### Added
* Added the ability to pass down an `$attributes` array to functions that generate tags, so you can add arbitrary HTML attributes

## 1.2.2 - 2020-05-25
### Added
* Added `cspNonce` setting to allow for Content Security Policy nonce support for inline CSS/JS

### Changed
* Switched over to using Yii2's `Html::` helpers for creating various tags

### Fixed
* Make sure `$moduleHash` is never undefined

## 1.2.1 - 2020-05-04
### Added
* Added the config setting `devServerBuildType` to determine which webpack-dev-server bundle is loaded.
* Support passing an array of filenames for `errorEntry`

## 1.2.0 - 2020-02-28
### Changed
* Switched over to using `media="print"` for asynchronously loading a stylesheet as per [The Simplest Way to Load CSS Asynchronously](https://www.filamentgroup.com/lab/load-css-simpler/)
* Deprecated `craft.twigpack.includeCssRelPreloadPolyfill()` since it is no longer necessary. It now does nothing

## 1.1.14 - 2020-02-04
### Added
* If this is a dev-server, look for the modern manifest file first

## 1.1.13 - 2020-01-22
### Added
* Added the config setting `useAbsoluteUrl` to control whether module URLs will be forced to be fully qualified aboslute URLs

### Changed
* If we're in `devMode` invalidate the cache immediately
* If an error is reported, and `self::$isHot` is `true` log it as a warning, not an error

## 1.1.12 - 2019-11-12
### Fixed
* Fixed an issue with `includeFileFromManifest()` not working due to recent changes

## 1.1.11 - 2019-10-15
### Changed
* Revert a PR that caused Twigpack to no longer gracefully fall back on locally built assets if the `webpack-dev-server` is not running
* Add a short timeout to `file_get_contents` to prevent it from taking too long if the file doesn't exist

## 1.1.10 - 2019-10-03
### Changed
* Changed examples to use `’dev’` for local development (instead of `’local’`)

## 1.1.9 - 2019-10-01
### Added
* Added `getModuleHash()` function, to grab the hash key of a module

### Changed
* Fixed an issue where `isHot` was not set before use
* Fixed `getFileFromManifest()` to load files from webpack-dev-server

## 1.1.8 - 2019-08-06
### Changed
* Added `cacheKeySuffix` to the Settings model

## 1.1.7 - 2019-06-05
### Changed
* Clarify expected output with no second param
* Code cleanup

## 1.1.6 - 2019-05-05
### Changed
* Fixed an issue where `null` could potentially be passed in to `resolveTemplate()`

## 1.1.5 - 2019-03-24
### Changed
* Fixed a typo in the `twigpack-manifest-cache` cache key
* Changed deprecated `\Twig_Markup` to `\Twig\Markup`
* Elaborated on Twigpack's caching and how to clear it in the `README.md`

## 1.1.4 - 2019-01-22
### Changed
* Handle the case where there is an error decoding the JSON from the manifest
* Updated the documentation to reflect using `@webroot/` by default for the `server` `manifestPath`

## 1.1.3 - 2018-10-31
### Changed
* Make `includeCriticalCssTags()` and `includeInlineCssTags()` soft errors that do nothing if the file is missing

## 1.1.2 - 2018-10-25
### Added
* Added the ability for Hot Module Replacement (HMR) to work through Twig error template pages via the `errorEntry` setting in `config.php`

## 1.1.1 - 2018-10-16
### Changed
* Fixed an issue where if the `manifest.json` was served remotely via https, Twigpack was unable to load it
* Made all errors "soft" for missing CSS/JS modules, so a warning will be logged, but life continues on

## 1.1.0 - 2018-10-09
### Added
* Strings passed in to `manifestPath` can now be Yii2 aliases as well
* Added `craft.twigpack.includeFile()`
* Added `craft.twigpack.includeFileFromManifest()`
* Added `craft.twigpack.includeInlineCssTags()`
* Added `craft.twigpack.includeCriticalCssTags()`

## 1.0.5 - 2018-09-28
### Changed
* Check via `empty()` rather than `!== null` when checking the manifest for module entries
* CSS module loading generates a soft error now, rather than throwing an `NotFoundHttpException`

## 1.0.4 - 2018-09-28
### Added
* Added `this.onload=null;` to async CSS link tag
* Added `craft.twigpack.includeCssRelPreloadPolyfill()`

### Changed
* Better error reporting if modules don't exist in the manifest

## 1.0.3 - 2018-09-24
### Changed
* Allow the `manifestPath` to be a file system path or a URI

## 1.0.2 - 2018-09-23
### Added
* Added `getModuleUri()` function
* Added `getManifestFile()` function

### Changed
* Fixed return types to allow for null
* Code refactoring

## 1.0.1 - 2018-09-22
### Added
* Better error logging if the manifest file can't be found (check `storage/logs/web.log`)
* Throw a `NotFoundHttpException` if the `manifest.json` cannot be found

## 1.0.0 - 2018-09-21
### Added
* Initial release
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
@@ -1,4 +1,4 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/quality-score.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/?branch=v1) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/coverage.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/?branch=v1) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/build.png?b=v1)](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/build-status/v1) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/code-intelligence.svg?b=v1)](https://scrutinizer-ci.com/code-intelligence)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/quality-score.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/?branch=v4) [![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/coverage.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/?branch=v4) [![Build Status](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/build.png?b=v4)](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/build-status/v4) [![Code Intelligence Status](https://scrutinizer-ci.com/g/nystudio107/craft-twigpack/badges/code-intelligence.svg?b=v4)](https://scrutinizer-ci.com/code-intelligence)

# Twigpack plugin for Craft CMS 4.x

Expand Down
23 changes: 21 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-twigpack",
"description": "Twigpack is a bridge between Twig and webpack, with manifest.json & webpack-dev-server HMR support",
"type": "craft-plugin",
"version": "4.0.0-beta.4",
"version": "4.0.0",
"keywords": [
"craftcms",
"craft-plugin",
Expand All @@ -25,7 +25,26 @@
}
],
"require": {
"craftcms/cms": "^4.0.0-beta.1"
"craftcms/cms": "^4.0.0"
},
"require-dev": {
"craftcms/cloud": "^1.41.0",
"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": {
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
Loading

0 comments on commit 210f0f3

Please sign in to comment.