Monorepo for Tangled tangled.org

ci: enforce prettier formatting #488

merged opened by winter.bsky.social targeting master from push-pzwzzlwkkpnw
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:pdrr2fgsfkvfbznqucjmyeee/sh.tangled.repo.pull/3lwcfu7gtho22
+34
Diff #2
+13
.prettierignore
··· 1 + flake.lock 2 + 3 + # for now, we don't want these formatted, but let's consider it in the future? 4 + *.json 5 + *.md 6 + *.yml 7 + *.yaml 8 + *.jsonc 9 + *.json 10 + 11 + # causes Go template plugin errors: https://github.com/NiklasPor/prettier-plugin-go-template/issues/120 12 + appview/pages/templates/layouts/repobase.html 13 + appview/pages/templates/repo/tags.html
+10
.prettierrc
··· 1 + { 2 + "overrides": [ 3 + { 4 + "files": ["*.html"], 5 + "options": { 6 + "parser": "go-template" 7 + } 8 + } 9 + ] 10 + }
+5
.tangled/workflows/fmt.yml
··· 17 17 unformatted=$(gofmt -l .) 18 18 test -z "$unformatted" || (echo "$unformatted" && exit 1) 19 19 20 + - name: "prettier" 21 + command: | 22 + # exec $(nix build .#prettier-wrapper --no-link --print-out-paths)/bin/prettier -c . 23 + nix develop -c "prettier -c ." || true 24 + ls -lah /
+6
flake.nix
··· 106 106 pkgsCross-gnu64-pkgsStatic-knot = crossPackages.knot; 107 107 pkgsCross-gnu64-pkgsStatic-knot-unwrapped = crossPackages.knot-unwrapped; 108 108 pkgsCross-gnu64-pkgsStatic-spindle = crossPackages.spindle; 109 + 110 + prettier-wrapper = pkgs.runCommand "prettier-wrapper" {nativeBuildInputs = [pkgs.makeWrapper];} '' 111 + mkdir -p "$out/bin" 112 + makeWrapper ${pkgs.prettier}/bin/prettier "$out/bin/prettier" --add-flags "--plugin=${pkgs.prettier-plugin-go-template}/lib/node_modules/prettier-plugin-go-template/lib/index.js" 113 + ''; 109 114 }); 110 115 defaultPackage = forAllSystems (system: self.packages.${system}.appview); 111 116 formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra); ··· 129 134 pkgs.redis 130 135 pkgs.coreutils # for those of us who are on systems that use busybox (alpine) 131 136 packages'.lexgen 137 + packages'.prettier-wrapper 132 138 ]; 133 139 shellHook = '' 134 140 mkdir -p appview/pages/static

History

6 rounds 4 comments
sign up or login to add to the discussion
1 commit
expand
ci: check formatting with treefmt
expand 0 comments
pull request successfully merged
1 commit
expand
ci: check formatting with treefmt
expand 0 comments
1 commit
expand
ci: add prettier check (hopefully it works)
expand 4 comments

Failed to update pull request on the PDS. Try again later.

Oh okay.

imo pkgs.runCommand should be pkgs.runCommandLocal I don't think your caching the package anywhere. will also make running the command slightly faster

to add a bit to my point. some people may have a number of caches, for example i have 15... i've also seen people with 8 here. this makes this pkgs.runCommand quite slow as oppose to pkgs.runCommandLocal since it doesn't have to contact the caches to see if they have the derivation. since it should build relatively quickly so it shouldn't be too detrimental to remove the cache query from it.

Picked the change Isabel suggested into master.

1 commit
expand
ci: add prettier check (hopefully it works)
expand 0 comments
1 commit
expand
ci: add prettier check (hopefully it works)
expand 0 comments
1 commit
expand
ci: add prettier check (hopefully it works)
expand 0 comments