To build the UMich OIDC Login plugin, you need
- bash
- git
- Docker
The UMich OIDC Login plugin should be built using PHP 7.3, so it can be used with both PHP 7.3 and 8.x.
git clone git@github.com:its-webhosting/umich-oidc-login.git
cd umich-oidc-login
export PATH="$(pwd)/tools:${PATH}"The official Docker image for Composer supports only PHP 8. Build our own image that uses PHP 7.3 so that plugin can be used with both PHP 7.3 and PHP 8.x.
pushd scratch
git clone https://github.com/composer/docker.git composer-docker
cd composer-docker/2.5
sed -i .old 's/^FROM php:8-alpine/FROM php:7.3-alpine/' Dockerfile
docker build -t composer:php7.3 .
popdComposer installs everything into vendor and then PHP-Scoper copies it into build.
We are using PHP-Scoper so we can put UMICH OIDC Login plugin dependencies into their own PHP namespace to avoid conflicts with other plugins' dependencies. PHP 7.3 requires PHP-Scoper 0.15.0.
If PHP-Scoper says the build directory exists and asks if you want to proceed, answer "no". This will continue, using the existing directory. Responding "yes" will re-create the directory, destroying any Gutenberg/React code that has been built there.
pushd umich-oidc-login
run-composer global require --dev humbug/php-scoper:0.15.0
run-composer install
run-composer global exec -- php-scoper add-prefix
run-composer dump-autoload --working-dir buildrun-node npm install --production=false # ensure @wordpress/scripts devDependency gets installed
run-node npm run-script build:metabox
cd includes/admin/wp-react-optionskit/
run-node npm install --production=false # ensure @wordpress/scripts devDependency gets installed
run-node npm run-script build
popdStop here, you're done.
When you need to update the plugin dependencies (for example, when releasing a new version of the plugin), follow the steps below. The steps will first remove old dependency artifacts, then update the config files, and finally rebuild the plugin. Avoid running the composer or npm update command as that won't get everything right.
rm -rf scratch/composer-*-cache
cd umich-oidc-login
rm -rf composer.lock build vendor
cd ..Edit composer.json, manually look up the newest version of each package, check the changelog for each package, and edit the file to have the desired version.
cd umich-oidc-login
rm -rf build node_modules package-lock.jsonEdit package.json:
- For all
@wordpress/*packages, change the version of the package to the exact version (no caret) listed in the Changelog for the latest release of WordPress. - For all other packages, manually look up the newest version of each package, check the changelog for each package, and edit the file to have the desired version, usually using the caret notation.
pushd includes/admin/wp-react-optionskit
rm -rf build node_modules package-lock.jsonEdit package.json:
- For all
@wordpress/*packages, change the version of the package to the exact version (no caret) listed in the Changelog for the latest release of WordPress. - For all other packages, manually look up the newest version of each package, check the changelog for each package, and edit the file to have the desired version, usually using the caret notation.
Follow the instructions above to