Skip to content

build: extract versions to versions.env and add PostCSS optimization#29

Merged
sbaerlocher merged 2 commits intomainfrom
build/refactor-build-system
Mar 10, 2026
Merged

build: extract versions to versions.env and add PostCSS optimization#29
sbaerlocher merged 2 commits intomainfrom
build/refactor-build-system

Conversation

@sbaerlocher
Copy link
Member

Summary

  • Move collection versions from build.sh to versions.env for cleaner Renovate dependency management
  • Add PostCSS pipeline (postcss.config.js) with autoprefixer and cssnano for CSS optimization after build

Test plan

  • build.sh correctly sources versions from versions.env
  • PostCSS optimization runs when postcss CLI is available
  • Renovate detects version annotations in versions.env

Move collection versions to versions.env for cleaner Renovate management.
Add PostCSS pipeline with autoprefixer and cssnano for CSS optimization.
build.sh Outdated
# renovate: datasource=galaxy-collection depName=arillso.container
ARILLSO_CONTAINER_VERSION="1.0.2"
# Load collection versions from versions.env
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SCRIPT_DIR computation here is redundant — the pushd at the top of the script already changes the working directory to the script's location. You can simplify the source to just:

Suggested change
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source versions.env

This avoids duplicating the $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) expansion, which is already covered by pushd.

build.sh Outdated

# Install Ansible Collections
echo "Installing Ansible Collections..."
# echo "Using collections from Galaxy..."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code — this commented-out echo shouldn't be committed. Either remove it or replace it with a meaningful log line if that was the intent.

Suggested change
# echo "Using collections from Galaxy..."

# Optimize CSS and JS if postcss is available
if command -v postcss &> /dev/null; then
echo "Optimizing CSS with PostCSS (autoprefixer + cssnano)..."
postcss build/html/_static/custom.css \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom.css is not guaranteed to exist — it depends on the Sphinx theme generating it. If the file is absent, postcss will error out and fail the build. Add a guard:

Suggested change
postcss build/html/_static/custom.css \
if command -v postcss &> /dev/null && [ -f build/html/_static/custom.css ]; then

@@ -0,0 +1,13 @@
module.exports = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no package.json in this PR to track postcss, autoprefixer, and cssnano as dependencies. Without it, contributors have no canonical way to install the right versions, and the versions are effectively unmanaged (and invisible to Renovate). Consider adding a minimal package.json with these as devDependencies.

- Remove redundant SCRIPT_DIR, use simple source since pushd already
  sets the working directory
- Remove dead commented-out echo line
- Add file existence guard for PostCSS optimization step
- Add package.json with PostCSS devDependencies for reproducible installs
@sbaerlocher sbaerlocher merged commit f213640 into main Mar 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant