Skip to content

Commit b1fc828

Browse files
committed
Merge branch 'release/1.0.29' into v1
2 parents 9983042 + 2b9f8b1 commit b1fc828

315 files changed

Lines changed: 12203 additions & 12411 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.craftplugin

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build-and-deploy-docs.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name: Build and Deploy Docs
22
env:
3-
DOCS_DEST_DIR: /webperf/
3+
DOCS_DEST_DIR: /webperf/v1/
44
on:
55
push:
66
branches:
7-
- v3
7+
- v1
88
paths:
99
- 'docs/**'
1010
pull_request:
1111
branches:
12-
- v3
12+
- v1
1313
paths:
1414
- 'docs/**'
1515
workflow_dispatch:
@@ -22,11 +22,11 @@ jobs:
2222
strategy:
2323
fail-fast: true
2424
matrix:
25-
node-version: [14.x]
25+
node-version: [ 20.x ]
2626
steps:
27-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2828
- name: Use Node.js ${{ matrix.node-version }}
29-
uses: actions/setup-node@v2
29+
uses: actions/setup-node@v4
3030
with:
3131
node-version: ${{ matrix.node-version }}
3232
- run: npm ci
@@ -35,7 +35,7 @@ jobs:
3535
- name: rsync deployments
3636
uses: burnett01/rsync-deployments@4.1
3737
with:
38-
switches: -avzr --delete
38+
switches: -avzr
3939
path: ./dist/
4040
remote_path: ${{ secrets.NYS_DOCS_ROOT }}${{ env.DOCS_DEST_DIR }}
4141
remote_host: ${{ secrets.NYS_DEPLOY_REMOTE_HOST }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Code Analysis
2+
3+
on:
4+
pull_request: null
5+
push:
6+
branches:
7+
- develop
8+
workflow_dispatch:
9+
permissions:
10+
contents: read
11+
jobs:
12+
code_analysis:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
actions:
17+
- name: 'PHPStan'
18+
run: composer phpstan
19+
- name: 'Coding Standards'
20+
run: composer fix-cs
21+
name: ${{ matrix.actions.name }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Cache Composer dependencies
26+
uses: actions/cache@v4
27+
with:
28+
path: /tmp/composer-cache
29+
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
30+
- name: Setup PHP
31+
id: setup-php
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: 8.2
35+
extensions: 'ctype,curl,dom,iconv,imagick,intl,json,mbstring,openssl,pcre,pdo,reflection,spl,zip'
36+
ini-values: post_max_size=256M, max_execution_time=180, memory_limit=512M
37+
tools: composer:v2
38+
- name: Install Composer dependencies
39+
run: composer install --no-interaction --no-ansi --no-progress
40+
- run: ${{ matrix.actions.run }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Create Release
2+
run-name: Create release for ${{ github.event.client_payload.version }}
3+
4+
on:
5+
repository_dispatch:
6+
types:
7+
- craftcms/new-release
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: ncipollo/release-action@v1
16+
with:
17+
body: ${{ github.event.client_payload.notes }}
18+
makeLatest: ${{ github.event.client_payload.latest }}
19+
name: ${{ github.event.client_payload.version }}
20+
prerelease: ${{ github.event.client_payload.prerelease }}
21+
tag: ${{ github.event.client_payload.tag }}

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Webperf Changelog
22

3+
## 1.0.29 - 2024.02.09
4+
### Added
5+
* Add `phpstan` and `ecs` code linting
6+
* Add `code-analysis.yaml` GitHub action
7+
8+
### Changed
9+
* Add `allow-plugins` for CI
10+
* Switch over to Vite `^5.0.0` & Node `^20.0.0` for the buildchain
11+
* Move to using `ServicesTrait` and add getter methods for services
12+
* Update the Test on Google PageSpeed Insights URL to `pagespeed.web.dev`
13+
* Clean up search bar CSS
14+
* Updated docs to use node 20 & a new sitemap plugin
15+
* ECS code cleanup
16+
17+
### Fixed
18+
* Update to Boomerang Loader Snippet version 15 to modernize the loader, and eliminage `document.write` warnings
19+
* Added the unused `static` to the Tailwind CSS `blocklist` to avoid a name collision with a Craft CSS class ([#1412](https://github.com/nystudio107/craft-seomatic/issues/1412))
20+
321
## 1.0.28 - 2022.06.23
422
### Changed
523
* Removed the sub resource integrity on the built JavaScript, which could fail if systems were set up that manipulated the incoming JavaScript resources dynamically

buildchain/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
# Misc directories & files
27+
coverage/*
28+
.stylelintcache

buildchain/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
ARG TAG=16-alpine
2-
FROM nystudio107/node-dev-base:$TAG
1+
ARG TAG=20-alpine
2+
FROM node:$TAG
33

4-
USER node
4+
RUN npm install -g npm@^10.0.0
55

66
WORKDIR /app/buildchain/
77

buildchain/Makefile

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
TAG?=16-alpine
2-
CONTAINER?=$(shell basename $(dir $(CURDIR)))-buildchain
3-
DOCKERRUN=docker container run \
4-
--name ${CONTAINER} \
5-
--rm \
6-
-t \
7-
--network plugindev_default \
8-
-p 3001:3001 \
9-
-v "${CURDIR}"/../:/app \
10-
${CONTAINER}:${TAG}
1+
MAJOR_VERSION?=1
2+
TAG?=20-alpine
3+
CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-buildchain
4+
DEV_PORT?=300${MAJOR_VERSION}
5+
IMAGE_INFO=$(shell docker image inspect $(CONTAINER):$(TAG))
6+
IMAGE_NAME=${CONTAINER}:${TAG}
7+
DOCKER_NETWORK?=plugindev_default
8+
DOCKER_RUN=docker container run --rm -it --network "${DOCKER_NETWORK}" -v "${CURDIR}"/../:/app
119

12-
.PHONY: build dev docker install clean npm
10+
.PHONY: build clean dev image-build image-check npm ssh
1311

14-
build: docker install
15-
${DOCKERRUN} \
16-
run build
17-
dev: docker install
18-
${DOCKERRUN} \
19-
run dev
20-
docker:
21-
docker build \
22-
. \
23-
-t ${CONTAINER}:${TAG} \
24-
--build-arg TAG=${TAG} \
25-
--no-cache
26-
install: docker
27-
${DOCKERRUN} \
28-
install --ignore-scripts
12+
# Perform a dist build via npm run build
13+
build: image-check
14+
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run build
15+
# Remove node_modules/ & package-lock.json
2916
clean:
3017
rm -rf node_modules/
3118
rm -f package-lock.json
32-
npm: docker
33-
${DOCKERRUN} \
34-
$(filter-out $@,$(MAKECMDGOALS))
19+
# Run the development server via npm run dev
20+
dev: image-check
21+
${DOCKER_RUN} --name ${CONTAINER}-$@ -e DEV_PORT="${DEV_PORT}" -p ${DEV_PORT}:${DEV_PORT} ${IMAGE_NAME} run dev
22+
# Build the Docker image & run npm install
23+
image-build:
24+
docker build . -t ${IMAGE_NAME} --build-arg TAG=${TAG} --no-cache
25+
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} install --ignore-scripts
26+
# Ensure the image has been created
27+
image-check:
28+
ifeq ($(IMAGE_INFO), [])
29+
image-check: image-build
30+
endif
31+
# Run the passed in npm command
32+
npm: image-check
33+
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS)
34+
# Open a shell inside of the container
35+
ssh: image-check
36+
${DOCKER_RUN} --name ${CONTAINER}-$@ --entrypoint=/bin/sh ${IMAGE_NAME}
3537
%:
3638
@:
3739
# ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line

buildchain/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# `webperf` buildchain
2+
3+
This buildchain is a self-contained build system for the `webperf` JavaScript bundle.
4+
5+
## Overview
6+
7+
The buildchain builds & bundles all of the `webperf` TypeScript/JavaScript code, Vue components, CSS, and any other static resources via Vite via a Docker container.
8+
9+
Source files:
10+
11+
`buildchain/src/`
12+
13+
Built distribution files:
14+
15+
`src/web/assets/dist/`
16+
17+
## Prerequisites
18+
19+
To run the buildchain for development purposes:
20+
21+
- You must have [Docker Desktop](https://www.docker.com/products/docker-desktop/) (or the equivalent) installed
22+
- We assume you're using the [`plugindev`](https://github.com/nystudio107/plugindev) development project. If you're not, see the **If you're not using `plugindev`** section below
23+
24+
## Commands
25+
26+
This buildchain uses `make` as an interface to the buildchain. The following commands are available from the `buildchain/` directory:
27+
28+
- `make build` - Do a distribution build of the CantoDamAsset asset bundle resources into `src/web/assets/dist/`
29+
- `make dev` - Start Vite HMR dev server for local development
30+
- `make clean` - Remove `node_modules/` and `package-lock.json` to start clean (need to run `make image-build` after doing this, see below)
31+
- `make npm XXX` - Run an `npm` command inside the container, e.g.: `make npm run lint` or `make npm install`
32+
- `make ssh` - Open up a shell session into the buildchain Docker container
33+
- `make image-build` - Build the Docker image & run `npm install`
34+
35+
### If you're not using `plugindev`
36+
37+
If you're not using the [`plugindev`](https://github.com/nystudio107/plugindev) development project, you'll need to follow these steps in order to use the HMR for development in local dev:
38+
39+
- For HMR during local development, you'll need the following variable set in your project's `.env` file:
40+
```dotenv
41+
VITE_PLUGIN_DEVSERVER=1
42+
```
43+
The [`craft-plugin-vite`](https://github.com/nystudio107/craft-plugin-vite) library looks for this environment variable to determine whether it should check for a running Vite dev server.
44+
45+
#### If you're also using Docker
46+
47+
- So your project can access the buildchain container over the [internal Docker network](https://docs.docker.com/compose/networking/), you'll need to set the `DOCKER_NETWORK` environment variable before running any buildchain `make` commands:
48+
```bash
49+
env DOCKER_NETWORK=myproject_default make dev
50+
```
51+
...or use any other method for [setting environment variables](https://www.twilio.com/blog/how-to-set-environment-variables.html). This environment variable needs to be set in the shell where you run the buildchain's various `make` commands from, so setting it in your project's `.env` file won't work.
52+
53+
The network your project uses is typically the project name with `_default` appended to it, but it can be explicitly set in the `docker-composer.yaml` like this:
54+
```yaml
55+
networks:
56+
default:
57+
name: someproject_default
58+
```

0 commit comments

Comments
 (0)