-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to WebP & pre-commit hook #12590
Conversation
- this change adds `yarn convert-to-webp` command - this checks for PNG images, converts them to WebP, then updates markdown references
Hi @tabathadelane 👋 Thanks for your pull request! Your PR is in a queue, and a writer will take a look soon. We generally publish small edits within one business day, and larger edits within three days. Gatsby Cloud will automatically generate a preview of your request, and will comment with a link when the preview is ready (usually 20 to 30 minutes). |
✅ docs-website-develop deploy preview ready
|
* check literal `.` in `stagedMDs` regex * use `continue` instead of `break` to avoid early exit * update convert-to-webp script to include jpgs * add error logging to convert-to-webp * run Prettier
|
||
import { rm, readFile, writeFile } from 'fs/promises'; | ||
import { glob } from 'glob10'; | ||
// installed with an alias because v10 conflicts with jest dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you move this a line up? comments are usually above the line they refer to
@@ -28,6 +28,10 @@ const main = async () => { | |||
|
|||
console.log(results); | |||
console.log(`Failed file count: ${results.length}`); | |||
|
|||
if (results.length > 0) { | |||
process.exitCode = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good addition!
webp-converter
package to convert PNG images to WebPconvertPNGs.mjs
script to convert repo PNGs to WebP formatglob
package to grab all png/markdown/js filesglob10
because jest is using glob v7 as a dependency and it was causing major conflicts to install a newer versionmeow
package for flag support to run script on staged vs global fileshusky
package for pre-commit checkspre-commit.mjs
script that warns contributors on png image uploadspackage.json
scripts in ascending orderyarn lint
andyarn pre-commit
to required checks that must pass before staged files can be committedScript can be run on staged files with command
yarn convert-to-webp
Script can be run globally on entire repo with command
yarn convert-to-webp -g
NOTE: The pre-commit.sh scripts have been temporarily disabled until we can coordinate with writers about this change.
NOTE: 😢 Github desktop does not 🙅♀️ support bash escape characters to change 🎨ANSI colors, so the pre-commit failure message can only use emojis
replaces #12317