From 36c4c1ab26fb79830e6b67dd19f5fcf277dbc9a8 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Fri, 2 Jan 2026 15:22:03 +0100 Subject: [PATCH] chore: migrate prettier to treefmt-nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move prettier configuration from .prettierrc to flake.nix treefmt - Add prettier-plugin-go-template for Hugo template formatting - Remove prettier from package.json devDependencies - Delete .prettierrc and .prettierignore files - Add CI workflow to check formatting on pull requests - Fix nested quotes in Hugo templates for go-template compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/format-check.yml | 21 ++++ .prettierignore | 4 - .prettierrc | 6 - assets/css/main.css | 4 +- assets/js/main.js | 82 +++++++------- flake.nix | 23 +++- layouts/404.html | 15 ++- layouts/_default/baseof.html | 10 +- layouts/_default/list.html | 12 +- layouts/_default/single.html | 8 +- layouts/blog/list.html | 8 +- layouts/blog/single.html | 89 ++++++++------- layouts/index.html | 164 +++++++++++++++++++++------ layouts/partials/blog-post-card.html | 29 +++-- layouts/partials/footer.html | 92 ++++++++++++--- layouts/partials/head.html | 58 ++++++---- layouts/partials/header.html | 137 ++++++++++++++++++---- package-lock.json | 17 --- package.json | 5 +- renovate.json | 6 +- 20 files changed, 545 insertions(+), 245 deletions(-) create mode 100644 .github/workflows/format-check.yml delete mode 100644 .prettierignore delete mode 100644 .prettierrc diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml new file mode 100644 index 000000000..babcf0bc1 --- /dev/null +++ b/.github/workflows/format-check.yml @@ -0,0 +1,21 @@ +name: Format Check + +on: + pull_request: + branches: [master] + +jobs: + format-check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Check formatting + run: nix fmt -- --fail-on-change diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index fefba5316..000000000 --- a/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -public -resources -package.json -package-lock.json diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 3d1f5e5cb..000000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "semi": false, - "singleQuote": true, - "trailingComma": "es5", - "arrowParens": "avoid" -} diff --git a/assets/css/main.css b/assets/css/main.css index ac544cf78..ef6218e29 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -1,4 +1,4 @@ -@import "tailwindcss"; +@import 'tailwindcss'; @theme { /* Brand Colors */ @@ -11,7 +11,7 @@ --color-sky-600: #1a7aad; /* Typography */ - --font-family-sans: "Montserrat", ui-sans-serif, system-ui, sans-serif; + --font-family-sans: 'Montserrat', ui-sans-serif, system-ui, sans-serif; } @plugin "@tailwindcss/typography"; diff --git a/assets/js/main.js b/assets/js/main.js index d3d051c54..8631264e5 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,65 +1,67 @@ // Mobile menu toggle -document.addEventListener('DOMContentLoaded', function() { - const menuButton = document.getElementById('mobile-menu-button'); - const menuCloseButton = document.getElementById('mobile-menu-close'); - const mobileMenu = document.getElementById('mobile-menu'); - const openIcon = document.getElementById('menu-icon-open'); - const closeIcon = document.getElementById('menu-icon-close'); +document.addEventListener('DOMContentLoaded', function () { + const menuButton = document.getElementById('mobile-menu-button') + const menuCloseButton = document.getElementById('mobile-menu-close') + const mobileMenu = document.getElementById('mobile-menu') + const openIcon = document.getElementById('menu-icon-open') + const closeIcon = document.getElementById('menu-icon-close') function openMenu() { - menuButton.setAttribute('aria-expanded', 'true'); - mobileMenu.classList.remove('hidden'); - openIcon.classList.add('hidden'); - closeIcon.classList.remove('hidden'); + menuButton.setAttribute('aria-expanded', 'true') + mobileMenu.classList.remove('hidden') + openIcon.classList.add('hidden') + closeIcon.classList.remove('hidden') } function closeMenu() { - menuButton.setAttribute('aria-expanded', 'false'); - mobileMenu.classList.add('hidden'); - openIcon.classList.remove('hidden'); - closeIcon.classList.add('hidden'); + menuButton.setAttribute('aria-expanded', 'false') + mobileMenu.classList.add('hidden') + openIcon.classList.remove('hidden') + closeIcon.classList.add('hidden') } if (menuButton && mobileMenu) { - menuButton.addEventListener('click', function() { - const isExpanded = menuButton.getAttribute('aria-expanded') === 'true'; + menuButton.addEventListener('click', function () { + const isExpanded = menuButton.getAttribute('aria-expanded') === 'true' if (isExpanded) { - closeMenu(); + closeMenu() } else { - openMenu(); + openMenu() } - }); + }) } if (menuCloseButton) { - menuCloseButton.addEventListener('click', closeMenu); + menuCloseButton.addEventListener('click', closeMenu) } // Close mobile menu when clicking on a link - const menuLinks = mobileMenu?.querySelectorAll('a'); - menuLinks?.forEach(function(link) { - link.addEventListener('click', closeMenu); - }); -}); + const menuLinks = mobileMenu?.querySelectorAll('a') + menuLinks?.forEach(function (link) { + link.addEventListener('click', closeMenu) + }) +}) // Go to top button -document.addEventListener('DOMContentLoaded', function() { - const goToTopButton = document.createElement('button'); - goToTopButton.id = 'go-to-top'; - goToTopButton.className = 'fixed bottom-8 right-8 z-50 hidden p-3 bg-sky-500 text-white rounded-full shadow-lg hover:bg-sky-600 focus:outline-none focus:ring-2 focus:ring-sky-500 focus:ring-offset-2 transition-opacity'; - goToTopButton.setAttribute('aria-label', 'Go to top'); - goToTopButton.innerHTML = ''; - document.body.appendChild(goToTopButton); +document.addEventListener('DOMContentLoaded', function () { + const goToTopButton = document.createElement('button') + goToTopButton.id = 'go-to-top' + goToTopButton.className = + 'fixed bottom-8 right-8 z-50 hidden p-3 bg-sky-500 text-white rounded-full shadow-lg hover:bg-sky-600 focus:outline-none focus:ring-2 focus:ring-sky-500 focus:ring-offset-2 transition-opacity' + goToTopButton.setAttribute('aria-label', 'Go to top') + goToTopButton.innerHTML = + '' + document.body.appendChild(goToTopButton) - window.addEventListener('scroll', function() { + window.addEventListener('scroll', function () { if (window.scrollY > 300) { - goToTopButton.classList.remove('hidden'); + goToTopButton.classList.remove('hidden') } else { - goToTopButton.classList.add('hidden'); + goToTopButton.classList.add('hidden') } - }); + }) - goToTopButton.addEventListener('click', function() { - window.scrollTo({ top: 0, behavior: 'smooth' }); - }); -}); + goToTopButton.addEventListener('click', function () { + window.scrollTo({ top: 0, behavior: 'smooth' }) + }) +}) diff --git a/flake.nix b/flake.nix index ed11a2fad..3e3cb4c9b 100644 --- a/flake.nix +++ b/flake.nix @@ -59,10 +59,31 @@ "*.gitignore" ".envrc" "LICENSE" + "public/*" + "resources/*" + "package.json" + "package-lock.json" ]; programs.nixfmt.enable = true; - programs.prettier.enable = true; + programs.prettier = { + enable = true; + settings = { + semi = false; + singleQuote = true; + trailingComma = "es5"; + arrowParens = "avoid"; + plugins = [ + "${pkgs.prettier-plugin-go-template}/lib/node_modules/prettier-plugin-go-template/lib/index.js" + ]; + overrides = [ + { + files = [ "layouts/**/*.html" ]; + options.parser = "go-template"; + } + ]; + }; + }; }; devShells.default = pkgs.mkShellNoCC { diff --git a/layouts/404.html b/layouts/404.html index eeb34c46c..249b9b457 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,10 +2,19 @@

404

-

Page not found

-

Sorry, we couldn't find the page you're looking for.

+

+ Page not found +

+

+ Sorry, we couldn't find the page you're looking for. +

diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4f874e5ba..12d599d06 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,15 +1,13 @@ - + {{- partial "head.html" . -}} {{- partial "header.html" . -}} -
- {{- block "main" . }}{{- end }} -
- {{- partial "footer.html" . -}} - {{- $js := resources.Get "js/main.js" | minify -}} +
{{- block "main" . }}{{- end }}
+ {{- partial "footer.html" . -}} {{- $js := resources.Get "js/main.js" | + minify -}} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 170b7f50b..7a7921f27 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,15 +2,17 @@
-

{{ .Title }}

+

+ {{ .Title }} +

{{ with .Description }}

{{ . }}

{{ end }}
-
- {{ range .Pages }} - {{ partial "blog-post-card.html" . }} - {{ end }} +
+ {{ range .Pages }} {{ partial "blog-post-card.html" . }} {{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 483c5d111..e1353886a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,11 +2,11 @@
-

{{ .Title }}

+

+ {{ .Title }} +

-
- {{ .Content }} -
+
{{ .Content }}
{{ end }} diff --git a/layouts/blog/list.html b/layouts/blog/list.html index d2582b623..8bf380e2b 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -5,15 +5,15 @@
-

Blog

+

+ Blog +

Insights and best practices for Magento development.

- {{ range .Pages }} - {{ partial "blog-post-card.html" . }} - {{ end }} + {{ range .Pages }} {{ partial "blog-post-card.html" . }} {{ end }}
diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 97fbb52cc..52a691f8b 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -1,73 +1,78 @@ {{ define "main" }}
-
-

{{ .Title }}

+

+ {{ .Title }} +

{{ with .Params.summary }}

{{ . }}

- {{ end }} - {{ with .Params.authors }} - {{ $authorId := index . 0 }} - {{ $authors := $.Site.Data.authors }} - {{ $author := index $authors $authorId }} - {{ if $author }} + {{ end }} {{ with .Params.authors }} {{ $authorId := index . 0 }} {{ + $authors := $.Site.Data.authors }} {{ $author := index $authors $authorId + }} {{ if $author }}
{{ if $author.showAvatar }} - {{ $author.name }} + {{ $author.name }} {{ end }}

{{ $author.name }}

{{ $author.role }}

- {{ end }} - {{ end }} + {{ end }} {{ end }}
-
- {{ .Content }} -
+
{{ .Content }}
diff --git a/layouts/index.html b/layouts/index.html index f721d9c2a..2c72deb1d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,7 +1,9 @@ {{ define "main" }}
-
+

Services

Manufacturing your success @@ -13,25 +15,59 @@

Services

- +
{{ if eq .icon "shopping-cart" }} - - + + {{ else if eq .icon "wrench" }} - - + + {{ else if eq .icon "code" }} - - + + {{ end }}
-

+

{{ .name }}

@@ -46,21 +82,24 @@

-{{ $posts := where .Site.RegularPages "Section" "blog" }} -{{ $publishedPosts := where $posts ".Draft" false }} -{{ if gt (len $publishedPosts) 0 }} +{{ $posts := where .Site.RegularPages "Section" "blog" }} {{ $publishedPosts := +where $posts ".Draft" false }} {{ if gt (len $publishedPosts) 0 }} -
+
-

From the blog

+

+ From the blog +

- {{ range first 3 $publishedPosts }} - {{ partial "blog-post-card.html" . }} + {{ range first 3 $publishedPosts }} {{ partial "blog-post-card.html" . }} {{ end }}
@@ -76,14 +115,26 @@

Let's work together

- We'd love to hear from you! Send us a message using email or give us a call. + We'd love to hear from you! Send us a message using email or give us a + call.

Phone number
- +39 345 523 5101
@@ -91,11 +142,25 @@

Email
- - + contact@codemanufacture.com @@ -116,16 +181,24 @@

Meet our team

- A small team of seasoned Magento developers with over a decade of experience. + A small team of seasoned Magento developers with over a decade of + experience.

-
    +
      {{ range $id, $person := .Site.Data.authors }}
    • {{ if $person.showAvatar }} - {{ $person.name }} + {{ $person.name }} {{ end }}

      {{ $person.name }}

      @@ -133,20 +206,45 @@

      {{ $person.name }}

        {{ with $person.twitter }}
      • - + Twitter -
      • - {{ end }} - {{ with $person.linkedin }} + {{ end }} {{ with $person.linkedin }}
      • - + LinkedIn -
      • diff --git a/layouts/partials/blog-post-card.html b/layouts/partials/blog-post-card.html index 7ca958186..c28447884 100644 --- a/layouts/partials/blog-post-card.html +++ b/layouts/partials/blog-post-card.html @@ -1,4 +1,6 @@ -
        +
        {{ if .Draft }} @@ -18,31 +20,36 @@ {{ end }}
        - {{ with .Params.authors }} - {{ $authorId := index . 0 }} - {{ $authors := $.Site.Data.authors }} - {{ $author := index $authors $authorId }} - {{ if $author }} + {{ with .Params.authors }} {{ $authorId := index . 0 }} {{ $authors := + $.Site.Data.authors }} {{ $author := index $authors $authorId }} {{ if + $author }}
        {{ if $author.showAvatar }} {{ $author.name }} - {{ $author.name }} + {{ $author.name }} {{ end }}

        {{ $author.name }}

        {{ if not $.Draft }} - + - {{ math.Round (div (countwords $.Plain) 200.0) }} min read + {{ math.Round (div (countwords $.Plain) 200.0) }} min read {{ else }} Coming soon {{ end }}
        - {{ end }} - {{ end }} + {{ end }} {{ end }}
        diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index f881fb1af..aab833b9a 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,47 +1,107 @@ diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e5cf712c1..fbed23d9f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,31 +1,49 @@ - - -{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }} - - + + + + {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ + end }} + + + - - - - - - + + + + + + - + - + - - - + + + -{{ $css := resources.Get "css/output.css" }} -{{ if $css }} - {{ $css = $css | minify | fingerprint }} - +{{ $css := resources.Get "css/output.css" }} {{ if $css }} {{ $css = $css | +minify | fingerprint }} + {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index e01c6a74e..ca6023841 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,23 +1,60 @@ -
        +
        -
        +
        -
        @@ -25,38 +62,94 @@
        -