diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..171abac --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,27 @@ +{ + "extends": ["@commitlint/config-conventional"], + "rules": { + "type-enum": [ + 2, + "always", + [ + "feat", + "fix", + "docs", + "style", + "refactor", + "perf", + "test", + "chore", + "ci", + "dev", + "build" + ] + ], + "subject-case": [2, "never", ["start-case", "pascal-case", "upper-case"]], + "subject-empty": [2, "never"], + "subject-full-stop": [2, "never", "."], + "type-case": [2, "always", "lowercase"], + "type-empty": [2, "never"] + } +} diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..284b65c --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit index 36af219..2312dc5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - npx lint-staged diff --git a/.versionrc.json b/.versionrc.json new file mode 100644 index 0000000..e44c677 --- /dev/null +++ b/.versionrc.json @@ -0,0 +1,63 @@ +{ + "types": [ + { + "type": "feat", + "section": "✨ Features", + "hidden": false + }, + { + "type": "fix", + "section": "🐛 Bug Fixes", + "hidden": false + }, + { + "type": "perf", + "section": "⚡ Performance", + "hidden": false + }, + { + "type": "docs", + "section": "📚 Documentation", + "hidden": false + }, + { + "type": "style", + "section": "💅 Code Style", + "hidden": false + }, + { + "type": "refactor", + "section": "♻️ Refactoring", + "hidden": false + }, + { + "type": "test", + "section": "✅ Tests", + "hidden": false + }, + { + "type": "chore", + "section": "🔧 Chores", + "hidden": true + }, + { + "type": "ci", + "section": "🤖 CI/CD", + "hidden": false + }, + { + "type": "dev", + "section": "🛠️ Development", + "hidden": false + }, + { + "type": "build", + "section": "📦 Build", + "hidden": false + } + ], + "issuePrefixes": ["#"], + "commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}", + "compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}", + "issueUrlFormat": "{{host}}/{{owner}}/{{repository}}/issues/{{issue}}" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ca70d..93cbfa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,42 +1,95 @@ -# Change Log +# 📝 Changelog -All notable changes to the "concrete5-helper" extension will be documented in this file. +All notable changes to the concrete5-helper VS Code extension are documented in this file. -Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). ## Unreleased -### Features +### ✨ Added -- New **`c5geturl`** HTML snippet [37c4c86](https://github.com/puka-tchou/c5_snippets/commit/37c4c8683d8dad2e4fa67253709b0210099db35c) -- New **`c5getlink`** PHP snippet [cbae1c7](https://github.com/puka-tchou/c5_snippets/commit/cbae1c7726965a6ee83501608619575feb0d189a) -- New **`c5getlogoutlink`** PHP snippet [357d3d7](https://github.com/puka-tchou/c5_snippets/commit/357d3d7a26c2869eace16421c84ec1b101590242) +- 🤖 Automated changelog generation with commitlint and standard-version +- 📋 Commit message validation enforced by Git hooks +- 📚 Comprehensive contributor guidelines (CONTRIBUTING.md) +- 🎯 Quick reference guide for commit conventions (COMMIT_CONVENTION.md) +- 📖 Technical documentation for automation system (CHANGELOG_AUTOMATION.md) -## Features +--- -- **`assetregister`, helper:** improve the indentation. [b6596dc](https://github.com/puka-tchou/c5_snippets/commit/b6596dc6a8f3a3fe659a459daff9bfb61b842eeb) -- add `getsiteid`, `getsitename` snippets. [2626d93](https://github.com/puka-tchou/c5_snippets/commit/2626d9351171fa3d25e9f44832b2e1533afaf798) -- add `getsiteattribute` snippet. [de417b2](https://github.com/puka-tchou/c5_snippets/commit/de417b2ffcb67305e5c5e83187ae9d39f7f5cc89) -- add `getpagewrapper` snippet. [62e1198](https://github.com/puka-tchou/c5_snippets/commit/62e1198c5758d3727668159049c2aeb732778c7b) +## [0.0.5](https://github.com/puka-tchou/c5_snippets/releases/tag/v0.0.5) — 2026-01-02 -## Bug fixes +### 🔄 Changed -- **`assetregister`:** split the array keys. [cc628f4](https://github.com/puka-tchou/c5_snippets/commit/cc628f4e73f493705a35b4981850782b824954d6) -- **`helper`:** improve the naming of the variables. [965f974](https://github.com/puka-tchou/c5_snippets/commit/965f974d9afa44d098d0c3906e118d628481a88e) -- **`c5translation`:** rename `c5translation` to `c5translate`. [52e7f5d](https://github.com/puka-tchou/c5_snippets/commit/52e7f5db7b946fe7a47a1d7e9ef8f7e9d98ed02d) -- **`c5assetregister`, `c5assetregistergroup`**: updates the indentation. [8da3dc6](https://github.com/puka-tchou/c5_snippets/commit/8da3dc6e4336453646f74f8f1f92cba38b10f74b) -- **php**: consistently use the `$0` and add missing `;`. [77a5698](https://github.com/puka-tchou/c5_snippets/commit/77a56986a2b616f08302e28475ceb44b8d2a792b) +**Build & Tooling** +- 🏗️ Switched build system from TypeScript compiler to esbuild — [e8f957f](https://github.com/puka-tchou/c5_snippets/commit/e8f957f) +- 🔧 Build tooling with standard-version for automated changelog generation -## [v0.0.2](https://github.com/puka-tchou/c5_snippets/releases/tag/v0.0.2) +**Development Environment** +- 🎨 Updated VS Code recommended extensions (added Prettier) +- 🛠️ Code quality tools: Prettier and ESLint integration -## Features +**CI & Infrastructure** +- 🤖 Updated GitHub Actions CI to use Node.js 25 and latest action versions +- 🔍 Updated CodeQL analysis to v4 — [0bed5d4](https://github.com/puka-tchou/c5_snippets/commit/0bed5d4) -- Add the `c5include` and `c5theme` snippets. [77259b2](https://github.com/puka-tchou/c5_snippets/commit/77259b29b0cdc13ef505a5d7df2a115848cca255) -- Add the `c5assetregister` snippet. [ee8581b](https://github.com/puka-tchou/c5_snippets/commit/ee8581b17502cdf06fe54564560df3843f25b6a8) -- Add the `c5assetregistergroup`, `c5assetrequire` and `c5assetrequiregroup` snippets. [bc00df8](https://github.com/puka-tchou/c5_snippets/commit/bc00df809ab03bc3eee8b28ae2bbb78eb0edc10d) +**Dependencies** +- 📦 Updated all npm dependencies -## Bug fixes +--- -- Correct the descriptions and identifiers of snippets. [95b692a](https://github.com/puka-tchou/c5_snippets/commit/95b692a540798f378632ffbf331fd5835fffbd17) -- Change `c5areaglobal` to `globalarea`. [e942d02](https://github.com/puka-tchou/c5_snippets/commit/e942d023c9a87eb80970a570f652980896c275e0) -- Correct the `c5assetregister` snippet. [d409332](https://github.com/puka-tchou/c5_snippets/commit/d409332df3fa97b17d9505f33e5da713884c0995) +## [0.0.4](https://github.com/puka-tchou/c5_snippets/releases/tag/v0.0.4) — 2022-02-25 + +### ✨ Added + +**Snippet Features** +- 🔗 `c5getlink`, `c5getlogoutlink`, and `c5geturl` snippets for URL and link generation — [#90](https://github.com/puka-tchou/c5_snippets/pull/90) + +**Development Tools** +- 🔧 Build tooling with standard-version for automated changelog generation — [7f0350c](https://github.com/puka-tchou/c5_snippets/commit/7f0350c) +- ✅ CI checks to verify extension compilation — [#89](https://github.com/puka-tchou/c5_snippets/pull/89) + +--- + +## [0.0.3](https://github.com/puka-tchou/c5_snippets/releases/tag/v0.0.3) — 2021-12-16 + +### 🗑️ Removed + +- Controller creation functionality — [#81](https://github.com/puka-tchou/c5_snippets/pull/81) + +--- + +## [0.0.2](https://github.com/puka-tchou/c5_snippets/releases/tag/v0.0.2) — 2021-08-02 + +### ✨ Added + +- **📄 Core Snippets** + - `c5include` and `c5theme` snippets for template inclusion — [77259b2](https://github.com/puka-tchou/c5_snippets/commit/77259b2) + - `c5assetregister` snippet for asset registration — [ee8581b](https://github.com/puka-tchou/c5_snippets/commit/ee8581b) + - `c5assetregistergroup`, `c5assetrequire`, and `c5assetrequiregroup` snippets for asset management — [bc00df8](https://github.com/puka-tchou/c5_snippets/commit/bc00df8) + +- **⚙️ Helper Snippets** + - `getsiteid` and `getsitename` snippets for site information + - `getsiteattribute` snippet for retrieving site attributes + - `getpagewrapper` snippet for page wrapper access + +- **🎨 Project Setup** + - 🎯 Extension icon and publisher configuration — [5eb9106](https://github.com/puka-tchou/c5_snippets/commit/5eb9106) + - 🛠️ Code quality tools: Prettier and ESLint integration — [8f26405](https://github.com/puka-tchou/c5_snippets/commit/8f26405) + +### 🐛 Fixed + +**Code Quality & Naming** +- ✅ Corrected snippet descriptions and identifiers — [95b692a](https://github.com/puka-tchou/c5_snippets/commit/95b692a) +- 🏷️ Changed `c5areaglobal` to `globalarea` for proper naming +- 🔤 Fixed `c5translation` snippet renamed to `c5translate` + +**Implementation & Configuration** +- 🔧 Fixed `c5assetregister` snippet implementation — [#17](https://github.com/puka-tchou/c5_snippets/issues/17) +- ⚙️ Updated asset registration options + +**Code Formatting & Structure** +- 📐 Improved indentation in `assetregister` and helper snippets — [#58](https://github.com/puka-tchou/c5_snippets/pull/58) +- 📐 Updated indentation in `c5assetregister` and `c5assetregistergroup` +- ✂️ Split array keys in `assetregister` for better readability — [#30](https://github.com/puka-tchou/c5_snippets/issues/30) +- 📝 Improved variable naming in helper snippets +- ➕ Added missing semicolons and consistent use of `$0` placeholders in PHP snippets diff --git a/CHANGELOG_AUTOMATION.md b/CHANGELOG_AUTOMATION.md new file mode 100644 index 0000000..32bb602 --- /dev/null +++ b/CHANGELOG_AUTOMATION.md @@ -0,0 +1,196 @@ +# Changelog Automation Setup + +This document explains the automated changelog system implemented for the concrete5-snippets project. + +## System Overview + +The project now uses a **fully automated changelog generation system** that ensures consistency and reduces manual maintenance burden. + +### Components + +1. **Conventional Commits** (`commitlint`) + - Validates commit message format + - Enforced via Git hooks before commits are allowed + +2. **Standard Version** (`standard-version`) + - Generates changelog automatically from commits + - Bumps version numbers + - Creates git tags + +3. **Version Configuration** (`.versionrc.json`) + - Defines how commits map to changelog sections + - Configures release URL generation + +4. **Commit Rules** (`.commitlintrc.json`) + - Validates commit structure + - Prevents invalid messages from being committed + +## How It Works + +### Developer Workflow + +``` +Developer writes feature → Commit with conventional message + ↓ + Git hook validates message + ↓ + If valid, commit accepted + If invalid, rejected with error +``` + +### Release Workflow + +``` +$ npm run release + ↓ +Run tests & type checking + ↓ +Analyze commits since last tag + ↓ +Determine version bump (major/minor/patch) + ↓ +Generate CHANGELOG.md from commits + ↓ +Create git tag + ↓ +Commit changes +``` + +## Commit Message Examples + +### Adding a Feature +``` +feat(snippets): add c5getlink snippet + +Add a new snippet for retrieving concrete5 links with proper URL generation. + +Closes #90 +``` + +**Result in Changelog:** +``` +✨ Features +- add c5getlink snippet (#90) +``` + +### Fixing a Bug +``` +fix(assetregister): split array keys for readability + +Separate CSS and JavaScript keys onto different lines. + +Fixes #30 +``` + +**Result in Changelog:** +``` +🐛 Bug Fixes +- split array keys for readability (#30) +``` + +### Infrastructure Changes +``` +ci: update github actions to latest versions +``` + +**Result in Changelog:** +``` +🤖 CI/CD +- update github actions to latest versions +``` + +## What Commits Become Changelog Entries + +✅ **Included:** +- `feat:` → ✨ Features +- `fix:` → 🐛 Bug Fixes +- `perf:` → ⚡ Performance +- `docs:` → 📚 Documentation +- `style:` → 💅 Code Style +- `refactor:` → ♻️ Refactoring +- `test:` → ✅ Tests +- `ci:` → 🤖 CI/CD +- `dev:` → 🛠️ Development +- `build:` → 📦 Build + +❌ **Hidden from Changelog:** +- `chore:` (internal changes) +- Merge commits + +## Benefits + +| Aspect | Before | After | +|--------|--------|-------| +| **Consistency** | Manual, prone to errors | Automatic, always consistent | +| **Time** | Hours rewriting changelog | Seconds, automatic | +| **Clarity** | Ad-hoc formatting | Standard format with links | +| **Traceability** | Manual linking | Auto-linked commits & PRs | +| **Commit Quality** | Informal messages | Enforced structured messages | +| **Release Process** | Manual tagging & version bumps | One command does it all | + +## For Contributors + +**Just follow the commit message format!** + +``` +(): + +Example: +feat(snippets): add getpagewrapper snippet + +This snippet provides convenient access to the page wrapper +for use in concrete5 theme templates. + +Closes #123 +``` + +If you make a mistake, Git will reject it: +``` +$ git commit -m "Added new stuff" +✖ type must be lowercase +✖ subject must not start with uppercase + +Fix your message and try again! +``` + +## For Maintainers + +Release a new version: + +```bash +npm run release +``` + +That's it! The tool will: +1. ✅ Run tests and type checking +2. 🔍 Analyze commits since last release +3. 📈 Determine version bump automatically +4. 📝 Generate CHANGELOG.md +5. 🏷️ Create git tag with version +6. 💾 Commit everything + +## Files Added/Modified + +### New Files +- `.commitlintrc.json` — Commit validation rules +- `.versionrc.json` — Changelog generation configuration +- `.husky/commit-msg` — Git hook for commit validation +- `CONTRIBUTING.md` — Contributor guidelines + +### Modified Files +- `package.json` — Added commitlint dependencies, updated release script + +## Migration Notes + +The current CHANGELOG.md was manually written for this session. Future versions will be generated automatically from commits. The format will remain similar but section grouping will depend on commit types. + +## References + +- [Conventional Commits](https://www.conventionalcommits.org/) +- [Commitlint Documentation](https://commitlint.js.org/) +- [Standard Version](https://github.com/conventional-changelog/standard-version) +- [Keep a Changelog](https://keepachangelog.com/) + +## Questions? + +See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed commit message guidelines and examples. diff --git a/COMMIT_CONVENTION.md b/COMMIT_CONVENTION.md new file mode 100644 index 0000000..a285303 --- /dev/null +++ b/COMMIT_CONVENTION.md @@ -0,0 +1,128 @@ +# Quick Reference: Commit Messages + +## Commit Format +``` +(): + + + +