tbicr / django-pg-zero-downtime-migrations

Django postgresql backend that apply migrations with respect to database locks
MIT License
525 stars 25 forks source link

Do you have a workflow for running `prettier` on markdown files? #35

Closed tony closed 2 years ago

tony commented 2 years ago

Have you ever hooked prettier into your editor before for markdown files? It automatically handles wrapping lines and tables.

https://github.com/tbicr/django-pg-zero-downtime-migrations/compare/master...tony:format-with-prettier

One command: npx prettier --no-config --write README.md

- `npx`: Run `npm` package CLI command without installing to system - `--no-config`: Disregard any configs in user's dirs - `--write`: save - `README.md` ...: Files to format

image

tbicr commented 2 years ago

Have you ever hooked prettier into your editor before for markdown files?

No before, I like table formating, for line wrapping not sure it is the best option if you want to edit text, otherwise, your editor should support similar logic or prettier should be integrated to pre-commit or check.

tony commented 2 years ago

@tbicr

Would you like either of these?

  1. a PR of https://github.com/tbicr/django-pg-zero-downtime-migrations/compare/master...tony:format-with-prettier, and / or
  2. setup pre-commit config (docs)

    .pre-commit-config.yaml

    - repo: https://github.com/pre-commit/mirrors-prettier
      rev: "" # Use the sha or tag you want to point at
      hooks:
        - id: prettier
tbicr commented 2 years ago

@tony , both looks good, thank you

tony commented 2 years ago

@tbicr

tony commented 2 years ago

@tbicr As a next step, i'm not sure if you have yet, but you need to configure https://pre-commit.ci/ bot with the repository by logging in

tbicr commented 2 years ago

@tony , can github action used instead https://github.com/pre-commit/action ?

tony commented 2 years ago

@tbicr

Maybe but it looks like the author is moving away from the action

DEPRECATED this action is in maintenance-only mode and will not be accepting new features.

Please switch to using pre-commit.ci which is faster and has more features.

From the looks of it it's unsafe, re https://github.com/pre-commit/action/issues/148 and the bottom of the README

while you could technically configure this for a public repository (using a personal access token), I can't think of a way to do this safely without exposing a privileged token to pull requests -- if you have any ideas, please leave an issue!

It may be fine to use https://pre-commit.ci/, if not we can simply not use the tool for now